diff --git a/.github/workflows/main-build.yml b/.github/workflows/main-build.yml index 26c9cee4980..dd2f188d858 100644 --- a/.github/workflows/main-build.yml +++ b/.github/workflows/main-build.yml @@ -126,3 +126,35 @@ jobs: AZURE_SP_KEY: ${{ secrets.AZURE_SP_KEY }} AZURE_SP_TENANT: ${{ secrets.AZURE_SP_TENANT }} AZURE_SUBSCRIPTION: ${{ secrets.AZURE_SUBSCRIPTION }} + + validate-arm64: + needs: build + name: validate-arm64 + runs-on: ARM64 + concurrency: arm-smoke-tests + steps: + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: 1.17 + + - name: Install prerequisites + run: | + apt update + apt install curl npm make ca-certificates gcc libc-dev -y + env: + DEBIAN_FRONTEND: noninteractive + + - name: Check out code + uses: actions/checkout@v3 + with: + fetch-depth: 1 + + - name: Create k8s v1.23 Kind Cluster + uses: JorTurFer/kind-action@main + with: + node_image: kindest/node:v1.23.0@sha256:49824ab1727c04e56a21a5d8372a402fcd32ea51ac96a2706a12af38934f81ac + cluster_name: smoke-tests-cluster + + - name: Run smoke test + run: make arm-smoke-test diff --git a/.github/workflows/nightly-e2e.yml b/.github/workflows/nightly-e2e.yml index 83a969f8b6c..30e086bdd2f 100644 --- a/.github/workflows/nightly-e2e.yml +++ b/.github/workflows/nightly-e2e.yml @@ -2,11 +2,12 @@ name: nightly-e2e-test on: schedule: - cron: "0 0 * * *" -concurrency: e2e-tests + jobs: - test: + validate: name: Test runs-on: ubuntu-latest + concurrency: e2e-tests # build-tools is built from ../../tools/build-tools.Dockerfile container: ghcr.io/kedacore/build-tools:main steps: @@ -56,3 +57,34 @@ jobs: AZURE_SP_KEY: ${{ secrets.AZURE_SP_KEY }} AZURE_SP_TENANT: ${{ secrets.AZURE_SP_TENANT }} AZURE_SUBSCRIPTION: ${{ secrets.AZURE_SUBSCRIPTION }} + + validate-arm64: + name: validate-arm64 + runs-on: ARM64 + concurrency: arm-smoke-tests + steps: + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: 1.17 + + - name: Install prerequisites + run: | + apt update + apt install curl npm make ca-certificates gcc libc-dev -y + env: + DEBIAN_FRONTEND: noninteractive + + - name: Check out code + uses: actions/checkout@v3 + with: + fetch-depth: 1 + + - name: Create k8s v1.23 Kind Cluster + uses: JorTurFer/kind-action@main + with: + node_image: kindest/node:v1.23.0@sha256:49824ab1727c04e56a21a5d8372a402fcd32ea51ac96a2706a12af38934f81ac + cluster_name: smoke-tests-cluster + + - name: Run smoke test + run: make arm-smoke-test diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 900d81d6aea..065d7485993 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -124,6 +124,7 @@ jobs: validate-build-tools: name: Validate build-tools runs-on: ubuntu-latest + container: ghcr.io/kedacore/build-tools:main steps: - uses: actions/checkout@v3 diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d2d114be30..4440844cb69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ ### New - **General:** Automatically release container image for ARM ([#2263]https://github.com/kedacore/keda/issues/2263)) +- **General:** Automatically run end-to-end tests on ARM ([#2262]https://github.com/kedacore/keda/issues/2262)) ### Improvements diff --git a/tests/run-all.sh b/tests/run-all.sh index 0eacd6b9a08..8b3ff43c17b 100755 --- a/tests/run-all.sh +++ b/tests/run-all.sh @@ -28,7 +28,7 @@ function run_tests { fi counter=$((counter+1)) - ./node_modules/.bin/ava $test_case > "${test_case}.1.log" 2>&1 & + ./node_modules/.bin/ava $test_case > "${test_case}.log" 2>&1 & pid=$! echo "Running $test_case with pid: $pid" pids+=($pid) @@ -61,7 +61,7 @@ function run_tests { for test_case in "${retry_lookup[@]}" do counter=$((counter+1)) - ./node_modules/.bin/ava $test_case > "${test_case}.2.log" 2>&1 & + ./node_modules/.bin/ava $test_case > "${test_case}.retry.log" 2>&1 & pid=$! echo "Rerunning $test_case with pid: $pid" pids+=($pid) diff --git a/tests/run-arm-smoke-tests.sh b/tests/run-arm-smoke-tests.sh old mode 100644 new mode 100755 index 87e99fa137c..b747869f18b --- a/tests/run-arm-smoke-tests.sh +++ b/tests/run-arm-smoke-tests.sh @@ -5,8 +5,9 @@ DIR=$(dirname "$0") cd $DIR test_files=( - "influxdb.test.ts" #ScaledObject - "mongodb.test.ts" #ScaledJob + "kubernetes-workload.test.ts" + "activemq.test.ts" + "cron.test.ts" ) concurrent_tests_limit=5 @@ -33,12 +34,46 @@ function run_tests { pids+=($pid) lookup[$pid]=$test_case # limit concurrent runs - if [[ "$counter" -gt "$concurrent_tests_limit" ]]; then + if [[ "$counter" -ge "$concurrent_tests_limit" ]]; then wait_for_jobs counter=0 pids=() fi done + + wait_for_jobs + + # Retry failing tests + if [ ${#failed_lookup[@]} -ne 0 ]; then + + printf "\n\n##############################################\n" + printf "##############################################\n\n" + printf "FINISHED FIRST EXECUTION, RETRYING FAILING TESTS" + printf "\n\n##############################################\n" + printf "##############################################\n\n" + + retry_lookup=("${failed_lookup[@]}") + counter=0 + pids=() + failed_count=0 + failed_lookup=() + + for test_case in "${retry_lookup[@]}" + do + counter=$((counter+1)) + ./node_modules/.bin/ava $test_case > "${test_case}.retry.log" 2>&1 & + pid=$! + echo "Rerunning $test_case with pid: $pid" + pids+=($pid) + lookup[$pid]=$test_case + # limit concurrent runs + if [[ "$counter" -ge "$concurrent_tests_limit" ]]; then + wait_for_jobs + counter=0 + pids=() + fi + done + fi } function mark_failed { diff --git a/tests/scalers/artemis.test.ts b/tests/scalers/artemis.test.ts index 4b1a9036084..e8892d99f5e 100644 --- a/tests/scalers/artemis.test.ts +++ b/tests/scalers/artemis.test.ts @@ -1,4 +1,3 @@ -import * as async from 'async' import * as fs from 'fs' import * as sh from 'shelljs' import * as tmp from 'tmp' @@ -8,9 +7,6 @@ import { createNamespace } from './helpers' const testNamespace = 'kedartemis' const artemisNamespace = 'artemis' -const queueName = 'test' -const username = "artemis" -const password = "artemis" test.before(t => { sh.config.silent = true diff --git a/tests/scalers/mysql.test.ts b/tests/scalers/mysql.test.ts index f355e81fa7b..2ac28049dba 100644 --- a/tests/scalers/mysql.test.ts +++ b/tests/scalers/mysql.test.ts @@ -1,4 +1,3 @@ -import * as async from 'async' import * as fs from 'fs' import * as sh from 'shelljs' import * as tmp from 'tmp' diff --git a/tests/scalers/postgresql.test.ts b/tests/scalers/postgresql.test.ts index c599bbbb464..15cf120ba7f 100644 --- a/tests/scalers/postgresql.test.ts +++ b/tests/scalers/postgresql.test.ts @@ -1,4 +1,3 @@ -import * as async from 'async' import * as fs from 'fs' import * as sh from 'shelljs' import * as tmp from 'tmp' diff --git a/tests/scalers/rabbitmq-queue-amqp.test.ts b/tests/scalers/rabbitmq-queue-amqp.test.ts index 43c306081a4..f34b937d6d0 100644 --- a/tests/scalers/rabbitmq-queue-amqp.test.ts +++ b/tests/scalers/rabbitmq-queue-amqp.test.ts @@ -1,7 +1,4 @@ -import * as async from 'async' -import * as fs from 'fs' import * as sh from 'shelljs' -import * as tmp from 'tmp' import test from 'ava' import { RabbitMQHelper } from './rabbitmq-helpers' import {waitForDeploymentReplicaCount} from "./helpers"; diff --git a/tests/scalers/rabbitmq-queue-http-regex-vhost.test.ts b/tests/scalers/rabbitmq-queue-http-regex-vhost.test.ts index c67d090759f..35c2e24a7de 100644 --- a/tests/scalers/rabbitmq-queue-http-regex-vhost.test.ts +++ b/tests/scalers/rabbitmq-queue-http-regex-vhost.test.ts @@ -1,7 +1,4 @@ -import * as async from 'async' -import * as fs from 'fs' import * as sh from 'shelljs' -import * as tmp from 'tmp' import test from 'ava' import { RabbitMQHelper } from './rabbitmq-helpers' import {waitForDeploymentReplicaCount} from "./helpers"; diff --git a/tests/scalers/rabbitmq-queue-http-regex.test.ts b/tests/scalers/rabbitmq-queue-http-regex.test.ts index c7535efc54f..a70dd66bb2a 100644 --- a/tests/scalers/rabbitmq-queue-http-regex.test.ts +++ b/tests/scalers/rabbitmq-queue-http-regex.test.ts @@ -1,7 +1,4 @@ -import * as async from 'async' -import * as fs from 'fs' import * as sh from 'shelljs' -import * as tmp from 'tmp' import test from 'ava' import { RabbitMQHelper } from './rabbitmq-helpers' import {waitForDeploymentReplicaCount} from "./helpers"; diff --git a/tests/scalers/rabbitmq-queue-http.test.ts b/tests/scalers/rabbitmq-queue-http.test.ts index 6046a8c2639..cf9f5998ccd 100644 --- a/tests/scalers/rabbitmq-queue-http.test.ts +++ b/tests/scalers/rabbitmq-queue-http.test.ts @@ -1,10 +1,7 @@ -import * as async from 'async' -import * as fs from 'fs' import * as sh from 'shelljs' -import * as tmp from 'tmp' import test from 'ava' import { RabbitMQHelper } from './rabbitmq-helpers' -import {sleep, waitForDeploymentReplicaCount} from "./helpers"; +import { waitForDeploymentReplicaCount} from "./helpers"; const testNamespace = 'rabbitmq-queue-http-test' const rabbitmqNamespace = 'rabbitmq-http-test' diff --git a/tests/scalers/rabbitmq-queue-trigger-auth.test.ts b/tests/scalers/rabbitmq-queue-trigger-auth.test.ts index b0b21cb503e..736cb253619 100644 --- a/tests/scalers/rabbitmq-queue-trigger-auth.test.ts +++ b/tests/scalers/rabbitmq-queue-trigger-auth.test.ts @@ -1,7 +1,4 @@ -import * as async from 'async' -import * as fs from 'fs' import * as sh from 'shelljs' -import * as tmp from 'tmp' import test from 'ava' import { RabbitMQHelper } from './rabbitmq-helpers'