Skip to content

Commit

Permalink
Update test.sh/test.yml (#7)
Browse files Browse the repository at this point in the history
* add listener

* update listener

* inventory listener update

* edit minor part

* test case update

* update inventory test 2

* 3 test cases

* EndpointIT

* test.sh

* update test.sh

* testApp.sh

* testApp.sh final

* delete scripts

* test.yml updates
  • Loading branch information
siwany authored Jun 13, 2024
1 parent 5817875 commit 525d084
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 69 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Test application

on:
pull_request:
branches: [ prod, staging, draft ]

jobs:
check-files:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
outputs:
canSkip: ${{ steps.Checker.outputs.canSkip }}
steps:
- name: Get files
uses: actions/checkout@v2
- name: Get tools
uses: actions/checkout@v2
with:
path: tools/
repository: openliberty/guides-common
- id: Checker
shell: bash
run: bash ./tools/pr-checker/checker.sh ${{ github.repository }} ${{ github.event.pull_request.number }} | tee checker.log
- id: Lint-Code-Base
if: "! github.event.pull_request.head.repo.fork"
uses: github/super-linter@latest
env:
VALIDATE_ALL_CODEBASE: false
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LINTER_RULES_PATH: ./tools/pr-checker/linters/
DEFAULT_BRANCH: draft
- name: Summary
if: "! github.event.pull_request.head.repo.fork"
run: |
< ./checker.log tail -n +2; echo "====== Super Linter ======"
< ./super-linter.log sed -n '/.*The script has completed.*/,$p' | tail -n +4 | sed 's/.*\(\[[A-Z]\+\]\)/\1/'
echo "====== Examine logs in Checker and Super-Linter steps for more details ======"
if [ '${{ steps.Checker.outcome }}' != 'success' ] || [ '${{ steps.Lint-Code-Base.outcome }}' != 'success' ]; then exit 1; fi
test-app:
runs-on: ubuntu-latest
needs: [check-files]
if: "!contains(needs.check-files.outputs.canSkip, 'true')"
defaults:
run:
working-directory: finish
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- run: unset _JAVA_OPTIONS
- name: Run tests
run: |
chmod +x ../scripts/testApp.sh
sudo ../scripts/testApp.sh
- name: Post tests
if: always()
run: |
logsPath=$(sudo find . -name "console.log" | grep inventory);
sudo cat "$logsPath" | sudo grep Launching
logsPath=$(sudo find . -name "console.log" | grep system);
sudo cat "$logsPath" | sudo grep Launching
- name: Archive finish inventory logs if failed
if: failure()
uses: actions/upload-artifact@v2
with:
name: finish-inventory-logs
path: finish/inventory/target/liberty/wlp/usr/servers/defaultServer/logs/
- name: Archive finish system logs if failed
if: failure()
uses: actions/upload-artifact@v2
with:
name: finish-system-logs
path: finish/system/target/liberty/wlp/usr/servers/defaultServer/logs/
10 changes: 0 additions & 10 deletions finish/scripts/buildImages.sh

This file was deleted.

9 changes: 0 additions & 9 deletions finish/scripts/packageApps.sh

This file was deleted.

41 changes: 0 additions & 41 deletions finish/scripts/startContainers.sh

This file was deleted.

9 changes: 0 additions & 9 deletions finish/scripts/stopContainers.sh

This file was deleted.

29 changes: 29 additions & 0 deletions scripts/testApp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash
set -euxo pipefail

mvn -pl models clean install

mvn -ntp -Dhttp.keepAlive=false \
-Dmaven.wagon.http.pool=false \
-Dmaven.wagon.httpconnectionManager.ttlSeconds=120 \
-pl system -q clean package liberty:create liberty:install-feature liberty:deploy

mvn -ntp -Dhttp.keepAlive=false \
-Dmaven.wagon.http.pool=false \
-Dmaven.wagon.httpconnectionManager.ttlSeconds=120 \
-pl inventory -q clean package liberty:create liberty:install-feature liberty:deploy

mvn -ntp -pl inventory liberty:start
sleep 10
mvn -ntp -pl system liberty:start
sleep 15

mvn -ntp -Dhttp.keepAlive=false \
-Dmaven.wagon.http.pool=false \
-Dmaven.wagon.httpconnectionManager.ttlSeconds=120 \
-pl inventory failsafe:integration-test

mvn -ntp -pl inventory failsafe:verify

mvn -pl system liberty:stop
mvn -pl inventory liberty:stop

0 comments on commit 525d084

Please sign in to comment.