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

Enable smoke test for ARM arch #2714

Merged
merged 9 commits into from Mar 9, 2022
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/main-build.yml
Expand Up @@ -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
36 changes: 34 additions & 2 deletions .github/workflows/nightly-e2e.yml
Expand Up @@ -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:
Expand Down Expand Up @@ -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
1 change: 1 addition & 0 deletions .github/workflows/pr-validation.yml
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -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

Expand Down
43 changes: 39 additions & 4 deletions tests/run-arm-smoke-tests.sh 100644 → 100755
Expand Up @@ -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
Expand All @@ -27,18 +28,52 @@ function run_tests {
do
test_case="scalers/${scaler}"
counter=$((counter+1))
./node_modules/.bin/ava $test_case > "${test_case}.log" 2>&1 &
./node_modules/.bin/ava $test_case > "${test_case}.1.log" 2>&1 &
JorTurFer marked this conversation as resolved.
Show resolved Hide resolved
pid=$!
echo "Running $test_case with pid: $pid"
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}.2.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 {
Expand Down
4 changes: 0 additions & 4 deletions 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'
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion 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'
Expand Down
1 change: 0 additions & 1 deletion 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'
Expand Down
3 changes: 0 additions & 3 deletions 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";
Expand Down
3 changes: 0 additions & 3 deletions 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";
Expand Down
3 changes: 0 additions & 3 deletions 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";
Expand Down
5 changes: 1 addition & 4 deletions 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'
Expand Down
3 changes: 0 additions & 3 deletions 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'

Expand Down