Skip to content

Commit

Permalink
[tests] make each iteration longer in the sleep tests.
Browse files Browse the repository at this point in the history
It is slow on github actions due to many tests running in parallel.
  • Loading branch information
shizunge committed Dec 6, 2024
1 parent 2b03c2a commit d3e5555
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 2 deletions.
23 changes: 22 additions & 1 deletion .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
shellcheck src/*.sh tests/*.sh
set +e
# Use a matrix to make it easier to find which test fails.
test_scripts:
name: Test scripts
runs-on: ubuntu-latest
Expand Down Expand Up @@ -66,6 +67,26 @@ jobs:
run: |
bash shellspec --pattern tests/${{ matrix.test_suit }}
test_scripts_parallel:
name: Test scripts running in parallel
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Install shellspec
run: |
mkdir -p ~/shellspec
cd ~/shellspec
git clone https://github.com/shellspec/shellspec.git
ln -s ~/shellspec/shellspec/shellspec /usr/local/bin/shellspec
echo -n "shellspec version: "
shellspec --version
- name: Checkout Code
uses: actions/checkout@v4
- name: Run container tests
run: |
bash shellspec --jobs 50
test_container:
name: Test container
runs-on: ubuntu-latest
Expand All @@ -88,4 +109,4 @@ jobs:
export GANTRY_TEST_CONTAINER_REPO_TAG=
echo "GANTRY_TEST_CONTAINER=${GANTRY_TEST_CONTAINER}"
echo "GANTRY_TEST_CONTAINER_REPO_TAG=${GANTRY_TEST_CONTAINER_REPO_TAG}"
bash shellspec --jobs 50
bash shellspec --jobs 50
22 changes: 22 additions & 0 deletions .github/workflows/on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
shellcheck src/*.sh tests/*.sh
set +e
# Use a matrix to make it easier to find which test fails.
test_scripts:
name: Test scripts
runs-on: ubuntu-latest
Expand Down Expand Up @@ -69,6 +70,26 @@ jobs:
run: |
bash shellspec --pattern tests/${{ matrix.test_suit }}
test_scripts_parallel:
name: Test scripts running in parallel
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Install shellspec
run: |
mkdir -p ~/shellspec
cd ~/shellspec
git clone https://github.com/shellspec/shellspec.git
ln -s ~/shellspec/shellspec/shellspec /usr/local/bin/shellspec
echo -n "shellspec version: "
shellspec --version
- name: Checkout Code
uses: actions/checkout@v4
- name: Run container tests
run: |
bash shellspec --jobs 50
test_container:
name: Test container
runs-on: ubuntu-latest
Expand Down Expand Up @@ -100,6 +121,7 @@ jobs:
needs:
- shellcheck
- test_scripts
- test_scripts_parallel
- test_container
steps:
- name: Checkout Code
Expand Down
5 changes: 4 additions & 1 deletion tests/gantry_common_options_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,10 @@ Describe 'common-options'
local TEST_NAME="${1}"
local SERVICE_NAME="${2}"
reset_gantry_env "${SUITE_NAME}" "${SERVICE_NAME}"
export GANTRY_SLEEP_SECONDS="7"
# Assume that the inspect will be done within the following time.
# Based on the tests on github action, it could take 8 seconds to just finish the filter services.
# Then it could takes another 7 seconds to finish inspection due the many tests are running in parallel.
export GANTRY_SLEEP_SECONDS="15"
# Run run_gantry in background.
run_gantry "${SUITE_NAME}" "${TEST_NAME}" &
local PID="${!}"
Expand Down

0 comments on commit d3e5555

Please sign in to comment.