Skip to content

test: add integration test with minio #112

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

Closed
13 changes: 13 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,19 @@ jobs:
name: cov-report-rust-tests-${{ runner.os }}
path: ./cov-reports
if-no-files-found: 'error'

rust-integration-tests:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-22.04 ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Spin up minio for s3 tests
run: docker compose -f docker/docker-compose.yaml --profile s3 up -d
- name: Run Rust integration tests
run: docker compose -f docker/docker-compose.yaml run integration_test_rust

python-tests:
strategy:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# under the License.

/Cargo.lock
**/Cargo.lock
/target
**/target

Expand Down
7 changes: 7 additions & 0 deletions crates/tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@
path_buf.to_str().unwrap().to_string()
}

pub fn s3_path(&self) -> String {
let bucket = std::env::var("INTEGRATION_TEST_S3_BUCKET")

Check warning on line 65 in crates/tests/src/lib.rs

View check run for this annotation

Codecov / codecov/patch

crates/tests/src/lib.rs#L64-L65

Added lines #L64 - L65 were not covered by tests
.expect("INTEGRATION_TEST_S3_BUCKET not set");
let data_path = Path::new(format!("s3://{}", bucket).as_str()).join(self.as_ref());
data_path.to_str().unwrap().to_string()

Check warning on line 68 in crates/tests/src/lib.rs

View check run for this annotation

Codecov / codecov/patch

crates/tests/src/lib.rs#L67-L68

Added lines #L67 - L68 were not covered by tests
}

pub fn url(&self) -> Url {
let path = self.path();
Url::from_file_path(path).unwrap()
Expand Down
23 changes: 23 additions & 0 deletions docker/Dockerfile.minio
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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.

FROM alpine:3.18
RUN apk update && apk add --no-cache wget ca-certificates bash findutils

RUN cd /usr/local/bin && \
wget -q --show-progress https://dl.min.io/client/mc/release/linux-amd64/mc && \
chmod +x mc
92 changes: 92 additions & 0 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# 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.

version: "3.8"

services:
minio:
image: quay.io/minio/minio
container_name: minio
profiles:
- s3
ports:
- "9000:9000"
networks:
- hudi_network
env_file:
- hudi.env
command: server /data
healthcheck:
test: mc ready local
interval: 5s
timeout: 10s
retries: 5
start_period: 2s


mc:
build:
context: ./
dockerfile: ./Dockerfile.minio
container_name: mc
networks:
- hudi_network
profiles:
- s3
depends_on:
minio:
condition: service_healthy
env_file:
- hudi.env
volumes:
- ../crates/tests/data/tables:/opt/data:ro
entrypoint: >
/bin/bash -c '
set -eux
mc config host add store http://minio:9000 $$MINIO_ACCESS_KEY $$MINIO_SECRET_KEY
mc mb store/$$MINIO_TEST_BUCKET
find /opt/data -name "*.zip" -exec unzip {} -d /tmp/data/ \;
find /tmp/data -type d -mindepth 1 -maxdepth 1 -exec mc cp --recursive {} store/$$MINIO_TEST_BUCKET \;
mc ls store/$$MINIO_TEST_BUCKET
'

integration_test_rust:
image: rust:1.75
container_name: integration_test_rust
networks:
- hudi_network
profiles:
- integration_test
env_file:
- hudi.env
volumes:
- ../crates:/app/crates:ro
- ../python:/app/python:ro
- ../integration_test:/app/integration_test
- ../Cargo.toml:/app/Cargo.toml:ro
entrypoint: >
/bin/sh -c "
set -eux
apt update && apt install -y --no-install-recommends libpython3.11-dev
cd /app/integration_test
cargo test
"


networks:
hudi_network:
driver: bridge
29 changes: 29 additions & 0 deletions docker/hudi.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# 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.

# setup minio
MINIO_ROOT_USER=minio
MINIO_ROOT_PASSWORD=minio123
MINIO_ACCESS_KEY=minio
MINIO_SECRET_KEY=minio123
MINIO_TEST_BUCKET=test-bucket

# s3 integration test
AWS_ACCESS_KEY_ID=minio
AWS_SECRET_ACCESS_KEY=minio123
AWS_ENDPOINT=http://minio:9000
INTEGRATION_TEST_S3_BUCKET=test-bucket
35 changes: 35 additions & 0 deletions integration_test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 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.

[workspace]
members = []

[package]
version = "0.1.0"
name = "integration_test"
edition = "2021"
license = "Apache-2.0"
rust-version = "1.75.0"
description = "Integration tests for hudi-rs"


[dependencies]
hudi = { features=["datafusion"], path="../crates/hudi" }
hudi-tests = { path="../crates/tests" }
datafusion = { version = "= 39.0.0" }
datafusion-expr = { version = "= 39.0.0" }
tokio = { version = "1", features = ["rt-multi-thread"] }
22 changes: 22 additions & 0 deletions integration_test/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* 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.
*/

fn main() {
println!("hudi-rs integration tests")
}
Loading
Loading