Skip to content

Non Functional Testing #90

Non Functional Testing

Non Functional Testing #90

Workflow file for this run

name: Non Functional Testing
on:
workflow_dispatch:
inputs:
test_label:
description: NFR test to run. Choose between a specific test or all tests
required: true
default: all
type: choice
options:
[
performance,
upgrade,
scale,
zero-downtime-scale,
reconfiguration,
all,
]
version:
description: Version of NGF under test
required: true
default: edge
image_tag:
description: Tag of the NGF and NGINX Docker images
required: true
default: edge
type:
description: Type of NGINX image to test
required: true
default: both
type: choice
options: [oss, plus, both]
schedule:
- cron: "0 16 1,15 * *" # Run on the 1st and 15th of every month at 16:00 UTC
defaults:
run:
shell: bash
env:
PLUS_USAGE_ENDPOINT: ${{ secrets.JWT_PLUS_REPORTING_ENDPOINT }}
concurrency:
group: ${{ github.ref_name }}-nfr
cancel-in-progress: true
permissions:
contents: read
jobs:
vars:
name: Set up vars
runs-on: ubuntu-24.04
outputs:
test_label: ${{ github.event.inputs.test_label || 'all' }}
version: ${{ github.event.inputs.version || 'edge' }}
image_tag: ${{ github.event.inputs.image_tag || 'edge' }}
types: ${{ steps.var.outputs.types }}
permissions:
contents: read
steps:
- name: Set vars
id: var
run: |
if ${{ github.event.inputs.type == 'both' || github.event_name == 'schedule' }}; then
echo 'types=["oss","plus"]' >> $GITHUB_OUTPUT
else
echo 'types=["${{ github.event.inputs.type }}"]' >> $GITHUB_OUTPUT
fi
setup-and-run-tests:
name: Setup and Run NFR Tests
runs-on: ubuntu-24.04
permissions:
contents: read
id-token: write # needed for authenticating to GCP
needs: vars
strategy:
fail-fast: false
matrix:
type: ${{ fromJson(needs.vars.outputs.types) }}
steps:
- name: Checkout Repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/auth@6fc4af4b145ae7821d527454aa9bd537d1f2dc5f # v2.1.7
with:
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY }}
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@6189d56e4096ee891640bb02ac264be376592d6a # v2.1.2
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
install_components: kubectl
- name: Setup OpenTofu
uses: opentofu/setup-opentofu@592200bd4b9bbf4772ace78f887668b1aee8f716 # v1.0.5
with:
tofu_version: 1.8.7 # renovate: datasource=github-tags depName=opentofu/opentofu
tofu_wrapper: false
- name: Initialize OpenTofu
working-directory: ./tests/tofu
run: |
tofu version
tofu init
- name: Setup tfvars file
working-directory: ./tests/tofu
run: |
cat <<EOF > terraform.tfvars
gke_project = "${{ secrets.GCP_PROJECT_ID }}"
gke_cluster_name = "nfr-tests-${{ github.run_id }}-${{ matrix.type }}"
gke_num_nodes = 12
gke_machine_type = "n2d-standard-16"
gke_nodes_service_account = "${{ secrets.GKE_NODES_SERVICE_ACCOUNT }}"
vm_service_account = "${{ secrets.GCP_SERVICE_ACCOUNT }}"
ngf_branch = "${{ github.ref_name }}"
EOF
- name: Setup dotenv file
working-directory: ./tests/scripts
run: |
echo "TAG=${{ needs.vars.outputs.image_tag }}" >> vars.env
echo "PREFIX=ghcr.io/nginxinc/nginx-gateway-fabric" >> vars.env
echo "NGINX_PREFIX=ghcr.io/nginxinc/nginx-gateway-fabric/nginx" >> vars.env
echo "NGINX_PLUS_PREFIX=us-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/nginx-gateway-fabric/nginx-plus" >> vars.env
echo "PLUS_ENABLED=${{ matrix.type == 'plus' }}" >> vars.env
echo "GINKGO_LABEL=" >> vars.env
echo "NGF_VERSION=${{ needs.vars.outputs.version }}" >> vars.env
echo "PLUS_USAGE_ENDPOINT=${{ secrets.JWT_PLUS_REPORTING_ENDPOINT }}" >> vars.env
- name: Create GKE cluster and VM
working-directory: ./tests/tofu
run: |
tofu apply --auto-approve
- name: Run Tests
working-directory: ./tests
run: |
if ${{ needs.vars.outputs.test_label != 'all' }}; then
sed -i '/^GINKGO_LABEL=/s/=.*/="${{ needs.vars.outputs.test_label }}"/' "scripts/vars.env" && make nfr-test CI=true;
else
make nfr-test CI=true;
fi
- name: Upload Artifacts
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: results-${{ matrix.type }}
path: tests/results/**/*-${{ matrix.type }}.*
- name: Cleanup
working-directory: ./tests/tofu
if: always()
run: |
tofu destroy --auto-approve
pr-results:
name: Open PR with results
runs-on: ubuntu-24.04
permissions:
contents: write # needed for opening PR with the results files
pull-requests: write # needed for opening PR with the results files
needs: [vars, setup-and-run-tests]
steps:
- name: Checkout Repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Download Artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
path: tests/results/
merge-multiple: true
- name: Open a PR with the results
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
with:
token: ${{ secrets.NGINX_PAT }}
commit-message: NFR Test Results for NGF version ${{ needs.vars.outputs.version }}
author: nginx-bot <integrations@nginx.com>
committer: nginx-bot <integrations@nginx.com>
branch: tests/nfr-tests-${{ needs.vars.outputs.version }}
delete-branch: true
title: NFR Test Results for NGF version ${{ needs.vars.outputs.version }}
add-paths: |
tests/results/
body: |
Update with NFR test results for NGF version ${{ needs.vars.outputs.version }} ${{ needs.vars.outputs.types }}
- Auto-generated by the NFR tests workflow run ${{ github.run_id }}
- Tests ran using Docker image tag ${{ needs.vars.outputs.image_tag }}
- ${{ needs.vars.outputs.test_label }} test(s) ran
assignees: ${{ github.actor }}
draft: ${{ github.event_name != 'schedule' }}