Skip to content

Commit f779d82

Browse files
authored
fix: Fix presign related unit tests (#1910)
* fix: Fix presign related unit tests Signed-off-by: Xuanwo <[email protected]> * Fix typo Signed-off-by: Xuanwo <[email protected]> --------- Signed-off-by: Xuanwo <[email protected]>
1 parent ab13bc7 commit f779d82

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

core/src/services/s3/core.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,15 @@ impl S3Core {
121121
self.signer.sign(req, &cred).map_err(new_request_sign_error)
122122
}
123123

124-
pub async fn sign_query<T>(&self, req: &mut Request<T>, durtion: Duration) -> Result<()> {
124+
pub async fn sign_query<T>(&self, req: &mut Request<T>, duration: Duration) -> Result<()> {
125125
let cred = if let Some(cred) = self.load_credential().await? {
126126
cred
127127
} else {
128128
return Ok(());
129129
};
130130

131131
self.signer
132-
.sign_query(req, durtion, &cred)
132+
.sign_query(req, duration, &cred)
133133
.map_err(new_request_sign_error)
134134
}
135135

core/src/types/operator/operator.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -1061,11 +1061,11 @@ impl Operator {
10611061
/// use anyhow::Result;
10621062
/// use futures::io;
10631063
/// use opendal::Operator;
1064-
/// use time::Duration;
1064+
/// use std::time::Duration;
10651065
///
10661066
/// #[tokio::main]
10671067
/// async fn test(op: Operator) -> Result<()> {
1068-
/// let signed_req = op.presign_stat("test",Duration::hours(1)).await?;
1068+
/// let signed_req = op.presign_stat("test",Duration::from_secs(3600)).await?;
10691069
/// let req = http::Request::builder()
10701070
/// .method(signed_req.method())
10711071
/// .uri(signed_req.uri())
@@ -1091,11 +1091,11 @@ impl Operator {
10911091
/// use anyhow::Result;
10921092
/// use futures::io;
10931093
/// use opendal::Operator;
1094-
/// use time::Duration;
1094+
/// use std::time::Duration;
10951095
///
10961096
/// #[tokio::main]
10971097
/// async fn test(op: Operator) -> Result<()> {
1098-
/// let signed_req = op.presign_read("test.txt", Duration::hours(1)).await?;
1098+
/// let signed_req = op.presign_read("test.txt", Duration::from_secs(3600)).await?;
10991099
/// # Ok(())
11001100
/// # }
11011101
/// ```
@@ -1128,14 +1128,14 @@ impl Operator {
11281128
/// use anyhow::Result;
11291129
/// use futures::io;
11301130
/// use opendal::Operator;
1131-
/// use time::Duration;
1131+
/// use std::time::Duration;
11321132
/// use opendal::ops::OpRead;
11331133
///
11341134
/// #[tokio::main]
11351135
/// async fn test(op: Operator) -> Result<()> {
11361136
/// let args = OpRead::new()
11371137
/// .with_override_content_disposition("attachment; filename=\"othertext.txt\"");
1138-
/// let signed_req = op.presign_read_with("test.txt", args, Duration::hours(1)).await?;
1138+
/// let signed_req = op.presign_read_with("test.txt", args, Duration::from_secs(3600)).await?;
11391139
/// # Ok(())
11401140
/// # }
11411141
/// ```
@@ -1161,11 +1161,11 @@ impl Operator {
11611161
/// use anyhow::Result;
11621162
/// use futures::io;
11631163
/// use opendal::Operator;
1164-
/// use time::Duration;
1164+
/// use std::time::Duration;
11651165
///
11661166
/// #[tokio::main]
11671167
/// async fn test(op: Operator) -> Result<()> {
1168-
/// let signed_req = op.presign_write("test.txt", Duration::hours(1)).await?;
1168+
/// let signed_req = op.presign_write("test.txt", Duration::from_secs(3600)).await?;
11691169
/// # Ok(())
11701170
/// # }
11711171
/// ```
@@ -1194,12 +1194,12 @@ impl Operator {
11941194
/// use futures::io;
11951195
/// use opendal::ops::OpWrite;
11961196
/// use opendal::Operator;
1197-
/// use time::Duration;
1197+
/// use std::time::Duration;
11981198
///
11991199
/// #[tokio::main]
12001200
/// async fn test(op: Operator) -> Result<()> {
12011201
/// let args = OpWrite::new().with_content_type("text/csv");
1202-
/// let signed_req = op.presign_write_with("test", args, Duration::hours(1)).await?;
1202+
/// let signed_req = op.presign_write_with("test", args, Duration::from_secs(3600)).await?;
12031203
/// let req = http::Request::builder()
12041204
/// .method(signed_req.method())
12051205
/// .uri(signed_req.uri())

0 commit comments

Comments
 (0)