Skip to content

Commit 14a137a

Browse files
committed
[test] apply the new test style to common-dal
Signed-off-by: Chojan Shang <[email protected]>
1 parent 68bbe71 commit 14a137a

File tree

10 files changed

+44
-26
lines changed

10 files changed

+44
-26
lines changed

common/dal/Cargo.toml

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ license = "Apache-2.0"
66
publish = false
77
edition = "2021"
88

9+
[lib]
10+
doctest = false
11+
test = false
12+
913
[dependencies]
1014
common-base = {path = "../base"}
1115
common-datablocks = {path = "../datablocks"}

common/dal/src/README.md renamed to common/dal/README.md

-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,3 @@ async fn get(&self, path: &str) -> Result<Bytes>;
1414

1515
async fn put(&self, path: &str, content: Vec<u8>) -> common_exception::Result<()>;
1616
```
17-

common/dal/src/impls/aws_s3/mod.rs

-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
//
15-
16-
#[cfg(test)]
17-
mod s3_input_stream_test;
1814

1915
mod metrics;
2016
mod s3;

common/dal/src/impls/azure_blob/mod.rs

-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
//
15-
16-
#[cfg(test)]
17-
mod azure_blob_accessor_test;
1814

1915
mod azure_blob_accessor;
2016
mod azure_blob_input_stream;

common/dal/src/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,3 @@ mod data_accessor;
3131
mod impls;
3232
mod in_memory_data;
3333
mod schemes;
34-
35-
#[cfg(test)]
36-
mod schemes_test;

common/dal/src/impls/aws_s3/s3_input_stream_test.rs renamed to common/dal/tests/it/impls/aws_s3.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
//
1514

1615
use std::io::SeekFrom;
1716

1817
use common_base::tokio;
18+
use common_dal::DataAccessor;
19+
use common_dal::S3;
1920
use common_exception::ErrorCode;
2021
use futures::AsyncReadExt;
2122
use futures::AsyncSeekExt;
@@ -25,9 +26,6 @@ use rusoto_s3::PutObjectRequest;
2526
use rusoto_s3::S3Client;
2627
use rusoto_s3::S3 as RusotoS3;
2728

28-
use crate::DataAccessor;
29-
use crate::S3;
30-
3129
struct TestFixture {
3230
region_name: String,
3331
endpoint_url: String,

common/dal/src/impls/azure_blob/azure_blob_accessor_test.rs renamed to common/dal/tests/it/impls/azure_blob.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,17 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
//
1514

1615
use std::io::SeekFrom;
1716
use std::str;
1817

1918
use common_base::tokio;
19+
use common_dal::AzureBlobAccessor;
20+
use common_dal::DataAccessor;
2021
use common_exception::Result;
2122
use futures::AsyncReadExt;
2223
use futures::AsyncSeekExt;
2324

24-
use crate::AzureBlobAccessor;
25-
use crate::DataAccessor;
26-
2725
fn generate_test_data() -> String {
2826
let mut s = "0123456789".to_string();
2927
s.push_str("abcdefghijklmnopqrstuvwxyz");

common/dal/tests/it/impls/mod.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2021 Datafuse Labs.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
mod aws_s3;
16+
mod azure_blob;

common/dal/tests/it/main.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2021 Datafuse Labs.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
mod impls;
16+
mod schemes;

common/dal/src/schemes_test.rs renamed to common/dal/tests/it/schemes.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,15 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
//
1514

1615
use std::str::FromStr;
1716

17+
use common_dal::StorageScheme;
18+
use common_dal::StorageScheme::AzureStorageBlob;
19+
use common_dal::StorageScheme::LocalFs;
20+
use common_dal::StorageScheme::S3;
1821
use common_exception::ErrorCode;
1922

20-
use crate::schemes::StorageScheme::AzureStorageBlob;
21-
use crate::schemes::StorageScheme::LocalFs;
22-
use crate::schemes::StorageScheme::S3;
23-
use crate::StorageScheme;
24-
2523
#[test]
2624
fn test_scheme_from_str() {
2725
let valid_schemes = vec![

0 commit comments

Comments
 (0)