Skip to content

Commit

Permalink
Fail when no tests are run
Browse files Browse the repository at this point in the history
  • Loading branch information
josvazg committed Sep 6, 2024
1 parent 6107b3e commit bbe0dfb
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/test-e2e-gov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ jobs:
cd test/e2e &&
ginkgo labels &&
echo "Running: AKO_E2E_TEST=1 ginkgo --label-filter=\"atlas-gov\" --timeout 120m --nodes=10 --flake-attempts=1 --randomize-all --race --cover --v --trace --show-nodes-events --output-interceptor-mode=none" &&
AKO_E2E_TEST=1 ginkgo --label-filter="atlas-gov" --timeout 120m --nodes=10 --flake-attempts=1 --randomize-all --race --cover --v --trace --show-node-events --output-interceptor-mode=none --coverpkg=github.com/mongodb/mongodb-atlas-kubernetes/v2/pkg/...'
AKO_E2E_TEST=1 ginkgo --label-filter="atlas-gov" --timeout 120m --nodes=10 --flake-attempts=1 --randomize-all --race --cover --v --trace --show-node-events --output-interceptor-mode=none --coverpkg=github.com/mongodb/mongodb-atlas-kubernetes/v2/pkg/...' | tee .e2e.log
if cat .e2e.log | grep -q "0 Passed"; then
echo "No tests were run!"
exit 1
fi
- name: Upload operator logs
if: ${{ failure() }}
uses: actions/upload-artifact@v4
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,11 @@ jobs:
cd test/e2e &&
[[ $TEST_NAME == "long-run" ]] && filter="long-run && !broken" || filter="$TEST_NAME && !long-run && !broken" &&
echo "Running: AKO_E2E_TEST=1 ginkgo --label-filter=\"${filter}\" --timeout 120m --nodes=10 --race --cover --v" &&
AKO_E2E_TEST=1 ginkgo --output-interceptor-mode=none --label-filter="${filter}" --timeout 120m --nodes=10 --flake-attempts=1 --race --cover --v --coverpkg=github.com/mongodb/mongodb-atlas-kubernetes/v2/pkg/...'
AKO_E2E_TEST=1 ginkgo --output-interceptor-mode=none --label-filter="${filter}" --timeout 120m --nodes=10 --flake-attempts=1 --race --cover --v --coverpkg=github.com/mongodb/mongodb-atlas-kubernetes/v2/pkg/...' | tee .e2e.log
if cat .e2e.log | grep -q "0 Passed"; then
echo "No tests were run!"
exit 1
fi
- name: Upload operator logs
if: ${{ failure() }}
uses: actions/upload-artifact@v4
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/test-int.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ jobs:
sudo mkdir -p /usr/local/kubebuilder/bin &&
sudo /bin/bash -c "source setup-envtest.sh && fetch_envtest_tools /usr/local/kubebuilder" &&
cd ${{ matrix.path }} &&
AKO_INT_TEST=1 ginkgo --label-filter="${TEST_NAME}" --timeout 90m --v --nodes="${PARALLEL_NODES}" --flake-attempts=1 --race --cover --coverpkg=github.com/mongodb/mongodb-atlas-kubernetes/v2/pkg/...'
AKO_INT_TEST=1 ginkgo --label-filter="${TEST_NAME}" --timeout 90m --v --nodes="${PARALLEL_NODES}" --flake-attempts=1 --race --cover --coverpkg=github.com/mongodb/mongodb-atlas-kubernetes/v2/pkg/...' | tee .int.log
if cat .int.log | grep -q "0 Passed"; then
echo "No tests were run!"
exit 1
fi
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
Expand Down
6 changes: 5 additions & 1 deletion scripts/e2e_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,8 @@ export MCLI_PUBLIC_API_KEY="${MCLI_PUBLIC_API_KEY:-$public_key}"
export MCLI_PRIVATE_API_KEY="${MCLI_PRIVATE_API_KEY:-$private_key}"
export MCLI_ORG_ID="${MCLI_ORG_ID:-$org_id}"
export IMAGE_URL="${image}" #for helm chart
AKO_E2E_TEST=1 ginkgo --race --label-filter="${focus_key}" --timeout 120m -vv test/e2e/
AKO_E2E_TEST=1 ginkgo --race --label-filter="${focus_key}" --timeout 120m -vv test/e2e/ | tee .e2e.log
if cat .e2e.log | grep -q "0 Passed"; then
echo "No tests were run!"
exit 1
fi
6 changes: 5 additions & 1 deletion scripts/int_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@ export MCLI_PUBLIC_API_KEY="${MCLI_PUBLIC_API_KEY:-$public_key}"
export MCLI_PRIVATE_API_KEY="${MCLI_PRIVATE_API_KEY:-$private_key}"
export MCLI_ORG_ID="${MCLI_ORG_ID:-$org_id}"

AKO_INT_TEST=1 ginkgo run --race --label-filter="${label}" --timeout 80m -v ./test/int ./test/int/clusterwide -coverprofile cover.out
AKO_INT_TEST=1 ginkgo run --race --label-filter="${label}" --timeout 80m -v ./test/int ./test/int/clusterwide -coverprofile cover.out | tee .int.log
if cat .int.log | grep -q "0 Passed"; then
echo "No tests were run!"
exit 1
fi

0 comments on commit bbe0dfb

Please sign in to comment.