You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xu...@apache.org on 2023/04/11 14:49:37 UTC

[incubator-opendal] branch main updated: fix: Fix presign related unit tests (#1910)

This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git


The following commit(s) were added to refs/heads/main by this push:
     new f779d82a fix: Fix presign related unit tests (#1910)
f779d82a is described below

commit f779d82a9d240bd748a60c10321d2b49b00863f6
Author: Xuanwo <gi...@xuanwo.io>
AuthorDate: Tue Apr 11 22:49:30 2023 +0800

    fix: Fix presign related unit tests (#1910)
    
    * fix: Fix presign related unit tests
    
    Signed-off-by: Xuanwo <gi...@xuanwo.io>
    
    * Fix typo
    
    Signed-off-by: Xuanwo <gi...@xuanwo.io>
    
    ---------
    
    Signed-off-by: Xuanwo <gi...@xuanwo.io>
---
 core/src/services/s3/core.rs        |  4 ++--
 core/src/types/operator/operator.rs | 20 ++++++++++----------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/core/src/services/s3/core.rs b/core/src/services/s3/core.rs
index 58b19a4a..868cd281 100644
--- a/core/src/services/s3/core.rs
+++ b/core/src/services/s3/core.rs
@@ -121,7 +121,7 @@ impl S3Core {
         self.signer.sign(req, &cred).map_err(new_request_sign_error)
     }
 
-    pub async fn sign_query<T>(&self, req: &mut Request<T>, durtion: Duration) -> Result<()> {
+    pub async fn sign_query<T>(&self, req: &mut Request<T>, duration: Duration) -> Result<()> {
         let cred = if let Some(cred) = self.load_credential().await? {
             cred
         } else {
@@ -129,7 +129,7 @@ impl S3Core {
         };
 
         self.signer
-            .sign_query(req, durtion, &cred)
+            .sign_query(req, duration, &cred)
             .map_err(new_request_sign_error)
     }
 
diff --git a/core/src/types/operator/operator.rs b/core/src/types/operator/operator.rs
index d1069b8f..b33b0638 100644
--- a/core/src/types/operator/operator.rs
+++ b/core/src/types/operator/operator.rs
@@ -1061,11 +1061,11 @@ impl Operator {
     /// use anyhow::Result;
     /// use futures::io;
     /// use opendal::Operator;
-    /// use time::Duration;
+    /// use std::time::Duration;
     ///
     /// #[tokio::main]
     /// async fn test(op: Operator) -> Result<()> {
-    ///     let signed_req = op.presign_stat("test",Duration::hours(1)).await?;
+    ///     let signed_req = op.presign_stat("test",Duration::from_secs(3600)).await?;
     ///     let req = http::Request::builder()
     ///         .method(signed_req.method())
     ///         .uri(signed_req.uri())
@@ -1091,11 +1091,11 @@ impl Operator {
     /// use anyhow::Result;
     /// use futures::io;
     /// use opendal::Operator;
-    /// use time::Duration;
+    /// use std::time::Duration;
     ///
     /// #[tokio::main]
     /// async fn test(op: Operator) -> Result<()> {
-    ///     let signed_req = op.presign_read("test.txt", Duration::hours(1)).await?;
+    ///     let signed_req = op.presign_read("test.txt", Duration::from_secs(3600)).await?;
     /// #    Ok(())
     /// # }
     /// ```
@@ -1128,14 +1128,14 @@ impl Operator {
     /// use anyhow::Result;
     /// use futures::io;
     /// use opendal::Operator;
-    /// use time::Duration;
+    /// use std::time::Duration;
     /// use opendal::ops::OpRead;
     ///
     /// #[tokio::main]
     /// async fn test(op: Operator) -> Result<()> {
     ///     let args = OpRead::new()
     ///         .with_override_content_disposition("attachment; filename=\"othertext.txt\"");
-    ///     let signed_req = op.presign_read_with("test.txt", args, Duration::hours(1)).await?;
+    ///     let signed_req = op.presign_read_with("test.txt", args, Duration::from_secs(3600)).await?;
     /// #    Ok(())
     /// # }
     /// ```
@@ -1161,11 +1161,11 @@ impl Operator {
     /// use anyhow::Result;
     /// use futures::io;
     /// use opendal::Operator;
-    /// use time::Duration;
+    /// use std::time::Duration;
     ///
     /// #[tokio::main]
     /// async fn test(op: Operator) -> Result<()> {
-    ///     let signed_req = op.presign_write("test.txt", Duration::hours(1)).await?;
+    ///     let signed_req = op.presign_write("test.txt", Duration::from_secs(3600)).await?;
     /// #    Ok(())
     /// # }
     /// ```
@@ -1194,12 +1194,12 @@ impl Operator {
     /// use futures::io;
     /// use opendal::ops::OpWrite;
     /// use opendal::Operator;
-    /// use time::Duration;
+    /// use std::time::Duration;
     ///
     /// #[tokio::main]
     /// async fn test(op: Operator) -> Result<()> {
     ///     let args = OpWrite::new().with_content_type("text/csv");
-    ///     let signed_req = op.presign_write_with("test", args, Duration::hours(1)).await?;
+    ///     let signed_req = op.presign_write_with("test", args, Duration::from_secs(3600)).await?;
     ///     let req = http::Request::builder()
     ///         .method(signed_req.method())
     ///         .uri(signed_req.uri())