-
Notifications
You must be signed in to change notification settings - Fork 1
Docker compose for dev and integration test for CI #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d9097ef
Basic docker-compose setup
jbothma 0cd03ae
Add basic github actions workflow
jbothma d470b0f
configure keycloak and test authenticating
jbothma a13fa4e
Checkout agari-helm so it's available for docker compose
jbothma 165aa9a
Add folio and basic folio-keycloak integration check
jbothma dcbaa63
Fix health check
jbothma 5f93f0b
Give folio curl to be able to check its own health
jbothma File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| name: Integration Tests | ||
|
|
||
| on: | ||
| push: | ||
| pull_request: | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| integration: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Checkout agari-helm | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: jbothma/agari-helm | ||
| ref: integration-tested | ||
| path: agari-helm | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Start services | ||
| env: | ||
| AGARI_HELM_PATH: ${{ github.workspace }}/agari-helm | ||
| run: docker compose up -d | ||
|
|
||
| - name: Wait for services to be healthy | ||
| timeout-minutes: 5 | ||
| run: | | ||
| echo "Waiting for all services to become healthy (excluding zookeeper)..." | ||
| END=$((SECONDS+120)) | ||
|
|
||
| while [ $SECONDS -lt $END ]; do | ||
| # Get list of unhealthy services (excluding NAME header, already healthy services, and zookeeper) | ||
| UNHEALTHY=$(docker compose ps --status running | egrep -v '(NAME|healthy|zookeeper)' || true) | ||
|
|
||
| if [ -z "$UNHEALTHY" ]; then | ||
| echo "All services are healthy!" | ||
| docker compose ps | ||
| exit 0 | ||
| fi | ||
|
|
||
| echo "Still waiting for services to become healthy..." | ||
| echo "$UNHEALTHY" | ||
| sleep 5 | ||
| done | ||
|
|
||
| echo "Timeout: Services did not become healthy within 2 minutes" | ||
| docker compose ps | ||
| exit 1 | ||
|
|
||
| - name: Show service status | ||
| if: success() | ||
| run: docker compose ps | ||
|
|
||
| - name: Test authentication | ||
| run: | | ||
| echo "Testing Keycloak authentication as system-admin..." | ||
| RESPONSE=$(curl --silent --request POST \ | ||
| --url http://localhost:8080/realms/agari/protocol/openid-connect/token \ | ||
| --header 'content-type: application/x-www-form-urlencoded' \ | ||
| --data username=system.admin@agari.tech \ | ||
| --data password=pass123 \ | ||
| --data grant_type=password \ | ||
| --data client_id=dms \ | ||
| --data client_secret=VDyLEjGR3xDQvoQlrHq5AB6OwbW0Refc) | ||
|
|
||
| SYSADMIN_ACCESS_TOKEN=$(echo "$RESPONSE" | jq -r '.access_token') | ||
|
|
||
| if [ "$SYSADMIN_ACCESS_TOKEN" = "null" ] || [ -z "$SYSADMIN_ACCESS_TOKEN" ]; then | ||
| echo "Failed to get access token" | ||
| echo "Response: $RESPONSE" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Successfully obtained access token for system-admin" | ||
| echo "SYSADMIN_ACCESS_TOKEN=${SYSADMIN_ACCESS_TOKEN}" >> $GITHUB_ENV | ||
|
|
||
| - name: Test Folio whoami endpoint | ||
| run: | | ||
| echo "Testing Folio /info/whoami endpoint..." | ||
| RESPONSE=$(curl --silent --request GET \ | ||
| --url http://localhost:8000/info/whoami \ | ||
| --header "authorization: Bearer ${SYSADMIN_ACCESS_TOKEN}") | ||
|
|
||
| echo "Response: $RESPONSE" | ||
|
|
||
| if echo "$RESPONSE" | grep -q "system.admin@agari.tech"; then | ||
| echo "✓ Successfully verified user identity: system.admin@agari.tech" | ||
| exit 0 | ||
| else | ||
| echo "✗ Failed to find system.admin@agari.tech in response" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Print docker compose logs | ||
| if: always() | ||
| run: docker compose logs | ||
|
|
||
| - name: Clean up | ||
| if: always() | ||
| run: docker compose down -v | ||
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert to OpenUp master when OpenUpSA/agari-helm#10 is merged or otherwise fixed