Use Case - PROD #74903
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
| name: Use Case - PROD | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '*/15 * * * *' | |
| jobs: | |
| test: | |
| environment: Prod | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| env: | |
| altinn_env: Prod | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - name: Set up K6 | |
| uses: grafana/setup-k6-action@db07bd9765aac508ef18982e52ab937fe633a065 # v1.2.1 | |
| - name: Create k6 secrets file | |
| id: k6-secrets | |
| env: | |
| MP_ENCODEDJWK: ${{ secrets.MP_ENCODEDJWK }} | |
| MP_CLIENT_ID: ${{ secrets.MP_CLIENT_ID }} | |
| MP_KID: ${{ secrets.MP_KID }} | |
| APIM_SUBSCRIPTION_KEY: ${{ secrets.AUTOMATEDTEST_APIM_SUBSCRIPTION_KEY }} | |
| run: | | |
| umask 077 | |
| SECRETS_FILE="${{ runner.temp }}/k6.secrets" | |
| printf 'encodedJwk=%s\n' "$MP_ENCODEDJWK" > "$SECRETS_FILE" | |
| printf 'mpClientId=%s\n' "$MP_CLIENT_ID" >> "$SECRETS_FILE" | |
| printf 'mpKid=%s\n' "$MP_KID" >> "$SECRETS_FILE" | |
| printf 'subscriptionKey=%s\n' "$APIM_SUBSCRIPTION_KEY" >> "$SECRETS_FILE" | |
| echo "file=$SECRETS_FILE" >> "$GITHUB_OUTPUT" | |
| - name: Run API v2 tests | |
| uses: grafana/run-k6-action@de51a7390bdf0ac85a3bef493691bd71d4c7c158 # v1.4.0 | |
| with: | |
| path: components/api/test/k6/src/tests/orders-v2.js | |
| flags: --secret-source=file=${{ steps.k6-secrets.outputs.file }} -e ninRecipient=${{ vars.AUTOMATEDTEST_NINRECIPIENT }} -e emailRecipient=${{ vars.AUTOMATEDTEST_EMAILRECIPIENT }} -e smsRecipient=${{ vars.AUTOMATEDTEST_SMSRECIPIENT }} | |
| inspect-flags: -e altinn_env=Prod # Supplies the value for pre-run validation, when env vars / flags are not yet defined | |
| - name: Run API v2 recipientOrganization tests | |
| uses: grafana/run-k6-action@de51a7390bdf0ac85a3bef493691bd71d4c7c158 # v1.4.0 | |
| with: | |
| path: components/api/test/k6/src/tests/orders-org-no-v2.js | |
| flags: --secret-source=file=${{ steps.k6-secrets.outputs.file }} -e orgNoRecipient=${{ vars.AUTOMATEDTEST_ORG_NO_RECIPIENT }} -e resourceId=${{ vars.AUTOMATEDTEST_URN_RESOURCE_ID }} | |
| inspect-flags: -e altinn_env=Prod # Supplies the value for pre-run validation, when env vars / flags are not yet defined | |
| - name: Run email notification order use case tests | |
| uses: grafana/run-k6-action@de51a7390bdf0ac85a3bef493691bd71d4c7c158 # v1.4.0 | |
| with: | |
| path: components/api/test/k6/src/tests/orders-email.js | |
| flags: --secret-source=file=${{ steps.k6-secrets.outputs.file }} -e emailRecipient=${{ vars.AUTOMATEDTEST_EMAILRECIPIENT }} -e ninRecipient=${{ vars.AUTOMATEDTEST_NINRECIPIENT }} | |
| inspect-flags: -e altinn_env=Prod # Supplies the value for pre-run validation, when env vars / flags are not yet defined | |
| - name: Run contact(s) lookup by organization number use case tests with generating an email notification | |
| uses: grafana/run-k6-action@de51a7390bdf0ac85a3bef493691bd71d4c7c158 # v1.4.0 | |
| with: | |
| path: components/api/test/k6/src/tests/orders-org-no.js | |
| flags: --secret-source=file=${{ steps.k6-secrets.outputs.file }} -e orgNoRecipient=${{ vars.AUTOMATEDTEST_ORG_NO_RECIPIENT }} -e resourceId=${{ vars.AUTOMATEDTEST_RESOURCE_ID }} | |
| inspect-flags: -e altinn_env=Prod # Supplies the value for pre-run validation, when env vars / flags are not yet defined | |
| - name: Run sms notification order use case tests | |
| uses: grafana/run-k6-action@de51a7390bdf0ac85a3bef493691bd71d4c7c158 # v1.4.0 | |
| with: | |
| path: components/api/test/k6/src/tests/orders-sms.js | |
| flags: --secret-source=file=${{ steps.k6-secrets.outputs.file }} -e smsRecipient=${{ vars.AUTOMATEDTEST_SMSRECIPIENT }} | |
| inspect-flags: -e altinn_env=Prod # Supplies the value for pre-run validation, when env vars / flags are not yet defined | |
| slack-notify: | |
| if: failure() | |
| needs: test | |
| uses: ./.github/workflows/send-slack-warning.yml | |
| permissions: {} | |
| with: | |
| warning-message: 'Notifications use case test failure in Prod' | |
| secrets: | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_PROD }} |