Skip to content

Commit

Permalink
Run functional tests every 2 hours and add another workflow that runs… (
Browse files Browse the repository at this point in the history
#1020)

* Run functional tests every 2 hours and add another workflow that runs the tests on AKS instead of k3d

Signed-off-by: ytimocin <ytimocin@microsoft.com>

* Triggering workflow

Signed-off-by: ytimocin <ytimocin@microsoft.com>

---------

Signed-off-by: ytimocin <ytimocin@microsoft.com>
  • Loading branch information
ytimocin authored Apr 8, 2024
1 parent 7847e1d commit 05e38de
Show file tree
Hide file tree
Showing 9 changed files with 614 additions and 140 deletions.
52 changes: 52 additions & 0 deletions .github/scripts/cleanup-cluster.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash

# ------------------------------------------------------------
# Copyright 2023 The Radius Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ------------------------------------------------------------

set -e

echo "cleaning up cluster"

# Delete all test resources in queuemessages.
if kubectl get crd queuemessages.ucp.dev >/dev/null 2>&1; then
echo "delete all resources in queuemessages.ucp.dev"
kubectl delete queuemessages.ucp.dev -n radius-system --all
fi

# Testing deletion of deployment.apps.

# Delete all test resources in resources without proxy resource.
if kubectl get crd resources.ucp.dev >/dev/null 2>&1; then
echo "delete all resources in resources.ucp.dev"
resources=$(kubectl get resources.ucp.dev -n radius-system --no-headers -o custom-columns=":metadata.name")
for r in $resources; do
echo "delete resource: $r"
kubectl delete resources.ucp.dev $r -n radius-system --ignore-not-found=true
done
fi

# Delete all test namespaces.
echo "delete all test namespaces"
namespaces=$(kubectl get namespace |
grep -E '^containers.*|^dapr |^dapr-dapr.*|^demo.*|^demo-demo-.*|^eshop-containers.*|^volumes.*|^volumes-myapp.*|^azure.*' |
awk '{print $1}')
for ns in $namespaces; do
if [ -z "$ns" ]; then
break
fi
echo "deleting namespaces: $ns"
kubectl delete namespace $ns --ignore-not-found=true
done
374 changes: 374 additions & 0 deletions .github/workflows/test-aks.yaml

Large diffs are not rendered by default.

21 changes: 12 additions & 9 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Test Samples
name: Test Samples (k3d and EKS)

on:
workflow_dispatch:
inputs:
version:
description: 'Radius version number to use (e.g. 0.1.0, 0.1.0-rc1, edge). Defaults to edge.'
description: "Radius version number to use (e.g. 0.1.0, 0.1.0-rc1, edge). Defaults to edge."
required: false
default: 'edge'
default: "edge"
type: string
push:
branches:
Expand All @@ -20,8 +20,8 @@ on:
branches:
- v*.*
- edge
schedule: # 7:45 AM Pacific Time
- cron: "45 15 * * *"
schedule: # Run every 2 hours
- cron: "0 */2 * * *"
env:
RUN_IDENTIFIER: samplestest-${{ github.run_id }}-${{ github.run_attempt }}
jobs:
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:
uiTestFile: tests/eshop/eshop.app.spec.ts
enableDapr: false
- name: eshop-azure
os: ubuntu-latest
os: ubuntu-latest-m
runOnPullRequest: false
app: eshop
env: azure
Expand All @@ -84,7 +84,7 @@ jobs:
credential: azure
enableDapr: false
- name: eshop-aws
os: ubuntu-latest
os: ubuntu-latest-m
runOnPullRequest: false
app: eshop
env: aws
Expand Down Expand Up @@ -214,7 +214,7 @@ jobs:
run: |
RADIUS_VERSION="${{ inputs.version }}"
if [[ -z "${{ inputs.version }}" ]]; then
RADIUS_VERSION=edge
RADIUS_VERSION=edge
fi
./.github/scripts/install-radius.sh $RADIUS_VERSION
- name: Initialize default environment
Expand Down Expand Up @@ -258,6 +258,7 @@ jobs:
# Deploy application and run tests
- name: Deploy app
if: steps.gen-id.outputs.RUN_TEST == 'true'
id: deploy-app
run: rad deploy ${{ matrix.path }} ${{ matrix.deployArgs }}
- name: Wait for all pods to be ready
if: steps.gen-id.outputs.RUN_TEST == 'true'
Expand All @@ -272,6 +273,8 @@ jobs:
run: |
if [[ "${{ matrix.container }}" != "" ]]; then
rad resource expose containers ${{ matrix.container }} ${{ matrix.exposeArgs }} --port ${{ matrix.port }} &
echo "Endpoint: http://localhost:${{ matrix.port }}"
export ENDPOINT="http://localhost:${{ matrix.port }}"
else
endpoint="$(rad app status -a ${{ matrix.app }} | sed 's/ /\n/g' | grep http)"
echo "Endpoint: $endpoint"
Expand All @@ -292,7 +295,7 @@ jobs:
# Handle failures
- name: Get Pod logs for failed tests
id: get-pod-logs
if: failure() && (steps.run-playwright-test.outcome == 'failure' || steps.wait-for-pods.outcome == 'failure')
if: failure() && (steps.run-playwright-test.outcome == 'failure' || steps.wait-for-pods.outcome == 'failure' || steps.deploy-app.outcome == 'failure')
run: |
# Create pod-logs directory
mkdir -p playwright/pod-logs/${{ matrix.name }}
Expand Down
85 changes: 56 additions & 29 deletions playwright/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions playwright/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"author": "",
"license": "ISC",
"devDependencies": {
"@playwright/test": "^1.35.0",
"@types/node": "^20.6.0",
"@types/uuid": "^9.0.3",
"typescript": "^5.2.2"
"@playwright/test": "^1.43.0",
"@types/node": "^20.12.5",
"@types/uuid": "^9.0.8",
"typescript": "^5.4.4"
},
"dependencies": {
"uuid": "^9.0.0"
"uuid": "^9.0.1"
}
}
Loading

0 comments on commit 05e38de

Please sign in to comment.