Skip to content

Commit

Permalink
Merge pull request #612 from fabriziosestito/test/improve-e2e-testing-2
Browse files Browse the repository at this point in the history
test: improve e2e testing using rust
  • Loading branch information
flavio authored Oct 6, 2023
2 parents 8900e7b + 547cd91 commit 411ad41
Show file tree
Hide file tree
Showing 31 changed files with 936 additions and 438 deletions.
18 changes: 7 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,16 @@ jobs:
- uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
with:
command: test
args: --workspace
args: --workspace --bins

e2e-tests:
name: E2E tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- name: Setup BATS
uses: mig4/setup-bats@af9a00deb21b5d795cabfeaa8d9060410377686d # v1.2.0
with:
bats-version: 1.5.0
- uses: sigstore/cosign-installer@11086d25041f77fe8fe7b9ea4e48e3b9192b8f19 # v3.1.2
- name: run e2e tests
run: make e2e-test
run: make e2e-tests

fmt:
name: Rustfmt
Expand Down Expand Up @@ -124,7 +120,7 @@ jobs:
- name: Install kwctl
run: cargo install --path .
- name: Save policies
run: ./scripts/kubewarden-save-policies.sh --policies-list e2e-tests/airgap/policies.txt --policies policies.tar.gz
run: ./scripts/kubewarden-save-policies.sh --policies-list tests/data/airgap/policies.txt --policies policies.tar.gz
- name: Remove policies from store
run: |
kwctl rm registry://ghcr.io/kubewarden/tests/pod-privileged:v0.1.9
Expand All @@ -133,15 +129,15 @@ jobs:
run: |
./scripts/kubewarden-load-policies.sh \
--policies policies.tar.gz \
--policies-list e2e-tests/airgap/policies.txt \
--policies-list tests/data/airgap/policies.txt \
--registry localhost:5000 \
--sources-path e2e-tests/airgap/insecure.yml
--sources-path tests/data/airgap/insecure.yml
- name: Verify policies in local registry
run: |
kwctl pull registry://localhost:5000/kubewarden/tests/pod-privileged:v0.1.9 \
--sources-path e2e-tests/airgap/insecure.yml
--sources-path tests/data/airgap/insecure.yml
kwctl pull registry://localhost:5000/kubewarden/pod-privileged-policy/releases/download/v0.1.6/policy.wasm \
--sources-path e2e-tests/airgap/insecure.yml
--sources-path tests/data/airgap/insecure.yml
- name: Clean up - delete registry
if: always()
run: |
Expand Down
175 changes: 173 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,6 @@ reqwest = { version = "0", default-features = false, features = [
[dev-dependencies]
rstest = "0.18.2"
tempfile = "3.8.0"
assert_cmd = "2.0.12"
predicates = "3.0.3"
testcontainers = "0.14"
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ lint:

.PHONY: test
test: fmt lint
cargo test --workspace
cargo test --workspace --bins

.PHONY: e2e-test
e2e-test:
sh -c 'cd e2e-tests; bats --print-output-on-failure .'
.PHONY: e2e-tests
e2e-tests:
cargo test --test '*'

.PHONY: clean
clean:
Expand Down
2 changes: 0 additions & 2 deletions e2e-tests/airgap/insecure.yml

This file was deleted.

Loading

0 comments on commit 411ad41

Please sign in to comment.