-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bb63bef
commit 3201cc3
Showing
3 changed files
with
36 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,17 @@ jobs: | |
java-version: '8' | ||
cache: 'maven' | ||
|
||
- name: Launch Petstore | ||
if: ${{ matrix.scope == 'Petstore' }} | ||
working-directory: ./sut-petstore | ||
run: | | ||
mvn package -DskipTests=true -ntp | ||
docker build -t swagger-petstore . | ||
docker run -d -p 8081:8080 --name swagger-petstore swagger-petstore | ||
chmod u+x ../setup/wait-container-ready.sh | ||
../setup/wait-container-ready.sh swagger-petstore "public ResponseContext findPetsByCategoryAndStatus" | ||
- run: docker ps | ||
|
||
- name: Rules cache | ||
id: rules-cache | ||
uses: actions/[email protected] | ||
|
@@ -37,10 +48,13 @@ jobs: | |
key: cache-${{ matrix.scope }}-v1-${{ github.run_id }} | ||
restore-keys: cache-${{ matrix.scope }}-v1- | ||
|
||
- name: Test and aggregate surefire report | ||
- name: Test All | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: mvn test -pl st-tdg-test -Dtest=**/*Local* -Dmaven.test.failure.ignore=true -U --no-transfer-progress | ||
run: mvn test -pl st-tdg-test -Dtest=**/*${{ matrix.scope }}* -Dmaven.test.failure.ignore=true -U --no-transfer-progress | ||
|
||
- if: ${{ matrix.scope == 'Petstore' }} | ||
run: docker logs swagger-petstore > st-tdg-test/target/docker-petstore-server.log | ||
|
||
- name: Generate report checks | ||
if: always() | ||
|
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
#Sample approach to wait until a container is ready | ||
#by looking for a string in container log | ||
container=$1 | ||
target=$2 | ||
|
||
attempt=0 | ||
while [ $attempt -le 30 ]; do | ||
attempt=$(( $attempt + 1 )) | ||
echo "Waiting for container '$container' ready (attempt: $attempt)..." | ||
result=$(docker logs --tail 20 $container) | ||
if grep -q "$target" <<< $result ; then | ||
echo "Container '$container' is ready!" | ||
exit 0 | ||
fi | ||
sleep 2 | ||
done | ||
echo "ERROR: Container '$container' is not ready after maximum number of attempts" | ||
exit 1 |