Skip to content

Commit

Permalink
Fix clippy warnings (#661)
Browse files Browse the repository at this point in the history
Signed-off-by: Monthon Klongklaew <[email protected]>
  • Loading branch information
monthonk authored Dec 4, 2023
1 parent ecc2162 commit 90f85a3
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 4 deletions.
5 changes: 4 additions & 1 deletion mountpoint-s3-client/tests/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ use bytes::Bytes;
use common::*;
use futures::StreamExt;
use mountpoint_s3_client::config::{EndpointConfig, S3ClientAuthConfig, S3ClientConfig};
#[cfg(not(feature = "s3express_tests"))]
use mountpoint_s3_client::error::ObjectClientError;
use mountpoint_s3_client::{ObjectClient, S3CrtClient, S3RequestError};
#[cfg(not(feature = "s3express_tests"))]
use mountpoint_s3_client::S3RequestError;
use mountpoint_s3_client::{ObjectClient, S3CrtClient};
use mountpoint_s3_crt::auth::credentials::{CredentialsProvider, CredentialsProviderStaticOptions};
use mountpoint_s3_crt::common::allocator::Allocator;
use rusty_fork::rusty_fork_test;
Expand Down
1 change: 1 addition & 0 deletions mountpoint-s3-client/tests/endpoint_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ async fn test_single_region_access_point(addressing_style: AddressingStyle, arn:
.await;
}

#[cfg(not(feature = "s3express_tests"))]
// For Object Lambda Access Point, PutObject is not supported,
// For multi region access points, Rust SDK is not supported. Hence different helper method for these tests.
async fn run_list_objects_test<F: FnOnce(&str) -> EndpointConfig>(f: F, prefix: &str, bucket: &str) {
Expand Down
5 changes: 4 additions & 1 deletion mountpoint-s3-client/tests/head_bucket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
pub mod common;

use common::*;
#[cfg(not(feature = "s3express_tests"))]
use mountpoint_s3_client::config::{EndpointConfig, S3ClientConfig};
use mountpoint_s3_client::error::{HeadBucketError, ObjectClientError};
use mountpoint_s3_client::{S3CrtClient, S3RequestError};
#[cfg(not(feature = "s3express_tests"))]
use mountpoint_s3_client::S3CrtClient;
use mountpoint_s3_client::S3RequestError;

#[tokio::test]
async fn test_head_bucket_correct_region() {
Expand Down
4 changes: 4 additions & 0 deletions mountpoint-s3-client/tests/head_object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@

pub mod common;

#[cfg(not(feature = "s3express_tests"))]
use std::time::{Duration, Instant};

use aws_sdk_s3::primitives::ByteStream;
#[cfg(not(feature = "s3express_tests"))]
use aws_sdk_s3::types::{GlacierJobParameters, RestoreRequest, Tier};
use bytes::Bytes;
use common::*;
use mountpoint_s3_client::error::{HeadObjectError, ObjectClientError};
#[cfg(not(feature = "s3express_tests"))]
use mountpoint_s3_client::types::RestoreStatus;
use mountpoint_s3_client::{ObjectClient, S3CrtClient, S3RequestError};
#[cfg(not(feature = "s3express_tests"))]
use test_case::test_case;

#[tokio::test]
Expand Down
6 changes: 4 additions & 2 deletions mountpoint-s3/tests/fuse_tests/fork_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#![cfg(feature = "s3_tests")]

use assert_cmd::prelude::*;
#[cfg(not(feature = "s3express_tests"))]
use aws_sdk_sts::config::Region;
use std::fs;
use std::io::{BufRead, BufReader};
Expand All @@ -10,9 +11,10 @@ use std::{path::PathBuf, process::Command};
use test_case::test_case;

use crate::common::fuse::{
create_objects, get_subsession_iam_role, get_test_bucket_and_prefix, get_test_bucket_forbidden, get_test_region,
read_dir_to_entry_names, tokio_block_on,
create_objects, get_test_bucket_and_prefix, get_test_bucket_forbidden, get_test_region, read_dir_to_entry_names,
};
#[cfg(not(feature = "s3express_tests"))]
use crate::common::fuse::{get_subsession_iam_role, tokio_block_on};

const MAX_WAIT_DURATION: std::time::Duration = std::time::Duration::from_secs(10);

Expand Down
5 changes: 5 additions & 0 deletions mountpoint-s3/tests/fuse_tests/read_test.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
use std::fs::{read_dir, File};
use std::io::{Read as _, Seek, SeekFrom};
#[cfg(not(feature = "s3express_tests"))]
use std::os::unix::prelude::PermissionsExt;
#[cfg(not(feature = "s3express_tests"))]
use std::time::{Duration, Instant};

use fuser::BackgroundSession;
use mountpoint_s3::data_cache::InMemoryDataCache;
#[cfg(not(feature = "s3express_tests"))]
use mountpoint_s3_client::types::PutObjectParams;
use rand::RngCore;
use rand::SeedableRng as _;
Expand Down Expand Up @@ -91,13 +94,15 @@ fn basic_read_test_mock_with_cache(prefix: &str) {
);
}

#[cfg(not(feature = "s3express_tests"))]
#[derive(PartialEq)]
enum RestorationOptions {
None,
RestoreAndWait,
RestoreInProgress,
}

#[cfg(not(feature = "s3express_tests"))]
fn read_flexible_retrieval_test<F>(creator_fn: F, prefix: &str, files: &[&str], restore: RestorationOptions)
where
F: FnOnce(&str, TestSessionConfig) -> (TempDir, BackgroundSession, TestClientBox),
Expand Down
1 change: 1 addition & 0 deletions mountpoint-s3/tests/fuse_tests/write_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ fn out_of_order_write_test_mock(offset: i64) {
out_of_order_write_test(fuse::mock_session::new, offset);
}

#[cfg(not(feature = "s3express_tests"))]
fn write_with_storage_class_test<F>(creator_fn: F, storage_class: Option<&str>)
where
F: FnOnce(&str, TestSessionConfig) -> (TempDir, BackgroundSession, TestClientBox),
Expand Down

0 comments on commit 90f85a3

Please sign in to comment.