From 1e3efb57cc64e3a05456d171f10d454b25ce1119 Mon Sep 17 00:00:00 2001 From: Dimitris Karakasilis Date: Wed, 15 Feb 2023 09:18:52 +0200 Subject: [PATCH] Split scenarios in different GA jobs to parallelise better and allow re-running just the failed tests Signed-off-by: Dimitris Karakasilis --- .github/workflows/e2e-tests.yml | 11 ++++++++++- Earthfile | 1 + scripts/e2e-tests.sh | 2 +- tests/encryption_test.go | 12 ++++++------ 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index d578915..fcccdc9 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -12,6 +12,15 @@ on: jobs: e2e-tests: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - label: "local-encryption" + - label: "remote-auto" + - label: "remote-static" + - label: "remote-https-pinned" + - label: "remote-https-bad-cert" steps: - name: Checkout code uses: actions/checkout@v3 @@ -19,4 +28,4 @@ jobs: fetch-depth: 0 - name: Run tests run: | - ./earthly.sh +e2e-tests + ./earthly.sh +e2e-tests --LABEL=${{ matrix.label }} diff --git a/Earthfile b/Earthfile index 4933fbc..e58ad9c 100644 --- a/Earthfile +++ b/Earthfile @@ -99,6 +99,7 @@ e2e-tests-image: e2e-tests: FROM +e2e-tests-image + ARG LABEL WITH DOCKER --allow-privileged RUN ./scripts/e2e-tests.sh diff --git a/scripts/e2e-tests.sh b/scripts/e2e-tests.sh index c0b8802..d8e4eea 100755 --- a/scripts/e2e-tests.sh +++ b/scripts/e2e-tests.sh @@ -55,4 +55,4 @@ kubectl apply -k "$SCRIPT_DIR/../tests/assets/" # https://stackoverflow.com/a/6752280 export KMS_ADDRESS="10.0.2.2.challenger.sslip.io" -PATH=$PATH:$GOPATH/bin ginkgo -v --nodes $GINKGO_NODES --fail-fast -r ./tests/ +PATH=$PATH:$GOPATH/bin ginkgo -v --nodes $GINKGO_NODES --label-filter $LABEL --fail-fast -r ./tests/ diff --git a/tests/encryption_test.go b/tests/encryption_test.go index 9ae23b5..832fcf0 100644 --- a/tests/encryption_test.go +++ b/tests/encryption_test.go @@ -20,7 +20,7 @@ import ( var installationOutput string var vm VM -var _ = Describe("local encrypted passphrase", func() { +var _ = Describe("kcrypt encryption", func() { var config string BeforeEach(func() { @@ -63,7 +63,7 @@ var _ = Describe("local encrypted passphrase", func() { }) // https://kairos.io/docs/advanced/partition_encryption/#offline-mode - When("doing local encryption", func() { + When("doing local encryption", Label("local-encryption"), func() { BeforeEach(func() { config = `#cloud-config @@ -89,7 +89,7 @@ users: }) //https://kairos.io/docs/advanced/partition_encryption/#online-mode - When("using a remote key management server (automated passphrase generation)", func() { + When("using a remote key management server (automated passphrase generation)", Label("remote-auto"), func() { var tpmHash string var err error @@ -160,7 +160,7 @@ kcrypt: }) // https://kairos.io/docs/advanced/partition_encryption/#scenario-static-keys - When("using a remote key management server (static keys)", func() { + When("using a remote key management server (static keys)", Label("remote-static"), func() { var tpmHash string var err error @@ -262,7 +262,7 @@ spec: `, strings.TrimSpace(tpmHash))) }) - When("the certificate is pinned on the configuration", func() { + When("the certificate is pinned on the configuration", Label("remote-https-pinned"), func() { BeforeEach(func() { cert := getChallengerServerCert() kcryptConfig := createConfigWithCert(fmt.Sprintf("https://%s", os.Getenv("KMS_ADDRESS")), cert) @@ -297,7 +297,7 @@ install: }) }) - When("the no certificate is set in the configuration", func() { + When("the no certificate is set in the configuration", Label("remote-https-bad-cert"), func() { BeforeEach(func() { config = fmt.Sprintf(`#cloud-config