Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Xuanwo <github@xuanwo.io>
  • Loading branch information
Xuanwo committed Aug 11, 2022
1 parent b146503 commit 371706a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/layers/layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ mod tests {

use super::*;
use crate::ops::OpDelete;
use crate::services::fs;
use crate::Accessor;
use crate::Operator;
use crate::Scheme;

#[derive(Debug)]
struct Test {
Expand Down Expand Up @@ -99,7 +99,7 @@ mod tests {
deleted: Arc::new(Mutex::new(false)),
};

let op = Operator::new(fs::Builder::default().build().unwrap()).layer(&test);
let op = Operator::from_env(Scheme::Fs).unwrap().layer(&test);

op.object("xxxxx").delete().await.unwrap();

Expand Down
4 changes: 2 additions & 2 deletions src/layers/retry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ use crate::ObjectMetadata;
/// # use opendal::services::fs::Builder;
/// use backon::ExponentialBackoff;
/// use opendal::Operator;
/// use opendal::Scheme;
///
/// # #[tokio::main]
/// # async fn main() -> Result<()> {
/// # let accessor = fs::Backend::build().finish().await?;
/// let op = Operator::new(accessor).layer(ExponentialBackoff::default());
/// let op = Operator::from_env(Scheme::Fs)?.layer(ExponentialBackoff::default());
/// // All operations will be retried if the error is retryable
/// let _ = op.object("test_file").read();
/// # Ok(())
Expand Down
11 changes: 4 additions & 7 deletions src/services/hdfs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
//!
//! #[tokio::main]
//! async fn main() -> Result<()> {
//! let op: Operator = Operator::from_env(Scheme::Hdfs).await?;
//! let op: Operator = Operator::from_env(Scheme::Hdfs)?;
//!
//! // Create an object handle to start operation on object.
//! let _: Object = op.object("test_file");
Expand All @@ -93,31 +93,28 @@
//!
//! ### Via Builder
//!
//! ```
//! ```no_run
//! use std::sync::Arc;
//!
//! use anyhow::Result;
//! use opendal::services::hdfs;
//! use opendal::services::hdfs::Builder;
//! use opendal::Accessor;
//! use opendal::Object;
//! use opendal::Operator;
//!
//! #[tokio::main]
//! async fn main() -> Result<()> {
//! // Create fs backend builder.
//! let mut builder: Builder = hdfs::Backend::build();
//! let mut builder = hdfs::Builder::default();
//! // Set the name node for hdfs.
//! builder.name_node("hdfs://127.0.0.1:9000");
//! // Set the root for hdfs, all operations will happen under this root.
//! //
//! // NOTE: the root must be absolute path.
//! builder.root("/tmp");
//! // Build the `Accessor`.
//! let accessor: Arc<dyn Accessor> = builder.finish().await?;
//!
//! // `Accessor` provides the low level APIs, we will use `Operator` normally.
//! let op: Operator = Operator::new(accessor);
//! let op: Operator = Operator::new(builder.build()?);
//!
//! // Create an object handle to start operation on object.
//! let _: Object = op.object("test_file");
Expand Down

1 comment on commit 371706a

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for opendal ready!

✅ Preview
https://opendal-18bgrfzj7-databend.vercel.app

Built with commit 371706a.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.