-
Notifications
You must be signed in to change notification settings - Fork 517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(integrations/cloudfilter): introduce behavior tests #4973
Changes from 12 commits
f215b4a
2b68b95
a30e811
0105ebd
dd3c866
a2adf38
35b7027
404f230
2454c3c
526223b
072a70a
646bc16
d990bc0
1bfc84f
0d248c6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we can also remove those changes. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -145,3 +145,17 @@ jobs: | |
with: | ||
os: ${{ matrix.os }} | ||
cases: ${{ toJson(matrix.cases) }} | ||
|
||
test_integration_cloudfilter: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't need this anymore? |
||
name: integration_cloudfilter / ${{ matrix.os }} | ||
needs: [ plan ] | ||
if: fromJson(needs.plan.outputs.plan).components.integration_cloudfilter | ||
secrets: inherit | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: ${{ fromJson(needs.plan.outputs.plan).integration_cloudfilter }} | ||
uses: ./.github/workflows/test_behavior_integration_cloudfilter.yml | ||
with: | ||
os: ${{ matrix.os }} | ||
cases: ${{ toJson(matrix.cases) }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
name: Behavior Test Integration CloudFilter | ||
|
||
on: | ||
workflow_call: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can use on |
||
inputs: | ||
os: | ||
required: true | ||
type: string | ||
cases: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
test: | ||
name: ${{ matrix.cases.service }} / ${{ matrix.cases.setup }} | ||
runs-on: ${{ inputs.os }} | ||
timeout-minutes: 10 | ||
|
||
strategy: | ||
matrix: | ||
cases: ${{ fromJson(inputs.cases) }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Rust toolchain | ||
uses: ./.github/actions/setup | ||
with: | ||
need-protoc: true | ||
need-rocksdb: true | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't need this. |
||
|
||
# TODO: 1password is only supported on linux | ||
# | ||
# Waiting for https://github.com/1Password/load-secrets-action/issues/46 | ||
- name: Setup 1Password Connect | ||
if: runner.os == 'Linux' | ||
uses: 1password/load-secrets-action/configure@v1 | ||
with: | ||
connect-host: ${{ secrets.OP_CONNECT_HOST }} | ||
connect-token: ${{ secrets.OP_CONNECT_TOKEN }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't need this. |
||
|
||
- name: Test Integration CloudFilter | ||
working-directory: integrations/cloudfilter | ||
run: cargo test --test behavior | ||
env: | ||
OPENDAL_TEST: fs | ||
OPENDAL_FS_ROOT: ../../fixtures/data | ||
OPENDAL_DISABLE_RANDOM_ROOT: 'true' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Behavior tests for OpenDAL™ Cloud Filter Integration | ||
|
||
Behavior tests are used to make sure every service works correctly. | ||
|
||
`cloudfilter_opendal` is readonly currently, so we assume `fixtures/data` is the root of the test data. | ||
|
||
## Run | ||
|
||
```pwsh | ||
cd .\integrations\cloudfilter | ||
$env:OPENDAL_TEST='fs'; $env:OPENDAL_FS_ROOT='../../fixtures/data'; $env:OPENDAL_DISABLE_RANDOM_ROOT='true'; cargo test --test behavior | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
use libtest_mimic::Failed; | ||
|
||
use crate::{ | ||
utils::{file_content, file_length}, | ||
ROOT_PATH, | ||
}; | ||
|
||
pub fn test_fetch_data() -> Result<(), Failed> { | ||
let files = [ | ||
( | ||
"normal_file.txt", | ||
include_str!("..\\..\\..\\..\\fixtures/data/normal_file.txt"), | ||
), | ||
( | ||
"special_file !@#$%^&()_+-=;',.txt", | ||
include_str!("..\\..\\..\\..\\fixtures/data/special_file !@#$%^&()_+-=;',.txt"), | ||
), | ||
]; | ||
for (file, expected_content) in files { | ||
let path = format!("{ROOT_PATH}\\{file}"); | ||
assert_eq!( | ||
expected_content.len(), | ||
file_length(&path).expect("file length"), | ||
"file length", | ||
); | ||
|
||
assert_eq!( | ||
expected_content, | ||
file_content(&path).expect("file hash"), | ||
"file hash", | ||
) | ||
} | ||
Ok(()) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
use libtest_mimic::Failed; | ||
|
||
use crate::{utils::list, ROOT_PATH}; | ||
|
||
pub fn test_fetch_placeholder() -> Result<(), Failed> { | ||
let files = ["normal_file.txt", "special_file !@#$%^&()_+-=;',.txt"]; | ||
let dirs = ["normal_dir", "special_dir !@#$%^&()_+-=;',"]; | ||
|
||
assert_eq!( | ||
list(ROOT_PATH, "File").expect("list files"), | ||
files, | ||
"list files" | ||
); | ||
assert_eq!( | ||
list(ROOT_PATH, "Directory").expect("list dirs"), | ||
dirs, | ||
"list dirs" | ||
); | ||
|
||
Ok(()) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same.