Skip to content
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

chore: Enable K6 functional test run after app deploy to test/staging #643

Merged
merged 1 commit into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
name: End-to-end tests
name: Run K6 tests

on:
workflow_dispatch:
workflow_call:
inputs:
apiVersion:
description: 'API Version'
required: true
default: 'v1'
type: string
environment:
description: 'Environment (poc, test, staging)'
required: true
default: 'poc'
type: string
testSuitePath:
required: true
type: string
secrets:
TOKEN_GENERATOR_USERNAME:
required: true
TOKEN_GENERATOR_PASSWORD:
required: true

jobs:
k6-test:
Expand All @@ -20,14 +26,14 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Run K6 tests
- name: Run K6 tests (${{ inputs.testSuitePath }})
uses: grafana/k6-action@v0.3.1
with:
filename: tests/k6/suites/all-single-pass.js
filename: ${{ inputs.testSuitePath }}
#flags: --quiet --log-output=stdout --include-system-env-vars
env:
API_ENVIRONMENT: ${{ github.event.inputs.environment }}
API_VERSION: ${{ github.event.inputs.apiVersion }}
API_ENVIRONMENT: ${{ inputs.environment }}
API_VERSION: ${{ inputs.apiVersion }}
TOKEN_GENERATOR_USERNAME: ${{ secrets.TOKEN_GENERATOR_USERNAME }}
TOKEN_GENERATOR_PASSWORD: ${{ secrets.TOKEN_GENERATOR_PASSWORD }}

Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/ci-cd-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,14 @@ jobs:
function-app-name: "dp-be-test-slacknotifier-fa"
function-project-path: "./src/Digdir.Tool.Dialogporten.SlackNotifier"
environment: test

run-e2e-tests:
name: "Run K6 functional end-to-end tests"
uses: ./.github/workflows/action-run-k6-tests.yml
secrets:
TOKEN_GENERATOR_USERNAME: ${{ secrets.TOKEN_GENERATOR_USERNAME }}
TOKEN_GENERATOR_PASSWORD: ${{ secrets.TOKEN_GENERATOR_PASSWORD }}
with:
environment: test
apiVersion: v1
testSuitePath: tests/k6/suites/all-single-pass.js
11 changes: 11 additions & 0 deletions .github/workflows/ci-cd-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,14 @@ jobs:
environment: staging
region: norwayeast
version: ${{ needs.get-current-version.outputs.version }}

run-e2e-tests:
name: "Run K6 functional end-to-end tests"
uses: ./.github/workflows/action-run-k6-tests.yml
secrets:
TOKEN_GENERATOR_USERNAME: ${{ secrets.TOKEN_GENERATOR_USERNAME }}
TOKEN_GENERATOR_PASSWORD: ${{ secrets.TOKEN_GENERATOR_PASSWORD }}
with:
environment: staging
apiVersion: v1
testSuitePath: tests/k6/suites/all-single-pass.js
33 changes: 33 additions & 0 deletions .github/workflows/dispatch-k6-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Run K6 tests

on:
workflow_dispatch:
inputs:
apiVersion:
description: 'API Version'
required: true
default: 'v1'
environment:
description: 'Environment'
required: true
default: 'test'
type: choice
options:
- test
- staging
testSuitePath:
description: 'Path to test suite to run'
required: true
default: 'tests/k6/suites/all-single-pass.js'

jobs:
k6-test:
name: "Run K6 tests"
uses: ./.github/workflows/action-run-k6-tests.yml
secrets:
TOKEN_GENERATOR_USERNAME: ${{ secrets.TOKEN_GENERATOR_USERNAME }}
TOKEN_GENERATOR_PASSWORD: ${{ secrets.TOKEN_GENERATOR_PASSWORD }}
with:
environment: ${{ inputs.environment }}
apiVersion: ${{ inputs.apiVersion }}
testSuitePath: ${{ inputs.testSuitePath }}
42 changes: 0 additions & 42 deletions .github/workflows/dispatch-perftest-createdelete.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { postSO, deleteSO, expect, describe, getServiceOwnerTokenFromGenerator } from "../../../common/testimports.js";
import { postSO, purgeSO, expect, describe, getServiceOwnerTokenFromGenerator } from "../../../common/testimports.js";
import { default as dialogToInsert } from '../testdata/01-create-dialog.js';

export function setup() {
Expand All @@ -21,7 +21,7 @@ export default function(paramsWithToken) {

describe('remove dialog', () => {
if (dialogId) {
let r = deleteSO('dialogs/' + dialogId, paramsWithToken);
let r = purgeSO('dialogs/' + dialogId, paramsWithToken);
expect(r.status, 'response status').to.equal(204);
}
});
Expand Down
Loading