Skip to content
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
53 changes: 53 additions & 0 deletions .github/scripts/cleanup-cluster.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/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.
# Any namespace that is not in the list below will be deleted.
echo "Delete all test namespaces"
namespaces=$(kubectl get namespace |
grep -vE '(radius-system|kube-system|kube-public|kube-node-lease|gatekeeper-system|default|dapr-system|cert-manager)' |
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.

25 changes: 14 additions & 11 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 @@ -134,7 +134,7 @@ jobs:
if: steps.gen-id.outputs.RUN_TEST == 'true'
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
- name: az CLI login
if: steps.gen-id.outputs.RUN_TEST == 'true' && matrix.credential == 'azure'
run: |
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,12 +295,12 @@ 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 }}
# Get pod logs and save to file
namespace="default-${{ matrix.app }}"
namespace="${{ matrix.env }}-${{ matrix.app }}"
label="radapp.io/application=${{ matrix.app }}"
pod_names=($(kubectl get pods -l $label -n $namespace -o jsonpath='{.items[*].metadata.name}'))
for pod_name in "${pod_names[@]}"; do
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.6",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally this should match the version of node. We're using 16.x in the pipelines.

"@types/uuid": "^9.0.8",
"typescript": "^5.4.4"
},
"dependencies": {
"uuid": "^9.0.0"
"uuid": "^9.0.1"
}
}
25 changes: 14 additions & 11 deletions playwright/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineConfig, devices } from '@playwright/test';
import { defineConfig, devices } from "@playwright/test";

/**
* Read environment variables from file.
Expand All @@ -10,7 +10,7 @@ import { defineConfig, devices } from '@playwright/test';
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './tests',
testDir: "./tests",
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
Expand All @@ -20,31 +20,34 @@ export default defineConfig({
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
reporter: "html",
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000',

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
trace: "on-first-retry",
},

/* Configure projects for major browsers */
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},

{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
name: "firefox",
use: { ...devices["Desktop Firefox"] },
},

{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
name: "webkit",
use: { ...devices["Desktop Safari"] },
},
],
timeout: 1 * 60 * 1000,
expect: {
timeout: 30 * 1000,
},
Comment on lines +49 to +52
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would like @youngbupark to take a look here

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll review this for Young Bu since he's out right now.

});
Loading