Skip to content

E2E Test

E2E Test #2579

name: E2E Test
# This workflow executes end-to-end tests and verifies that the binaries are buildable
# The workflow is executed on latest main commits, pull requests which are labeled 'run-e2e-test', and nightly.
on:
push:
branches: [ main ]
schedule:
- cron: '0 0 * * *' # nightly build ensure E2E tests run daily and catch any breaking API changes
pull_request_target:
types: [ labeled ]
defaults:
run:
shell: bash
jobs:
setup:
name: Setup variables
if: github.repository == 'Dynatrace/dynatrace-configuration-as-code'
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
sha: ${{ steps.write.outputs.sha }} # sha contains the correct sha for followup jobs to use
steps:
- name: Fetch base repo sha
if: github.event.action == 'labeled' && (github.event.label.name == 'run-e2e-test' || github.event.label.name == 'run-iam-test')
run: echo "sha=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
- name: Fetch event sha
if: github.event.action != 'labeled'
run: echo "sha=$GITHUB_SHA" >> $GITHUB_ENV
- id: write
name: Store sha
run: echo "sha=$sha" >> $GITHUB_OUTPUT
release-binaries:
name: 🏁 Build release binaries
needs: [setup]
if: github.event.action != 'labeled' || github.event.label.name == 'run-e2e-test'
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
with:
ref: ${{needs.setup.outputs.sha}}
- name: Set up Go 1.x
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed #v5.1.0
with:
go-version: '~1.23'
- name: 🏁 Build release binaries
run: make build-release
integration-test:
name: 🌎 Integration tests
if: github.event.action != 'labeled' || github.event.label.name == 'run-e2e-test'
needs: [setup]
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
with:
ref: ${{needs.setup.outputs.sha}}
- name: Set up Go 1.x
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed #v5.1.0
with:
go-version: '~1.23'
- name: 🌎 Integration test
run: make integration-test testopts="--junitfile test-result-integration.xml"
env:
URL_ENVIRONMENT_1: ${{ secrets.URL_ENVIRONMENT_1 }}
URL_ENVIRONMENT_2: ${{ secrets.URL_ENVIRONMENT_2 }}
TOKEN_ENVIRONMENT_1: ${{ secrets.TOKEN_ENVIRONMENT_1 }}
TOKEN_ENVIRONMENT_2: ${{ secrets.TOKEN_ENVIRONMENT_2 }}
PLATFORM_URL_ENVIRONMENT_1: ${{ secrets.PLATFORM_URL_ENVIRONMENT_1 }}
PLATFORM_URL_ENVIRONMENT_2: ${{ secrets.PLATFORM_URL_ENVIRONMENT_2 }}
OAUTH_CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }}
OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET }}
OAUTH_TOKEN_ENDPOINT: ${{ secrets.OAUTH_TOKEN_ENDPOINT }}
- name: ⬆️ Upload Test Results
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 #v4.4.3
if: always()
with:
name: Test Results - Integration
path: test-result-*.xml
legacy-integration-tests:
name: 🧓 Legacy integration tests
needs: [setup]
if: github.event.action != 'labeled' || github.event.label.name == 'run-e2e-test'
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
with:
ref: ${{needs.setup.outputs.sha}}
- name: Set up Go 1.x
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed #v5.1.0
with:
go-version: '~1.23'
- name: 🧓 Integration test (legacy)
run: make integration-test-v1 testopts="--junitfile test-result-integration-legacy.xml"
env:
URL_ENVIRONMENT_1: ${{ secrets.URL_ENVIRONMENT_1 }}
URL_ENVIRONMENT_2: ${{ secrets.URL_ENVIRONMENT_2 }}
TOKEN_ENVIRONMENT_1: ${{ secrets.TOKEN_ENVIRONMENT_1 }}
TOKEN_ENVIRONMENT_2: ${{ secrets.TOKEN_ENVIRONMENT_2 }}
PLATFORM_URL_ENVIRONMENT_1: ${{ secrets.PLATFORM_URL_ENVIRONMENT_1 }}
PLATFORM_URL_ENVIRONMENT_2: ${{ secrets.PLATFORM_URL_ENVIRONMENT_2 }}
OAUTH_CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }}
OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET }}
OAUTH_TOKEN_ENDPOINT: ${{ secrets.OAUTH_TOKEN_ENDPOINT }}
- name: ⬆️ Upload Test Results
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 #v4.4.3
if: always()
with:
name: Test Results - Integration Legacy
path: test-result-*.xml
download-restore-test:
name: 📥/📤 Download-restore-test
needs: [setup]
if: github.event.action != 'labeled' || github.event.label.name == 'run-e2e-test'
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
with:
ref: ${{needs.setup.outputs.sha}}
- name: Set up Go 1.x
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed #v5.1.0
with:
go-version: '~1.23'
- name: 📥/📤 Download/Restore test
run: make download-restore-test testopts="--junitfile test-result-integration-download-restore.xml"
env:
URL_ENVIRONMENT_1: ${{ secrets.URL_ENVIRONMENT_1 }}
URL_ENVIRONMENT_2: ${{ secrets.URL_ENVIRONMENT_2 }}
TOKEN_ENVIRONMENT_1: ${{ secrets.TOKEN_ENVIRONMENT_1 }}
TOKEN_ENVIRONMENT_2: ${{ secrets.TOKEN_ENVIRONMENT_2 }}
PLATFORM_URL_ENVIRONMENT_1: ${{ secrets.PLATFORM_URL_ENVIRONMENT_1 }}
PLATFORM_URL_ENVIRONMENT_2: ${{ secrets.PLATFORM_URL_ENVIRONMENT_2 }}
OAUTH_CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }}
OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET }}
OAUTH_TOKEN_ENDPOINT: ${{ secrets.OAUTH_TOKEN_ENDPOINT }}
- name: ⬆️ Upload Test Results
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 #v4.4.3
if: always()
with:
name: Test Results - Integration Download
path: test-result-*.xml
account-management-test:
name: 🗂️ Account Management E2E tests
if: github.event.label.name == 'run-iam-test'
needs: [setup]
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
with:
ref: ${{needs.setup.outputs.sha}}
- name: Set up Go 1.x
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed #v5.1.0
with:
go-version: '~1.23'
- name: 🗂️ Account Management E2E tests
run: make account-management-test testopts="--junitfile test-result-aim.xml"
env:
ACCOUNT_UUID: ${{ secrets.ACCOUNT_UUID }}
ACCOUNT_OAUTH_CLIENT_ID: ${{ secrets.ACCOUNT_OAUTH_CLIENT_ID }}
ACCOUNT_OAUTH_CLIENT_SECRET: ${{ secrets.ACCOUNT_OAUTH_CLIENT_SECRET }}
TOKEN_ENVIRONMENT_2: ${{ secrets.TOKEN_ENVIRONMENT_2 }}
PLATFORM_URL_ENVIRONMENT_2: ${{ secrets.PLATFORM_URL_ENVIRONMENT_2 }}
OAUTH_CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }}
OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET }}
OAUTH_TOKEN_ENDPOINT: ${{ secrets.OAUTH_TOKEN_ENDPOINT }}
- name: ⬆️ Upload Test Results
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 #v4.4.3
if: always()
with:
name: Test Results - Account Management
path: test-result-*.xml
windows-unit-tests:
name: 🪟 Windows tests
needs: [ setup ]
if: github.event.action != 'labeled' || github.event.label.name == 'run-e2e-test'
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
with:
ref: ${{needs.setup.outputs.sha}}
- name: Set up Go 1.x
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed #v5.1.0
with:
go-version: '~1.23'
- name: 🧪 Unit test
run: make test testopts="--junitfile test-result-windows-latest-unit.xml"
- name: ⬆️ Upload Test Results
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 #v4.4.3
if: always()
with:
name: Test Results - Unit Windows
path: test-result-*.xml
nightly-run:
name: 🌜 Nightly test & 🧹 Cleanup
needs: [setup] # It does not need it strictly, but we filter based on the repository in the setup step
if: github.event_name == 'schedule'
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
steps:
- name: Check out base repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
- name: Set up Go 1.x
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed #v5.1.0
with:
go-version: '~1.23'
- name: 🌜 Nightly Tests
run: make nightly-test testopts="--junitfile test-result-integration-nightly.xml"
env:
URL_ENVIRONMENT_1: ${{ secrets.URL_ENVIRONMENT_1 }}
URL_ENVIRONMENT_2: ${{ secrets.URL_ENVIRONMENT_2 }}
TOKEN_ENVIRONMENT_1: ${{ secrets.TOKEN_ENVIRONMENT_1 }}
TOKEN_ENVIRONMENT_2: ${{ secrets.TOKEN_ENVIRONMENT_2 }}
PLATFORM_URL_ENVIRONMENT_1: ${{ secrets.PLATFORM_URL_ENVIRONMENT_1 }}
PLATFORM_URL_ENVIRONMENT_2: ${{ secrets.PLATFORM_URL_ENVIRONMENT_2 }}
OAUTH_CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }}
OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET }}
OAUTH_TOKEN_ENDPOINT: ${{ secrets.OAUTH_TOKEN_ENDPOINT }}
- name: 🧹 Cleanup
run: make clean-environments
env:
URL_ENVIRONMENT_1: ${{ secrets.URL_ENVIRONMENT_1 }}
URL_ENVIRONMENT_2: ${{ secrets.URL_ENVIRONMENT_2 }}
TOKEN_ENVIRONMENT_1: ${{ secrets.TOKEN_ENVIRONMENT_1 }}
TOKEN_ENVIRONMENT_2: ${{ secrets.TOKEN_ENVIRONMENT_2 }}
PLATFORM_URL_ENVIRONMENT_1: ${{ secrets.PLATFORM_URL_ENVIRONMENT_1 }}
PLATFORM_URL_ENVIRONMENT_2: ${{ secrets.PLATFORM_URL_ENVIRONMENT_2 }}
OAUTH_CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }}
OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET }}
OAUTH_TOKEN_ENDPOINT: ${{ secrets.OAUTH_TOKEN_ENDPOINT }}
- name: ⬆️ Upload Test Results
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 #v4.4.3
if: always()
with:
name: Test Results - Integration Nightly
path: test-result-*.xml
- name: Trigger Dynatrace Workflow on Failure
if: failure()
run: |
curl \
-H 'Authorization: Bearer ${{ secrets.SFM_OAUTH_SECRET }}' \
-X POST https://${{secrets.SFM_TENANT_URL}}/platform/automation/v1/workflows/${{secrets.SFM_WORKFLOW_ID}}/run
upload_event:
name: "Upload Event File"
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 #v4.4.3
with:
name: event_file
path: ${{ github.event_path }}