From 04dc59f679e226b84bc3e268fd7d8b78d810337c Mon Sep 17 00:00:00 2001 From: Yashodhan <54112038+YJDoc2@users.noreply.github.com> Date: Mon, 9 Oct 2023 15:13:52 +0530 Subject: [PATCH] Add initial tests for rootless podman (#2406) --- .github/workflows/e2e.yaml | 23 +++++++++++++++++++++++ justfile | 5 +++++ tests/rootless-tests/run.sh | 18 ++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100755 tests/rootless-tests/run.sh diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index c2f29caf..9aa9a050 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -127,3 +127,26 @@ jobs: run: just runtimetest rust-oci-tests-bin - name: Validate tests on youki run: just rust-oci-tests + + rootless-podman-test: + runs-on: ubuntu-22.04 + needs: [youki-build] + timeout-minutes: 15 + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + - name: Setup Rust toolchain and cache + uses: actions-rust-lang/setup-rust-toolchain@v1 + - name: Install just + uses: taiki-e/install-action@just + - name: Install requirements + run: sudo env PATH=$PATH just ci-prepare + - name: Download youki binary + uses: actions/download-artifact@v3 + with: + name: youki + - name: Add the permission to run + run: chmod +x ./youki + - name: Run tests + run: just test-rootless-podman diff --git a/justfile b/justfile index 3aa8b726..395daf3b 100644 --- a/justfile +++ b/justfile @@ -65,6 +65,11 @@ rust-oci-tests: youki-release runtimetest rust-oci-tests-bin validate-rust-oci-runc: runtimetest rust-oci-tests-bin {{ cwd }}/scripts/rust_integration_tests.sh runc +# test podman rootless works with youki +test-rootless-podman: + {{ cwd }}/tests/rootless-tests/run.sh {{ cwd }}/youki + + # run containerd integration tests containerd-test: youki-dev VAGRANT_VAGRANTFILE=Vagrantfile.containerd2youki vagrant up diff --git a/tests/rootless-tests/run.sh b/tests/rootless-tests/run.sh new file mode 100755 index 00000000..02095915 --- /dev/null +++ b/tests/rootless-tests/run.sh @@ -0,0 +1,18 @@ +# This is a temporary test-collection for validating youki runs correctly with podman in rootless mode +# This will be moved to a proper rust based test crate, similar to rust-integration tests soon + +set -ex + +runtime=$1 + +podman rm --force --ignore create-test # remove if existing + +podman create --runtime $runtime --name create-test hello-world +log=$(podman start -a create-test) +echo $log | grep "This message shows that your installation appears to be working correctly" +podman rm create-test + +rand=$(head -c 10 /dev/random | base64) + +log=$(podman run --runtime $runtime fedora echo "$rand") +echo $log | grep $rand \ No newline at end of file