forked from VirtusLab/jenkins-operator
-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: make ginkgo tests as matrix (#979)
- make ginkgo tests as matrix for easily re-run failing tests or checking logs - fix pod restart check
- Loading branch information
1 parent
ec20bbe
commit be73752
Showing
12 changed files
with
174 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Run e2e tests | ||
name: Tests E2E | ||
on: | ||
push: | ||
branches: | ||
|
@@ -20,20 +20,29 @@ on: | |
- '*.md' | ||
|
||
jobs: | ||
run-tests: | ||
if: github.event.pull_request.draft == false | ||
name: Run automated tests | ||
create-e2e-list: | ||
name: E2E Create tests list | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: ${{ steps.matrix.outputs.matrix }} | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
- uses: actions/checkout@v4 | ||
- id: matrix | ||
run: | | ||
script=$(./test/make_matrix_ginkgo.sh e2e) | ||
echo "matrix=${script}" >> $GITHUB_OUTPUT | ||
verify-code: | ||
name: E2E Verify code before tests | ||
runs-on: ubuntu-latest | ||
needs: [create-e2e-list] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up env vars | ||
run: | | ||
echo "GO111MODULE=on" >> $GITHUB_ENV | ||
echo "GO_VERSION=v$(sed -n 's/GO_VERSION=//p' config.base.env | tr -d '\n' | tr -d '"')" >> $GITHUB_ENV | ||
echo "HELM_VERSION=v$(sed -n 's/HELM_VERSION=//p' config.base.env | tr -d '\n' | tr -d '"')" >> $GITHUB_ENV | ||
echo "KIND_CLUSTER_NAME=$(sed -n 's/KIND_CLUSTER_NAME=//p' config.base.env | tr -d '\n' | tr -d '"')" >> $GITHUB_ENV | ||
echo "GOPATH=/home/runner/go" >> $GITHUB_ENV | ||
- name: Prepare go environment | ||
|
@@ -47,6 +56,33 @@ jobs: | |
- name: Verify code formatting | ||
run: make verify | ||
|
||
run-e2e-tests: | ||
runs-on: ubuntu-latest | ||
needs: [create-e2e-list, verify-code] | ||
if: github.event.pull_request.draft == false | ||
name: E2E ${{ matrix.test }} | ||
strategy: | ||
fail-fast: false | ||
matrix: ${{ fromJSON(needs.create-e2e-list.outputs.matrix) }} | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up env vars | ||
run: | | ||
echo "GO111MODULE=on" >> $GITHUB_ENV | ||
echo "GO_VERSION=v$(sed -n 's/GO_VERSION=//p' config.base.env | tr -d '\n' | tr -d '"')" >> $GITHUB_ENV | ||
echo "KIND_CLUSTER_NAME=$(sed -n 's/KIND_CLUSTER_NAME=//p' config.base.env | tr -d '\n' | tr -d '"')" >> $GITHUB_ENV | ||
echo "GOPATH=/home/runner/go" >> $GITHUB_ENV | ||
- name: Prepare go environment | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Ensure Golang runtime dependencies | ||
run: make go-dependencies | ||
|
||
- name: Kind setup | ||
uses: helm/[email protected] | ||
with: | ||
|
@@ -55,16 +91,19 @@ jobs: | |
|
||
- name: Prepare environment for e2e | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install socat | ||
sudo apt-get update && sudo apt-get install -y socat | ||
sudo mkdir -p $HOME/.kube | ||
sudo chown -R $USER $HOME/.kube | ||
- name: Jenkins Operator - e2e - list tests | ||
run: make e2e E2E_TEST_ARGS='-ginkgo.v -ginkgo.dryRun' | ||
|
||
- name: Jenkins Operator - e2e | ||
run: make e2e E2E_TEST_ARGS='-ginkgo.v' | ||
- name: Jenkins Operator - e2e Chart tests | ||
env: | ||
TNAME: ${{ matrix.test }} | ||
TFILE: ${{ matrix.file }} | ||
TLINE: ${{ matrix.line }} | ||
run: | | ||
git reset --hard | ||
printf "\n \n > Running test: %s from file: $s line: %s\n" "${TNAME}" "${TFILE}" "${TLINE}" | ||
make e2e E2E_TEST_ARGS='-ginkgo.v -ginkgo.focus="${TNAME}"' | ||
- name: Debug | ||
if: failure() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Run Helm e2e tests | ||
name: Tests HELM | ||
on: | ||
push: | ||
branches: | ||
|
@@ -20,10 +20,50 @@ on: | |
- '*.md' | ||
|
||
jobs: | ||
run-tests: | ||
if: github.event.pull_request.draft == false | ||
name: Run automated tests | ||
create-helm-list: | ||
name: HELM Create tests list | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: ${{ steps.matrix.outputs.matrix }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- id: matrix | ||
run: | | ||
script=$(./test/make_matrix_ginkgo.sh helm) | ||
echo "matrix=${script}" >> $GITHUB_OUTPUT | ||
verify-code: | ||
name: HELM Verify code before tests | ||
runs-on: ubuntu-latest | ||
needs: [create-helm-list] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up env vars | ||
run: | | ||
echo "GO111MODULE=on" >> $GITHUB_ENV | ||
echo "GO_VERSION=v$(sed -n 's/GO_VERSION=//p' config.base.env | tr -d '\n' | tr -d '"')" >> $GITHUB_ENV | ||
echo "GOPATH=/home/runner/go" >> $GITHUB_ENV | ||
- name: Prepare go environment | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Ensure Golang runtime dependencies | ||
run: make go-dependencies | ||
|
||
- name: Verify code formatting | ||
run: make verify | ||
|
||
run-helm-tests: | ||
runs-on: ubuntu-latest | ||
needs: [create-helm-list, verify-code] | ||
if: github.event.pull_request.draft == false | ||
name: HELM ${{ matrix.test }} | ||
strategy: | ||
fail-fast: false | ||
matrix: ${{ fromJSON(needs.create-helm-list.outputs.matrix) }} | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
@@ -44,9 +84,6 @@ jobs: | |
- name: Ensure Golang runtime dependencies | ||
run: make go-dependencies | ||
|
||
- name: Verify code formatting | ||
run: make verify | ||
|
||
- name: Kind setup | ||
uses: helm/[email protected] | ||
with: | ||
|
@@ -55,13 +92,26 @@ jobs: | |
|
||
- name: Prepare environment for e2e | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install socat | ||
sudo apt-get update && sudo apt-get install -y socat | ||
sudo mkdir -p $HOME/.kube | ||
sudo chown -R $USER $HOME/.kube | ||
- name: Jenkins Operator - Helm Chart tests | ||
env: | ||
TNAME: ${{ matrix.test }} | ||
TFILE: ${{ matrix.file }} | ||
TLINE: ${{ matrix.line }} | ||
run: | | ||
git reset --hard | ||
make helm-lint | ||
make helm-e2e E2E_TEST_ARGS='-ginkgo.v' | ||
printf "\n \n > Running test: %s from file: $s line: %s\n" "${TNAME}" "${TFILE}" "${TLINE}" | ||
make helm-e2e E2E_TEST_ARGS='-ginkgo.v -ginkgo.focus="${TNAME}"' | ||
- name: Debug | ||
if: failure() | ||
shell: bash | ||
continue-on-error: true | ||
run: | | ||
randomns=$(kubectl get ns| grep -i 'ns[0-9]\+' |cut -d ' ' -f 1) | ||
kubectl get pods -n ${randomns} | ||
kubectl get events -n ${randomns} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.