You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replacing the readiness loop with a fixed 2s sleep may cause flaky test failures if the container takes longer to be ready; consider a minimal readiness check or longer backoff.
- name: Test the built container image with api functionality test.run: | docker run -d -p8080:8080 --name=test --platform linux/${{ matrix.arch }} --network ${{ job.container.network }} --rm test-${{ matrix.distro }}-${{ matrix.arch }} sleep 2 ./ci/tests/api-functionality/api_test.sh sleep 2 docker stop test || true
The second step uses a quoted multiline string for 'run', which is harder to maintain and can escape characters unexpectedly; prefer YAML block style with '|'.
- name: Test the built container image with api functionality test.run: "docker run -d -p8080:8080 --name=test --platform linux/${{ matrix.arch }} --network ${{ job.container.network }} --rm test-${{ matrix.distro }}-${{ matrix.arch }}\nsleep 2\n./ci/tests/api-functionality/api_test.sh\nsleep 2\ndocker stop test || true \n"release-tests:
Add a readiness loop to wait for the service to be reachable before running tests. A fixed 2s sleep is flaky and will cause intermittent failures across environments.
- name: Test the built container image with api functionality test.
run: |
docker run -d -p8080:8080 --name=test --platform linux/${{ matrix.arch }} --network ${{ job.container.network }} --rm test-${{ matrix.distro }}-${{ matrix.arch }}
- sleep 2+ for i in {1..20}; do+ if curl -sf http://localhost:8080/hello > /dev/null; then+ break+ fi+ sleep 2+ if [ $i -eq 20 ]; then+ echo "Service did not become ready in time"+ docker logs test || true+ exit 1+ fi+ done
./ci/tests/api-functionality/api_test.sh
sleep 2
docker stop test || true
Suggestion importance[1-10]: 8
__
Why: Reintroducing a readiness loop addresses a real flakiness risk introduced by replacing a robust wait with a fixed 2s sleep; the improved_code correctly modifies the shown new hunk snippet to wait for the service before testing.
Medium
General
Add cleanup trap on exit
Ensure the container is always stopped even if the test fails by using a trap. This prevents leaked containers and port conflicts in subsequent steps.
- name: Test the built container image with api functionality test.
run: |
+ set -euo pipefail
docker run -d -p8080:8080 --name=test --platform linux/${{ matrix.arch }} --network ${{ job.container.network }} --rm test-${{ matrix.distro }}-${{ matrix.arch }}
+ trap 'docker stop test || true' EXIT
sleep 2
./ci/tests/api-functionality/api_test.sh
- sleep 2- docker stop test || true
Suggestion importance[1-10]: 7
__
Why: Adding a shell trap ensures the container is stopped even on failures, improving reliability and cleanup; the proposed code aligns with the new hunk and enhances robustness without altering logic.
Medium
Use proper multiline run block
Use a multiline block for the shell script instead of a quoted single-line with embedded newlines. This avoids YAML escaping pitfalls and preserves shell semantics reliably.
- name: Test the built container image with api functionality test.
- run: "docker run -d -p8080:8080 --name=test --platform linux/${{ matrix.arch }} --network ${{ job.container.network }} --rm test-${{ matrix.distro }}-${{ matrix.arch }}\nsleep 2\n./ci/tests/api-functionality/api_test.sh\nsleep 2\ndocker stop test || true \n"+ run: |+ docker run -d -p8080:8080 --name=test --platform linux/${{ matrix.arch }} --network ${{ job.container.network }} --rm test-${{ matrix.distro }}-${{ matrix.arch }}+ sleep 2+ ./ci/tests/api-functionality/api_test.sh+ sleep 2+ docker stop test || true
Suggestion importance[1-10]: 6
__
Why: Converting the quoted newline-embedded run to a YAML block scalar improves readability and reduces YAML parsing pitfalls; the improved_code accurately reflects the intended formatting change for the corresponding new hunk.
Low
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Type
Enhancement
Description
Simplify container test step commands
Remove verbose health checks and logs
Slight rename of test step titles
Diagram Walkthrough
File Walkthrough
release.yml
Streamline container image test steps.github/workflows/release.yml