From 2a681be2a36280a81177e5a1221f01accd33c89d Mon Sep 17 00:00:00 2001 From: Aaron Crawfis Date: Wed, 20 Mar 2024 11:40:40 -0700 Subject: [PATCH 01/19] Add error handling for failed `oras pull` during installation. (#7302) # Description This PR adds a check to make sure the `oras pull` command compelted successfully. This is needed because it will fail if you have an expired token for GHCR. ## Type of change - This pull request fixes a bug in Radius and has an approved issue (issue link required). Fixes: #7301 --------- Signed-off-by: Aaron Crawfis Co-authored-by: Young Bu Park --- deploy/install.ps1 | 8 ++++++++ deploy/install.sh | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/deploy/install.ps1 b/deploy/install.ps1 index 92586d6ecb..1d8e81eb1d 100755 --- a/deploy/install.ps1 +++ b/deploy/install.ps1 @@ -122,6 +122,14 @@ if ($Version -eq "edge") { $downloadURL = "ghcr.io/${GitHubOrg}/rad/${OS}-${Arch}:latest" Write-Output "Downloading edge CLI from ${downloadURL}..." oras pull $downloadURL -o $RadiusRoot + + # Check if the oras pull command was successful + if ($LASTEXITCODE -ne 0) { + Write-Output "Failed to download edge rad CLI." + Write-Output "If this was an authentication issue, please run 'docker logout ghcr.io' to clear any expired credentials." + Write-Output "Visit https://edge.docs.radapp.io/installation for edge build installation instructions." + Exit 1 + } } else { # Get the list of releases from GitHub diff --git a/deploy/install.sh b/deploy/install.sh index 9134a5ca2f..08d00285d7 100755 --- a/deploy/install.sh +++ b/deploy/install.sh @@ -128,6 +128,15 @@ downloadFile() { DOWNLOAD_URL="ghcr.io/radius-project/rad/${OS}-${ARCH}:latest" echo "Downloading edge CLI from ${DOWNLOAD_URL}..." oras pull $DOWNLOAD_URL -o $RADIUS_TMP_ROOT + + # Check if the oras pull command was successfull + if [ $? -ne 0 ]; then + echo "Failed to download edge CLI." + echo "If this was an authentication issue, please run 'docker logout ghcr.io' to clear any expired credentials." + echo "Visit https://edge.docs.radapp.io/installation for edge CLI installation instructions." + exit 1 + fi + mv $RADIUS_TMP_ROOT/rad $ARTIFACT_TMP_FILE else DOWNLOAD_BASE="https://github.com/${GITHUB_ORG}/${GITHUB_REPO}/releases/download" From 1a06994b9537ba43eeec3b60603adf69cc8807a6 Mon Sep 17 00:00:00 2001 From: Young Bu Park Date: Thu, 21 Mar 2024 21:17:34 -0700 Subject: [PATCH 02/19] Migrate long-running test to new cluster to enable monitoring (#7357) --- .github/scripts/cleanup-cluster.sh | 28 ++++++------ .github/workflows/long-running-azure.yaml | 12 +++--- test/infra/azure/bicepconfig.json | 8 ++-- test/infra/azure/main.bicep | 2 +- test/infra/azure/modules/akscluster.bicep | 52 +---------------------- 5 files changed, 30 insertions(+), 72 deletions(-) diff --git a/.github/scripts/cleanup-cluster.sh b/.github/scripts/cleanup-cluster.sh index 21868b638f..32150caba9 100755 --- a/.github/scripts/cleanup-cluster.sh +++ b/.github/scripts/cleanup-cluster.sh @@ -21,22 +21,26 @@ set -e echo "cleaning up cluster" # Delete all test resources in queuemessages. -echo "delete all resources in queuemessages.ucp.dev" -kubectl delete queuemessages.ucp.dev -n radius-system --all +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. -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 - if [[ $r == scope.local.* || $r == scope.aws.* || -z "$r" ]]; then - echo "skip deletion: $r" - else - echo "delete resource: $r" - kubectl delete resources.ucp.dev $r -n radius-system --ignore-not-found=true - fi -done +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 + if [[ $r == scope.local.* || $r == scope.aws.* || -z "$r" ]]; then + echo "skip deletion: $r" + else + echo "delete resource: $r" + kubectl delete resources.ucp.dev $r -n radius-system --ignore-not-found=true + fi + done +fi # Delete all test namespaces. echo "delete all test namespaces" diff --git a/.github/workflows/long-running-azure.yaml b/.github/workflows/long-running-azure.yaml index e43c7013d7..b633255c1c 100644 --- a/.github/workflows/long-running-azure.yaml +++ b/.github/workflows/long-running-azure.yaml @@ -34,7 +34,7 @@ # the previous build is still valid. If valid, the workflow skips the build steps # and uses the cached 'rad cli' for testing. # -# Grafana dashboard URL: https://radiuse2e00-dashboard-audycmffgberbghy.wus3.grafana.azure.com/ +# Grafana dashboard URL: https://radlrtest00-dashboard-e4ffc0cwggchdhba.wus3.grafana.azure.com name: Long-running test on Azure @@ -44,6 +44,8 @@ permissions: packages: write # Required for uploading the package on: + # Enable manual trigger to deploy the latest changes from main. + workflow_dispatch: schedule: # Run every 2 hours - cron: "0 */2 * * *" @@ -82,9 +84,9 @@ env: VALID_RADIUS_BUILD_WINDOW: 86400 # The AKS cluster name - AKS_CLUSTER_NAME: "radiuse2e00-aks" + AKS_CLUSTER_NAME: "radlrtest00-aks" # The resource group for AKS_CLUSTER_NAME resource. - AKS_RESOURCE_GROUP: "radiuse2e00" + AKS_RESOURCE_GROUP: "radlrtest00" # Server where terraform test modules are deployed TF_RECIPE_MODULE_SERVER_URL: "http://tf-module-server.radius-test-tf-module-server.svc.cluster.local" @@ -115,7 +117,7 @@ jobs: path: ./dist/cache key: radius-test-latest- - name: Skip build if build is still valid - if: github.event_name != 'pull_request' + if: github.event_name != 'pull_request' && github.event_name != 'workflow_dispatch' id: skip-build run: | # check if the last build time to see if we need to build again @@ -499,7 +501,7 @@ jobs: name: Report test failure needs: [build, tests] runs-on: ubuntu-latest - if: failure() && github.repository == 'radius-project/radius' + if: failure() && github.repository == 'radius-project/radius' && github.event_name == 'schedule' steps: - name: Create failure issue for failing long running test run uses: actions/github-script@v6 diff --git a/test/infra/azure/bicepconfig.json b/test/infra/azure/bicepconfig.json index 3b5f42eeef..fcebadba45 100644 --- a/test/infra/azure/bicepconfig.json +++ b/test/infra/azure/bicepconfig.json @@ -1,5 +1,5 @@ { - "experimentalFeaturesEnabled": { - "extensibility": true - } - } \ No newline at end of file + "experimentalFeaturesEnabled": { + "extensibility": true + } +} \ No newline at end of file diff --git a/test/infra/azure/main.bicep b/test/infra/azure/main.bicep index 080d9813a0..963ffcad72 100644 --- a/test/infra/azure/main.bicep +++ b/test/infra/azure/main.bicep @@ -90,7 +90,7 @@ module aksCluster './modules/akscluster.bicep' = { params: { name: aksClusterName location: location - kubernetesVersion: '1.28.3' + kubernetesVersion: '1.28.5' logAnalyticsWorkspaceId: logAnalyticsWorkspace.outputs.id systemAgentPoolName: 'agentpool' systemAgentPoolVmSize: 'Standard_D4as_v5' diff --git a/test/infra/azure/modules/akscluster.bicep b/test/infra/azure/modules/akscluster.bicep index cc298d7eaf..9b33443009 100644 --- a/test/infra/azure/modules/akscluster.bicep +++ b/test/infra/azure/modules/akscluster.bicep @@ -307,9 +307,6 @@ param autoScalerProfileMaxGracefulTerminationSec string = '600' @description('Specifies the resource id of the Log Analytics workspace.') param logAnalyticsWorkspaceId string -@description('Specifies the workspace data retention in days.') -param retentionInDays int = 30 - @description('Specifies the location.') param location string = resourceGroup().location @@ -340,42 +337,8 @@ param imageCleanerIntervalHours int = 24 @description('Specifies whether to enable Workload Identity. The default value is false.') param workloadIdentityEnabled bool = false -// Variables -var diagnosticSettingsName = 'diagnosticSettings' -var logCategories = [ - 'kube-apiserver' - 'kube-audit' - 'kube-audit-admin' - 'kube-controller-manager' - 'kube-scheduler' - 'cluster-autoscaler' - 'cloud-controller-manager' - 'guard' - 'csi-azuredisk-controller' - 'csi-azurefile-controller' - 'csi-snapshot-controller' -] -var metricCategories = [ - 'AllMetrics' -] -var logs = [for category in logCategories: { - category: category - enabled: true - retentionPolicy: { - enabled: true - days: retentionInDays - } -}] -var metrics = [for category in metricCategories: { - category: category - enabled: true - retentionPolicy: { - enabled: true - days: retentionInDays - } -}] -resource aksCluster 'Microsoft.ContainerService/managedClusters@2023-05-01' = { +resource aksCluster 'Microsoft.ContainerService/managedClusters@2023-10-01' = { name: name location: location tags: tags @@ -515,7 +478,7 @@ resource aksCluster 'Microsoft.ContainerService/managedClusters@2023-05-01' = { } // Dapr Extension -resource daprExtension 'Microsoft.KubernetesConfiguration/extensions@2022-04-02-preview' = if (daprEnabled) { +resource daprExtension 'Microsoft.KubernetesConfiguration/extensions@2022-07-01' = if (daprEnabled) { name: 'dapr' scope: aksCluster properties: { @@ -534,17 +497,6 @@ resource daprExtension 'Microsoft.KubernetesConfiguration/extensions@2022-04-02- } } -// Diagnostic Settings -resource diagnosticSettings 'Microsoft.Insights/diagnosticSettings@2021-05-01-preview' = { - name: diagnosticSettingsName - scope: aksCluster - properties: { - workspaceId: logAnalyticsWorkspaceId - logs: logs - metrics: metrics - } -} - // Output output id string = aksCluster.id output name string = aksCluster.name From e60ebbe69e847fdf69f58004af003e7484aa59e7 Mon Sep 17 00:00:00 2001 From: Young Bu Park Date: Fri, 22 Mar 2024 13:53:19 -0700 Subject: [PATCH 03/19] Enable scheduled test with retry for testing purpose (#7367) # Description This is the test workflow to run functional test with retry every hour. It will help to understand how frequently the failure happens and confirm whether retry on test works as expected. ## Type of change - This pull request is a minor refactor, code cleanup, test improvement, or other maintenance task and doesn't change the functionality of Radius (issue link optional). #7174 --------- Signed-off-by: Young Bu Park --- .github/workflows/retry-functional-test.yaml | 577 +++++++++++++++++++ 1 file changed, 577 insertions(+) create mode 100644 .github/workflows/retry-functional-test.yaml diff --git a/.github/workflows/retry-functional-test.yaml b/.github/workflows/retry-functional-test.yaml new file mode 100644 index 0000000000..22140d331f --- /dev/null +++ b/.github/workflows/retry-functional-test.yaml @@ -0,0 +1,577 @@ +# ------------------------------------------------------------ +# 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. +# ------------------------------------------------------------ + +name: '[TEST] Functional tests with retry' + +permissions: + id-token: write # Required for requesting the JWT + contents: read # Required for actions/checkout + packages: write # Required for uploading the package + +on: + schedule: + # Run every hour + - cron: "0 1-23 * * *" + +env: + # Go version + GOVER: '1.21.7' + GOPROXY: https://proxy.golang.org + + # gotestsum version - see: https://github.com/gotestyourself/gotestsum + GOTESTSUM_VER: 1.10.0 + + # Helm version + HELM_VER: 'v3.12.0' + # KinD cluster version + KIND_VER: 'v0.20.0' + # Dapr version + DAPR_VER: '1.12.0' + DAPR_DASHBOARD_VER: '0.14.0' + # Kubectl version + KUBECTL_VER: 'v1.25.0' + # Azure Keyvault CSI driver chart version + AZURE_KEYVAULT_CSI_DRIVER_VER: '1.4.2' + # Azure workload identity webhook chart version + AZURE_WORKLOAD_IDENTITY_WEBHOOK_VER: '1.1.0' + # Container registry for storing container images + CONTAINER_REGISTRY: ghcr.io/radius-project/dev + # Container registry for storing Bicep recipe artifacts + BICEP_RECIPE_REGISTRY: ghcr.io/radius-project/dev + # The radius functional test timeout + FUNCTIONALTEST_TIMEOUT: 60m + # The Azure Location to store test resources + AZURE_LOCATION: westus3 + # The base directory for storing test logs + RADIUS_CONTAINER_LOG_BASE: dist/container_logs + # The Radius helm chart location. + RADIUS_CHART_LOCATION: deploy/Chart/ + # The region for AWS resources + AWS_REGION: 'us-west-2' + # The AWS account ID + AWS_ACCOUNT_ID: '${{ secrets.FUNCTEST_AWS_ACCOUNT_ID }}' + # The current GitHub action link + ACTION_LINK: '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}' + # Server where terraform test modules are deployed + TF_RECIPE_MODULE_SERVER_URL: "http://tf-module-server.radius-test-tf-module-server.svc.cluster.local" + # The functional test GitHub app id + FUNCTIONAL_TEST_APP_ID: 425843 + # Private Git repository where terraform module for testing is stored. + TF_RECIPE_PRIVATE_GIT_SOURCE: "git::https://github.com/radius-project/terraform-private-modules//kubernetes-redis" + +jobs: + build: + name: Build Radius for test + runs-on: ubuntu-latest + env: + DE_IMAGE: 'ghcr.io/radius-project/deployment-engine' + DE_TAG: 'latest' + outputs: + REL_VERSION: ${{ steps.gen-id.outputs.REL_VERSION }} + UNIQUE_ID: ${{ steps.gen-id.outputs.UNIQUE_ID }} + PR_NUMBER: ${{ steps.gen-id.outputs.PR_NUMBER }} + CHECKOUT_REPO: ${{ steps.gen-id.outputs.CHECKOUT_REPO }} + CHECKOUT_REF: ${{ steps.gen-id.outputs.CHECKOUT_REF }} + RAD_CLI_ARTIFACT_NAME: ${{ steps.gen-id.outputs.RAD_CLI_ARTIFACT_NAME }} + DE_IMAGE: ${{ steps.gen-id.outputs.DE_IMAGE }} + DE_TAG: ${{ steps.gen-id.outputs.DE_TAG }} + steps: + - name: Get GitHub app token + uses: tibdex/github-app-token@v1 + id: get_installation_token + with: + app_id: ${{ env.FUNCTIONAL_TEST_APP_ID }} + private_key: ${{ secrets.FUNCTIONAL_TEST_APP_PRIVATE_KEY }} + - name: Set up checkout target + run: | + echo "CHECKOUT_REPO=youngbupark/radius" >> $GITHUB_ENV + echo "CHECKOUT_REF=refs/heads/youngp/enable-retry-test" >> $GITHUB_ENV + - name: Check out code + uses: actions/checkout@v3 + with: + repository: ${{ env.CHECKOUT_REPO }} + ref: ${{ env.CHECKOUT_REF }} + - name: Set up Go ${{ env.GOVER }} + uses: actions/setup-go@v4 + with: + go-version: ${{ env.GOVER }} + - name: Generate ID for release + id: gen-id + run: | + BASE_STR="RADIUS|${GITHUB_SHA}|${GITHUB_SERVER_URL}|${GITHUB_REPOSITORY}|${GITHUB_RUN_ID}|${GITHUB_RUN_ATTEMPT}" + UNIQUE_ID=$(echo $BASE_STR | sha1sum | head -c 10) + echo "REL_VERSION=pr-${UNIQUE_ID}" >> $GITHUB_ENV + + # Set output variables to be used in the other jobs + echo "REL_VERSION=pr-${UNIQUE_ID}" >> $GITHUB_OUTPUT + echo "UNIQUE_ID=${UNIQUE_ID}" >> $GITHUB_OUTPUT + echo "CHECKOUT_REPO=${{ env.CHECKOUT_REPO }}" >> $GITHUB_OUTPUT + echo "CHECKOUT_REF=${{ env.CHECKOUT_REF }}" >> $GITHUB_OUTPUT + echo "AZURE_TEST_RESOURCE_GROUP=radtest-${UNIQUE_ID}" >> $GITHUB_OUTPUT + echo "RAD_CLI_ARTIFACT_NAME=rad_cli_linux_amd64" >> $GITHUB_OUTPUT + echo "PR_NUMBER=${{ env.PR_NUMBER }}" >> $GITHUB_OUTPUT + echo "DE_IMAGE=${{ env.DE_IMAGE }}" >> $GITHUB_OUTPUT + echo "DE_TAG=${{ env.DE_TAG }}" >> $GITHUB_OUTPUT + - uses: marocchino/sticky-pull-request-comment@v2 + if: env.PR_NUMBER != '' + continue-on-error: true + with: + GITHUB_TOKEN: ${{ steps.get_installation_token.outputs.token }} + header: teststatus-${{ github.run_id }} + number: ${{ env.PR_NUMBER }} + hide: true + hide_classify: 'OUTDATED' + message: | + ## Radius functional test overview + + :mag: **[Go to test action run](${{ env.ACTION_LINK }})** + + | Name | Value | + |------|-------| + |**Repository** | ${{ steps.gen-id.outputs.CHECKOUT_REPO }} | + |**Commit ref** | ${{ steps.gen-id.outputs.CHECKOUT_REF }} | + |**Unique ID** | ${{ steps.gen-id.outputs.UNIQUE_ID }} | + |**Image tag** | ${{ steps.gen-id.outputs.REL_VERSION }} | + +
+ Click here to see the list of tools in the current test run + + * gotestsum ${{ env.GOTESTSUM_VER }} + * KinD: ${{ env.KIND_VER }} + * Dapr: ${{ env.DAPR_VER }} + * Azure KeyVault CSI driver: ${{ env.AZURE_KEYVAULT_CSI_DRIVER_VER }} + * Azure Workload identity webhook: ${{ env.AZURE_WORKLOAD_IDENTITY_WEBHOOK_VER }} + * Bicep recipe location `${{ env.BICEP_RECIPE_REGISTRY }}/test/functional/shared/recipes/:${{ env.REL_VERSION }}` + * Terraform recipe location `${{ env.TF_RECIPE_MODULE_SERVER_URL }}/.zip` (in cluster) + * applications-rp test image location: `${{ env.CONTAINER_REGISTRY }}/applications-rp:${{ env.REL_VERSION }}` + * controller test image location: `${{ env.CONTAINER_REGISTRY }}/controller:${{ env.REL_VERSION }}` + * ucp test image location: `${{ env.CONTAINER_REGISTRY }}/ucpd:${{ env.REL_VERSION }}` + * deployment-engine test image location: `${{ env.DE_IMAGE }}:${{ env.DE_TAG }}` + +
+ + ## Test Status + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - uses: marocchino/sticky-pull-request-comment@v2 + if: env.PR_NUMBER != '' + continue-on-error: true + with: + GITHUB_TOKEN: ${{ steps.get_installation_token.outputs.token }} + header: teststatus-${{ github.run_id }} + number: ${{ env.PR_NUMBER }} + append: true + message: | + :hourglass: Building Radius and pushing container images for functional tests... + - name: Build and Push container images + run: | + make build && make docker-build && make docker-push + env: + DOCKER_REGISTRY: ${{ env.CONTAINER_REGISTRY }} + DOCKER_TAG_VERSION: ${{ env.REL_VERSION }} + - name: Upload CLI binary + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.gen-id.outputs.RAD_CLI_ARTIFACT_NAME }} + path: | + ./dist/linux_amd64/release/rad + - uses: marocchino/sticky-pull-request-comment@v2 + if: success() && env.PR_NUMBER != '' + continue-on-error: true + with: + GITHUB_TOKEN: ${{ steps.get_installation_token.outputs.token }} + header: teststatus-${{ github.run_id }} + number: ${{ env.PR_NUMBER }} + append: true + message: | + :white_check_mark: Container images build succeeded + - uses: marocchino/sticky-pull-request-comment@v2 + if: failure() && env.PR_NUMBER != '' + continue-on-error: true + with: + GITHUB_TOKEN: ${{ steps.get_installation_token.outputs.token }} + header: teststatus-${{ github.run_id }} + number: ${{ env.PR_NUMBER }} + append: true + message: | + :x: Container images build failed + - uses: marocchino/sticky-pull-request-comment@v2 + if: env.PR_NUMBER != '' + continue-on-error: true + with: + GITHUB_TOKEN: ${{ steps.get_installation_token.outputs.token }} + header: teststatus-${{ github.run_id }} + number: ${{ env.PR_NUMBER }} + append: true + message: | + :hourglass: Publishing Bicep Recipes for functional tests... + - name: Publish Bicep Test Recipes + run: | + mkdir ./bin + cp ./dist/linux_amd64/release/rad ./bin/rad + chmod +x ./bin/rad + export PATH=$GITHUB_WORKSPACE/bin:$PATH + which rad || { echo "cannot find rad"; exit 1; } + rad bicep download + rad version + make publish-test-bicep-recipes + env: + BICEP_RECIPE_REGISTRY: ${{ env.BICEP_RECIPE_REGISTRY }} + BICEP_RECIPE_TAG_VERSION: ${{ env.REL_VERSION }} + - uses: marocchino/sticky-pull-request-comment@v2 + if: success() && env.PR_NUMBER != '' + continue-on-error: true + with: + GITHUB_TOKEN: ${{ steps.get_installation_token.outputs.token }} + header: teststatus-${{ github.run_id }} + number: ${{ env.PR_NUMBER }} + append: true + message: | + :white_check_mark: Recipe publishing succeeded + - uses: marocchino/sticky-pull-request-comment@v2 + if: failure() && env.PR_NUMBER != '' + continue-on-error: true + with: + GITHUB_TOKEN: ${{ steps.get_installation_token.outputs.token }} + header: teststatus-${{ github.run_id }} + number: ${{ env.PR_NUMBER }} + append: true + message: | + :x: Test recipe publishing failed + tests: + name: Run ${{ matrix.name }} functional tests + needs: build + strategy: + fail-fast: true + matrix: + os: [ubuntu-latest] + name: [ucp,kubernetes,shared,msgrp,daprrp,samples,cli] + include: + # datastorerp functional tests need the larger VM. + - os: ubuntu-latest-m + name: datastoresrp + runs-on: ${{ matrix.os }} + env: + UNIQUE_ID: ${{ needs.build.outputs.UNIQUE_ID }} + REL_VERSION: ${{ needs.build.outputs.REL_VERSION }} + CHECKOUT_REPO: ${{ needs.build.outputs.CHECKOUT_REPO }} + CHECKOUT_REF: ${{ needs.build.outputs.CHECKOUT_REF }} + PR_NUMBER: ${{ needs.build.outputs.PR_NUMBER }} + AZURE_TEST_RESOURCE_GROUP: radtest-${{ needs.build.outputs.UNIQUE_ID }}-${{ matrix.name }} + RAD_CLI_ARTIFACT_NAME: ${{ needs.build.outputs.RAD_CLI_ARTIFACT_NAME }} + BICEP_RECIPE_TAG_VERSION: ${{ needs.build.outputs.REL_VERSION }} + DE_IMAGE: ${{ needs.build.outputs.DE_IMAGE }} + DE_TAG: ${{ needs.build.outputs.DE_TAG }} + steps: + - name: Get GitHub app token + uses: tibdex/github-app-token@v1 + id: get_installation_token + with: + app_id: ${{ env.FUNCTIONAL_TEST_APP_ID }} + private_key: ${{ secrets.FUNCTIONAL_TEST_APP_PRIVATE_KEY }} + - name: Checkout + uses: actions/checkout@v3 + with: + repository: ${{ env.CHECKOUT_REPO }} + ref: ${{ env.CHECKOUT_REF }} + - name: Checkout samples repo + uses: actions/checkout@v3 + if: matrix.name == 'samples' + with: + repository: radius-project/samples + ref: refs/heads/edge + path: samples + - name: Set up Go ${{ env.GOVER }} + uses: actions/setup-go@v3 + with: + go-version: ${{ env.GOVER }} + - name: Get Go Cache path + id: go-cache-paths + run: | + echo "go-build=$(go env GOCACHE)" >> $GITHUB_OUTPUT + echo "go-mod=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT + - uses: actions/cache@v3 + with: + path: | + ${{ steps.go-cache-paths.outputs.go-build }} + ${{ steps.go-cache-paths.outputs.go-mod }} + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: Download rad CLI + uses: actions/download-artifact@v3 + with: + name: ${{ env.RAD_CLI_ARTIFACT_NAME }} + path: bin + - name: Login to Azure + uses: azure/login@v2 + with: + client-id: ${{ secrets.AZURE_SP_TESTS_APPID }} + tenant-id: ${{ secrets.AZURE_SP_TESTS_TENANTID }} + subscription-id: ${{ secrets.AZURE_SUBSCRIPTIONID_TESTS }} + - uses: marocchino/sticky-pull-request-comment@v2 + continue-on-error: true + with: + GITHUB_TOKEN: ${{ steps.get_installation_token.outputs.token }} + header: teststatus-${{ github.run_id }} + number: ${{ env.PR_NUMBER }} + append: true + message: | + :hourglass: Starting ${{ matrix.name }} functional tests... + - name: Create azure resource group - ${{ env.AZURE_TEST_RESOURCE_GROUP }} + run: | + current_time=$(date +%s) + az group create \ + --location ${{ env.AZURE_LOCATION }} \ + --name $RESOURCE_GROUP \ + --subscription ${{ secrets.AZURE_SUBSCRIPTIONID_TESTS }} \ + --tags creationTime=$current_time + while [ $(az group exists --name $RESOURCE_GROUP) = false ]; do sleep 2; done + env: + RESOURCE_GROUP: ${{ env.AZURE_TEST_RESOURCE_GROUP }} + - uses: azure/setup-helm@v3 + with: + version: ${{ env.HELM_VER }} + - name: Create KinD cluster + run: | + curl -sSLo "kind" "https://github.com/kubernetes-sigs/kind/releases/download/${{ env.KIND_VER }}/kind-linux-amd64" + chmod +x ./kind + + # Populate the following environment variables for Azure workload identity from secrets. + # AZURE_OIDC_ISSUER_PUBLIC_KEY + # AZURE_OIDC_ISSUER_PRIVATE_KEY + # AZURE_OIDC_ISSUER + eval "export $(echo "${{ secrets.FUNCTEST_AZURE_OIDC_JSON }}" | jq -r 'to_entries | map("\(.key)=\(.value)") | @sh')" + + AUTHKEY=$(echo -n "${{ github.actor }}:${{ secrets.GH_RAD_CI_BOT_PAT }}" | base64) + echo "{\"auths\":{\"ghcr.io\":{\"auth\":\"${AUTHKEY}\"}}}" > "./ghcr_secret.json" + + # Create KinD cluster with OIDC Issuer keys + echo $AZURE_OIDC_ISSUER_PUBLIC_KEY | base64 -d > sa.pub + echo $AZURE_OIDC_ISSUER_PRIVATE_KEY | base64 -d > sa.key + cat <> $POD_STATE_LOG_FILENAME + kubectl get pods -A >> $POD_STATE_LOG_FILENAME + echo "kubectl describe pods -A" >> $POD_STATE_LOG_FILENAME + kubectl describe pods -A >> $POD_STATE_LOG_FILENAME + - name: Upload container logs + if: always() + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.name }}_container_logs + path: ./${{ env.RADIUS_CONTAINER_LOG_BASE }} + - name: Get Terraform recipe publishing logs + if: always() + run: | + # Create pod-logs directory + mkdir -p recipes/pod-logs + # Get pod logs and save to file + namespace="radius-test-tf-module-server" + label="app.kubernetes.io/name=tf-module-server" + pod_names=($(kubectl get pods -l $label -n $namespace -o jsonpath='{.items[*].metadata.name}')) + for pod_name in "${pod_names[@]}"; do + kubectl logs $pod_name -n $namespace > recipes/pod-logs/${pod_name}.txt + done + echo "Pod logs saved to recipes/pod-logs/" + # Get kubernetes events and save to file + kubectl get events -n $namespace > recipes/pod-logs/events.txt + - name: Upload Terraform recipe publishing logs + uses: actions/upload-artifact@v3 + if: always() + with: + name: recipes-pod-logs + path: recipes/pod-logs + if-no-files-found: error + - uses: marocchino/sticky-pull-request-comment@v2 + if: success() && env.PR_NUMBER != '' + continue-on-error: true + with: + GITHUB_TOKEN: ${{ steps.get_installation_token.outputs.token }} + header: teststatus-${{ github.run_id }} + number: ${{ env.PR_NUMBER }} + append: true + message: | + :white_check_mark: ${{ matrix.name }} functional tests succeeded + - uses: marocchino/sticky-pull-request-comment@v2 + if: failure() && env.PR_NUMBER != '' + continue-on-error: true + with: + GITHUB_TOKEN: ${{ steps.get_installation_token.outputs.token }} + header: teststatus-${{ github.run_id }} + number: ${{ env.PR_NUMBER }} + append: true + message: | + :x: ${{ matrix.name }} functional test failed. Please check [the logs](${{ env.ACTION_LINK }}) for more details + - uses: marocchino/sticky-pull-request-comment@v2 + if: cancelled() && env.PR_NUMBER != '' + continue-on-error: true + with: + GITHUB_TOKEN: ${{ steps.get_installation_token.outputs.token }} + header: teststatus-${{ github.run_id }} + number: ${{ env.PR_NUMBER }} + append: true + message: | + :x: ${{ matrix.name }} functional test cancelled. Please check [the logs](${{ env.ACTION_LINK }}) for more details From 22d69efce8d61eb03e723edeeabc56d95c3d6c94 Mon Sep 17 00:00:00 2001 From: Young Bu Park Date: Fri, 22 Mar 2024 15:13:04 -0700 Subject: [PATCH 04/19] Run temp functional test workflow every 20 mins (#7368) # Description This is to run functional test with retry workflow every 20 minutes. ## Type of change - This pull request is a minor refactor, code cleanup, test improvement, or other maintenance task and doesn't change the functionality of Radius (issue link optional). Signed-off-by: Young Bu Park --- .github/workflows/retry-functional-test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/retry-functional-test.yaml b/.github/workflows/retry-functional-test.yaml index 22140d331f..8ea3d89188 100644 --- a/.github/workflows/retry-functional-test.yaml +++ b/.github/workflows/retry-functional-test.yaml @@ -23,8 +23,8 @@ permissions: on: schedule: - # Run every hour - - cron: "0 1-23 * * *" + # Run every 20 minutes + - cron: "*/20 * * * *" env: # Go version From 28f73b7e71abc6c9ae7cf53515e9ab0676949878 Mon Sep 17 00:00:00 2001 From: Yetkin Timocin Date: Mon, 25 Mar 2024 12:05:43 -0700 Subject: [PATCH 05/19] Fixing the wrong message in workspace switch command (#7389) # Description Fixing the wrong message in the workspace switch command. ## Type of change - This pull request is a minor refactor, code cleanup, test improvement, or other maintenance task and doesn't change the functionality of Radius (issue link optional). Fixes: #7394 Signed-off-by: ytimocin --- pkg/cli/cmd/workspace/switch/switch.go | 2 +- pkg/cli/cmd/workspace/switch/switch_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/cli/cmd/workspace/switch/switch.go b/pkg/cli/cmd/workspace/switch/switch.go index 35a596f39d..abd96812b4 100644 --- a/pkg/cli/cmd/workspace/switch/switch.go +++ b/pkg/cli/cmd/workspace/switch/switch.go @@ -112,7 +112,7 @@ func (r *Runner) Run(ctx context.Context) error { } if strings.EqualFold(section.Default, r.WorkspaceName) { - r.Output.LogInfo("Default environment is already set to %v", r.WorkspaceName) + r.Output.LogInfo("Default workspace is already set to %v", r.WorkspaceName) return nil } diff --git a/pkg/cli/cmd/workspace/switch/switch_test.go b/pkg/cli/cmd/workspace/switch/switch_test.go index 92eaf31b90..b1ca95c578 100644 --- a/pkg/cli/cmd/workspace/switch/switch_test.go +++ b/pkg/cli/cmd/workspace/switch/switch_test.go @@ -109,7 +109,7 @@ func Test_Run(t *testing.T) { expected := []any{ output.LogOutput{ - Format: "Default environment is already set to %v", + Format: "Default workspace is already set to %v", Params: []any{"current-workspace"}, }, } From 166d8724411540bf1d5989bf37f6b2846ea92157 Mon Sep 17 00:00:00 2001 From: Young Bu Park Date: Mon, 25 Mar 2024 14:44:09 -0700 Subject: [PATCH 06/19] Randomize the id with GITHUB_RUN_NUMBER for scheduled test (#7392) # Description We generate unique id by concatenating GitHub Actions' system variables, hashing the string, and taking 10 characters. This way will reduce the chance to create multiple resource for the same PR. In scheduled test, the most of variables are same, so there is a little chance to face the conflicts. particularly, when resource group is being in progress triggered by the previous action runs like below failures. This change 1) adds GITHUB_RUN_NUMBER, which is updated for each action run, to the raw id before hashing and 2) adds the prefix to each hashed string to avoid the conflicts between different workflows. https://github.com/radius-project/radius/issues/7383 https://github.com/radius-project/radius/issues/7382 https://github.com/radius-project/radius/issues/7380 ## Type of change - This pull request is a minor refactor, code cleanup, test improvement, or other maintenance task and doesn't change the functionality of Radius (issue link optional). Fixes: #7388 --------- Signed-off-by: Young Bu Park --- .github/workflows/functional-test.yaml | 6 +++++- .github/workflows/long-running-azure.yaml | 6 +++++- .github/workflows/retry-functional-test.yaml | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/functional-test.yaml b/.github/workflows/functional-test.yaml index d7f2700d97..fcd8d6c11f 100644 --- a/.github/workflows/functional-test.yaml +++ b/.github/workflows/functional-test.yaml @@ -165,7 +165,11 @@ jobs: id: gen-id run: | BASE_STR="RADIUS|${GITHUB_SHA}|${GITHUB_SERVER_URL}|${GITHUB_REPOSITORY}|${GITHUB_RUN_ID}|${GITHUB_RUN_ATTEMPT}" - UNIQUE_ID=$(echo $BASE_STR | sha1sum | head -c 10) + if [ "$GITHUB_EVENT_NAME" == "schedule" ]; then + # Add run number to randomize unique id for scheduled runs. + BASE_STR="${GITHUB_RUN_NUMBER}|${BASE_STR}" + fi + UNIQUE_ID=func$(echo $BASE_STR | sha1sum | head -c 10) echo "REL_VERSION=pr-${UNIQUE_ID}" >> $GITHUB_ENV # Set output variables to be used in the other jobs diff --git a/.github/workflows/long-running-azure.yaml b/.github/workflows/long-running-azure.yaml index b633255c1c..797f8b7994 100644 --- a/.github/workflows/long-running-azure.yaml +++ b/.github/workflows/long-running-azure.yaml @@ -145,7 +145,11 @@ jobs: run: | if [ -z "${{ steps.skip-build.outputs.SKIP_BUILD }}" ]; then BASE_STR="RADIUS|${GITHUB_SHA}|${GITHUB_SERVER_URL}|${GITHUB_REPOSITORY}|${GITHUB_RUN_ID}|${GITHUB_RUN_ATTEMPT}" - UNIQUE_ID=$(echo $BASE_STR | sha1sum | head -c 10) + if [ "$GITHUB_EVENT_NAME" == "schedule" ]; then + # Add run number to randomize unique id for scheduled runs. + BASE_STR="${GITHUB_RUN_NUMBER}|${BASE_STR}" + fi + UNIQUE_ID=longr$(echo $BASE_STR | sha1sum | head -c 10) echo "REL_VERSION=pr-${UNIQUE_ID}" >> $GITHUB_ENV # Set output variables to be used in the other jobs diff --git a/.github/workflows/retry-functional-test.yaml b/.github/workflows/retry-functional-test.yaml index 8ea3d89188..dc624b7683 100644 --- a/.github/workflows/retry-functional-test.yaml +++ b/.github/workflows/retry-functional-test.yaml @@ -112,7 +112,11 @@ jobs: id: gen-id run: | BASE_STR="RADIUS|${GITHUB_SHA}|${GITHUB_SERVER_URL}|${GITHUB_REPOSITORY}|${GITHUB_RUN_ID}|${GITHUB_RUN_ATTEMPT}" - UNIQUE_ID=$(echo $BASE_STR | sha1sum | head -c 10) + if [ "$GITHUB_EVENT_NAME" == "schedule" ]; then + # Add run number to randomize unique id for scheduled runs. + BASE_STR="${GITHUB_RUN_NUMBER}|${BASE_STR}" + fi + UNIQUE_ID=retry$(echo $BASE_STR | sha1sum | head -c 10) echo "REL_VERSION=pr-${UNIQUE_ID}" >> $GITHUB_ENV # Set output variables to be used in the other jobs From dc8e1b216db22add24740e2e8c6b6adde6656645 Mon Sep 17 00:00:00 2001 From: vinayada1 <28875764+vinayada1@users.noreply.github.com> Date: Tue, 26 Mar 2024 16:07:18 -0700 Subject: [PATCH 07/19] Change test organization for shared tests. (#7227) # Description - Change test organization for shared tests. These tests are now organized under the corerp directory. - Separate cloud/non-cloud tests - Organize the corerp tests as per https://github.com/radius-project/design-notes/pull/35. There will be more PRs that will follow to re-org the other tests. ## Type of change - This pull request adds or changes features of Radius and has an approved issue (#6588 ). Fixes: Fixes part of https://github.com/radius-project/radius/issues/6588. This is a part of a multi-PR fix --------- Signed-off-by: vinayada1 <28875764+vinayada1@users.noreply.github.com> --- .github/workflows/functional-test.yaml | 2 +- .github/workflows/long-running-azure.yaml | 2 +- build/recipes.mk | 10 +- build/test.mk | 9 +- .../tests-naming-conventions.md | 2 +- .../cli/noncloud/cli_test.go | 37 +++--- .../corerp-resources-recipe-env.bicep | 2 +- .../cloud}/mechanics/aws_mechanics_test.go | 6 +- ...thcreateandwritepropertyupdate.step1.bicep | 0 ...thcreateandwritepropertyupdate.step2.bicep | 0 ...s-redeploy-withupdatedresource.step1.bicep | 0 ...s-redeploy-withupdatedresource.step2.bicep | 0 .../aws_multi_identifier_resource_test.go | 5 +- .../cloud}/resources/aws_s3_bucket_test.go | 9 +- .../resources/azure_connections_test.go | 6 +- .../corerp/cloud}/resources/extender_test.go | 73 +---------- .../resources/persistent_volume_test.go | 7 +- .../cloud/resources/recipe_terraform_test.go | 94 +++++++++++++++ .../corerp/cloud}/resources/storage_test.go | 5 +- .../testdata/aws-multi-identifier.bicep | 0 .../testdata/aws-s3-bucket-existing.bicep | 0 .../resources/testdata/aws-s3-bucket.bicep | 0 ...rp-azure-connection-database-service.bicep | 0 .../corerp-resources-container-workload.bicep | 0 ...erp-resources-extender-aws-s3-recipe.bicep | 2 +- ...erp-resources-terraform-azurestorage.bicep | 0 ...rerp-resources-volume-azure-keyvault.bicep | 0 .../corerp/noncloud}/api_test.go | 8 +- .../mechanics/k8s_extensibility_test.go | 4 +- .../noncloud}/mechanics/mechanics_test.go | 16 +-- ...corerp-mechanics-communication-cycle.bicep | 0 ...corerp-mechanics-invalid-resourceids.bicep | 2 +- .../corerp-mechanics-nestedmodules.bicep | 0 ...s-redeploy-withanotherresource.step1.bicep | 0 ...s-redeploy-withanotherresource.step2.bicep | 0 ...deploy-withtwoseparateresource.step1.bicep | 0 ...deploy-withtwoseparateresource.step2.bicep | 0 ...s-redeploy-withupdatedresource.step1.bicep | 0 ...s-redeploy-withupdatedresource.step2.bicep | 0 .../k8s-extensibility/connection-string.bicep | 0 .../k8s-extensibility/secret.input.yaml | 0 .../k8s-extensibility/secret.output.yaml | 0 .../k8s-extensibility/service.input.yaml | 0 ...erp-mechanics-nestedmodules-innerapp.bicep | 0 ...erp-mechanics-nestedmodules-outerapp.bicep | 0 .../resources/application_environment_test.go | 6 +- .../noncloud}/resources/application_test.go | 12 +- .../resources/container_runtimes_test.go | 14 +-- .../noncloud}/resources/container_test.go | 20 +-- .../resources/container_versioning_test.go | 8 +- .../noncloud}/resources/environment_test.go | 4 +- .../noncloud/resources/extender_test.go | 95 +++++++++++++++ .../noncloud}/resources/gateway_test.go | 18 +-- .../resources/kubemetadata_cascade_test.go | 6 +- .../resources/kubemetadata_container_test.go | 6 +- .../resources/kubemetadata_gateway_test.go | 6 +- .../noncloud}/resources/recipe_bicep_test.go | 22 ++-- .../resources/recipe_terraform_test.go | 114 +++--------------- .../corerp/noncloud}/resources/recipe_test.go | 4 +- .../resources/simulated_environment_test.go | 6 +- ...sources-friendly-container-version-1.bicep | 0 ...sources-friendly-container-version-2.bicep | 0 .../corerp-azure-container-manualscale.bicep | 0 .../testdata/corerp-resources-app-env.bicep | 0 ...orerp-resources-application-graph-out.json | 0 .../corerp-resources-application-graph.bicep | 0 .../corerp-resources-application.bicep | 0 ...-resources-container-bad-healthprobe.bicep | 0 .../corerp-resources-container-cmd-args.bicep | 0 ...sources-container-liveness-readiness.bicep | 0 ...resources-container-manifest-sidecar.bicep | 0 .../corerp-resources-container-manifest.bicep | 0 ...ltiple-containers-multiple-ports-dns.bicep | 0 ...p-resources-container-multiple-ports.bicep | 0 ...ontainer-nonexistent-container-image.bicep | 0 ...urces-container-optional-port-scheme.bicep | 0 ...erp-resources-container-pod-patching.bicep | 0 ...sources-container-single-dns-request.bicep | 0 ...ontainer-single-dns-service-creation.bicep | 0 ...sources-container-two-containers-dns.bicep | 0 .../testdata/corerp-resources-container.bicep | 0 .../corerp-resources-environment.bicep | 0 .../corerp-resources-extender-recipe.bicep | 2 +- .../testdata/corerp-resources-extender.bicep | 0 .../corerp-resources-gateway-dns.bicep | 0 .../corerp-resources-gateway-failure.bicep | 0 ...resources-gateway-kubernetesmetadata.bicep | 0 ...erp-resources-gateway-sslpassthrough.bicep | 0 ...erp-resources-gateway-tlstermination.bicep | 0 ...sources-httproute-kubernetesmetadata.bicep | 0 ...orerp-resources-kubemetadata-cascade.bicep | 0 ...erp-resources-kubemetadata-container.bicep | 0 ...-recipe-bicep-resourcecreation.step0.bicep | 2 +- ...-recipe-bicep-resourcecreation.step1.bicep | 0 .../corerp-resources-recipe-bicep.bicep | 2 +- .../corerp-resources-recipe-notfound.bicep | 0 .../corerp-resources-simulatedenv.bicep | 0 .../corerp-resources-terraform-context.bicep | 0 ...resources-terraform-recipe-terraform.bicep | 0 .../corerp-resources-terraform-redis.bicep | 0 .../testdata/manifest/basemanifest.yaml | 0 .../resources/testdata/manifest/sidecar.yaml | 0 .../parameters/test-tls-cert.parameters.json | 0 test/functional-portable/corerp/util.go | 65 ++++++++++ .../daprrp/noncloud/resources/common.go | 4 +- .../dapr_component_name_conflict_test.go | 6 +- .../noncloud/resources/dapr_pubsub_test.go | 14 +-- .../resources/dapr_secretstore_test.go | 18 +-- .../resources/dapr_serviceinvocation_test.go | 6 +- .../resources/dapr_statestore_test.go | 14 +-- ...aprrp-resources-pubsub-broker-manual.bicep | 2 +- ...aprrp-resources-pubsub-broker-recipe.bicep | 2 +- .../daprrp-resources-secretstore-recipe.bicep | 2 +- .../daprrp-resources-statestore-manual.bicep | 2 +- .../daprrp-resources-statestore-recipe.bicep | 2 +- .../cloud/resources/microsoftsql_test.go | 6 +- .../noncloud/resources/mongodb_test.go | 6 +- .../noncloud/resources/redis_test.go | 12 +- .../resources/simulated_environment_test.go | 6 +- .../noncloud/resources/sql_test.go | 6 +- ...srp-resources-mongodb-recipe-context.bicep | 2 +- ...atastoresrp-resources-mongodb-recipe.bicep | 2 +- ...resrp-resources-redis-default-recipe.bicep | 2 +- .../datastoresrp-resources-redis-recipe.bicep | 2 +- ...oresrp-resources-simulatedenv-recipe.bicep | 2 +- .../datastoresrp-resources-sqldb-recipe.bicep | 2 +- .../kubernetes/noncloud/kubernetes_test.go | 4 +- .../testdata/tutorial-environment.bicep | 2 +- .../noncloud/resources/rabbitmq_test.go | 6 +- .../msgrp-resources-rabbitmq-recipe.bicep | 2 +- .../testdata/tutorial-environment.bicep | 2 +- .../samples/noncloud/tutorial_test.go | 8 +- .../ucp/noncloud/tracked_resource_test.go | 4 +- test/functional/README.md | 3 - .../resources/kubemetadata_httproute_test.go | 90 -------------- test/functional/shared/test.go | 105 ---------------- test/{functional/shared => rp}/rptest.go | 81 ++++++++++++- .../modules/redis-selfhost.bicep | 0 .../test-bicep-recipes/README.md | 2 +- .../_resource-creation.bicep | 0 .../context-parameter.bicep | 0 .../corerp-redis-recipe.bicep | 0 .../dapr-pubsub-broker.bicep | 2 +- .../dapr-secret-store.bicep | 0 .../test-bicep-recipes/dapr-state-store.bicep | 2 +- .../test-bicep-recipes/empty-recipe.bicep | 0 .../test-bicep-recipes/extender-recipe.bicep | 0 .../extenders-aws-s3-recipe.bicep | 0 .../test-bicep-recipes/language-failure.bicep | 0 .../mongodb-recipe-context.bicep | 0 .../mongodb-recipe-kubernetes.bicep | 0 .../parameters-outputs.bicep | 0 .../test-bicep-recipes/rabbitmq-recipe.bicep | 0 .../redis-recipe-value-backed.bicep | 0 .../resource-creation-failure.bicep | 0 .../resource-creation.bicep | 0 .../test-bicep-recipes/sqldb-recipe.bicep | 0 .../test-bicep-recipes/wrong-output.bicep | 0 .../test-terraform-recipes/README.md | 0 .../azure-storage}/azure-storage/main.tf | 0 .../azure-storage}/azure-storage/output.tf | 0 .../azure-storage}/azure-storage/variables.tf | 0 .../azure-storage/main.tf | 32 +++++ .../azure-storage/output.tf | 5 + .../azure-storage/variables.tf | 7 ++ .../k8ssecret-context/main.tf | 0 .../k8ssecret-context/variables.tf | 0 .../kubernetes-redis/modules/main.tf | 0 .../kubernetes-redis/modules/variables.tf | 0 .../parameter-outputs/output.tf | 0 .../parameter-outputs/variables.tf | 0 .../wrong-output/output.tf | 0 172 files changed, 613 insertions(+), 577 deletions(-) rename test/{functional/shared => functional-portable/corerp/cloud}/mechanics/aws_mechanics_test.go (94%) rename test/{functional/shared => functional-portable/corerp/cloud}/mechanics/testdata/aws-mechanics-redeploy-withcreateandwritepropertyupdate.step1.bicep (100%) rename test/{functional/shared => functional-portable/corerp/cloud}/mechanics/testdata/aws-mechanics-redeploy-withcreateandwritepropertyupdate.step2.bicep (100%) rename test/{functional/shared => functional-portable/corerp/cloud}/mechanics/testdata/aws-mechanics-redeploy-withupdatedresource.step1.bicep (100%) rename test/{functional/shared => functional-portable/corerp/cloud}/mechanics/testdata/aws-mechanics-redeploy-withupdatedresource.step2.bicep (100%) rename test/{functional/shared => functional-portable/corerp/cloud}/resources/aws_multi_identifier_resource_test.go (92%) rename test/{functional/shared => functional-portable/corerp/cloud}/resources/aws_s3_bucket_test.go (93%) rename test/{functional/shared => functional-portable/corerp/cloud}/resources/azure_connections_test.go (91%) rename test/{functional/shared => functional-portable/corerp/cloud}/resources/extender_test.go (62%) rename test/{functional/shared => functional-portable/corerp/cloud}/resources/persistent_volume_test.go (90%) create mode 100644 test/functional-portable/corerp/cloud/resources/recipe_terraform_test.go rename test/{functional/shared => functional-portable/corerp/cloud}/resources/storage_test.go (92%) rename test/{functional/shared => functional-portable/corerp/cloud}/resources/testdata/aws-multi-identifier.bicep (100%) rename test/{functional/shared => functional-portable/corerp/cloud}/resources/testdata/aws-s3-bucket-existing.bicep (100%) rename test/{functional/shared => functional-portable/corerp/cloud}/resources/testdata/aws-s3-bucket.bicep (100%) rename test/{functional/shared => functional-portable/corerp/cloud}/resources/testdata/corerp-azure-connection-database-service.bicep (100%) rename test/{functional/shared => functional-portable/corerp/cloud}/resources/testdata/corerp-resources-container-workload.bicep (100%) rename test/{functional/shared => functional-portable/corerp/cloud}/resources/testdata/corerp-resources-extender-aws-s3-recipe.bicep (93%) rename test/{functional/shared => functional-portable/corerp/cloud}/resources/testdata/corerp-resources-terraform-azurestorage.bicep (100%) rename test/{functional/shared => functional-portable/corerp/cloud}/resources/testdata/corerp-resources-volume-azure-keyvault.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/api_test.go (97%) rename test/{functional/shared => functional-portable/corerp/noncloud}/mechanics/k8s_extensibility_test.go (94%) rename test/{functional/shared => functional-portable/corerp/noncloud}/mechanics/mechanics_test.go (95%) rename test/{functional/shared => functional-portable/corerp/noncloud}/mechanics/testdata/corerp-mechanics-communication-cycle.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/mechanics/testdata/corerp-mechanics-invalid-resourceids.bicep (94%) rename test/{functional/shared => functional-portable/corerp/noncloud}/mechanics/testdata/corerp-mechanics-nestedmodules.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/mechanics/testdata/corerp-mechanics-redeploy-withanotherresource.step1.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/mechanics/testdata/corerp-mechanics-redeploy-withanotherresource.step2.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/mechanics/testdata/corerp-mechanics-redeploy-withtwoseparateresource.step1.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/mechanics/testdata/corerp-mechanics-redeploy-withtwoseparateresource.step2.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/mechanics/testdata/corerp-mechanics-redeploy-withupdatedresource.step1.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/mechanics/testdata/corerp-mechanics-redeploy-withupdatedresource.step2.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/mechanics/testdata/k8s-extensibility/connection-string.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/mechanics/testdata/k8s-extensibility/secret.input.yaml (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/mechanics/testdata/k8s-extensibility/secret.output.yaml (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/mechanics/testdata/k8s-extensibility/service.input.yaml (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/mechanics/testdata/modules/corerp-mechanics-nestedmodules-innerapp.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/mechanics/testdata/modules/corerp-mechanics-nestedmodules-outerapp.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/application_environment_test.go (93%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/application_test.go (92%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/container_runtimes_test.go (96%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/container_test.go (94%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/container_versioning_test.go (95%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/environment_test.go (91%) create mode 100644 test/functional-portable/corerp/noncloud/resources/extender_test.go rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/gateway_test.go (95%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/kubemetadata_cascade_test.go (97%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/kubemetadata_container_test.go (95%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/kubemetadata_gateway_test.go (94%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/recipe_bicep_test.go (96%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/recipe_terraform_test.go (76%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/recipe_test.go (94%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/simulated_environment_test.go (92%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/containers/corerp-resources-friendly-container-version-1.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/containers/corerp-resources-friendly-container-version-2.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-azure-container-manualscale.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-app-env.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-application-graph-out.json (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-application-graph.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-application.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-container-bad-healthprobe.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-container-cmd-args.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-container-liveness-readiness.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-container-manifest-sidecar.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-container-manifest.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-container-multiple-containers-multiple-ports-dns.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-container-multiple-ports.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-container-nonexistent-container-image.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-container-optional-port-scheme.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-container-pod-patching.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-container-single-dns-request.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-container-single-dns-service-creation.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-container-two-containers-dns.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-container.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-environment.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-extender-recipe.bicep (92%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-extender.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-gateway-dns.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-gateway-failure.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-gateway-kubernetesmetadata.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-gateway-sslpassthrough.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-gateway-tlstermination.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-httproute-kubernetesmetadata.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-kubemetadata-cascade.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-kubemetadata-container.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-recipe-bicep-resourcecreation.step0.bicep (94%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-recipe-bicep-resourcecreation.step1.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-recipe-bicep.bicep (94%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-recipe-notfound.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-simulatedenv.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-terraform-context.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-terraform-recipe-terraform.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/corerp-resources-terraform-redis.bicep (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/manifest/basemanifest.yaml (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/manifest/sidecar.yaml (100%) rename test/{functional/shared => functional-portable/corerp/noncloud}/resources/testdata/parameters/test-tls-cert.parameters.json (100%) create mode 100644 test/functional-portable/corerp/util.go delete mode 100644 test/functional/README.md delete mode 100644 test/functional/shared/resources/kubemetadata_httproute_test.go delete mode 100644 test/functional/shared/test.go rename test/{functional/shared => rp}/rptest.go (82%) rename test/{functional/shared/resources/testdata => testrecipes}/modules/redis-selfhost.bicep (100%) rename test/{functional/shared/resources/testdata/recipes => testrecipes}/test-bicep-recipes/README.md (83%) rename test/{functional/shared/resources/testdata/recipes => testrecipes}/test-bicep-recipes/_resource-creation.bicep (100%) rename test/{functional/shared/resources/testdata/recipes => testrecipes}/test-bicep-recipes/context-parameter.bicep (100%) rename test/{functional/shared/resources/testdata/recipes => testrecipes}/test-bicep-recipes/corerp-redis-recipe.bicep (100%) rename test/{functional/shared/resources/testdata/recipes => testrecipes}/test-bicep-recipes/dapr-pubsub-broker.bicep (92%) rename test/{functional/shared/resources/testdata/recipes => testrecipes}/test-bicep-recipes/dapr-secret-store.bicep (100%) rename test/{functional/shared/resources/testdata/recipes => testrecipes}/test-bicep-recipes/dapr-state-store.bicep (92%) rename test/{functional/shared/resources/testdata/recipes => testrecipes}/test-bicep-recipes/empty-recipe.bicep (100%) rename test/{functional/shared/resources/testdata/recipes => testrecipes}/test-bicep-recipes/extender-recipe.bicep (100%) rename test/{functional/shared/resources/testdata/recipes => testrecipes}/test-bicep-recipes/extenders-aws-s3-recipe.bicep (100%) rename test/{functional/shared/resources/testdata/recipes => testrecipes}/test-bicep-recipes/language-failure.bicep (100%) rename test/{functional/shared/resources/testdata/recipes => testrecipes}/test-bicep-recipes/mongodb-recipe-context.bicep (100%) rename test/{functional/shared/resources/testdata/recipes => testrecipes}/test-bicep-recipes/mongodb-recipe-kubernetes.bicep (100%) rename test/{functional/shared/resources/testdata/recipes => testrecipes}/test-bicep-recipes/parameters-outputs.bicep (100%) rename test/{functional/shared/resources/testdata/recipes => testrecipes}/test-bicep-recipes/rabbitmq-recipe.bicep (100%) rename test/{functional/shared/resources/testdata/recipes => testrecipes}/test-bicep-recipes/redis-recipe-value-backed.bicep (100%) rename test/{functional/shared/resources/testdata/recipes => testrecipes}/test-bicep-recipes/resource-creation-failure.bicep (100%) rename test/{functional/shared/resources/testdata/recipes => testrecipes}/test-bicep-recipes/resource-creation.bicep (100%) rename test/{functional/shared/resources/testdata/recipes => testrecipes}/test-bicep-recipes/sqldb-recipe.bicep (100%) rename test/{functional/shared/resources/testdata/recipes => testrecipes}/test-bicep-recipes/wrong-output.bicep (100%) rename test/{functional/shared/resources/testdata/recipes => testrecipes}/test-terraform-recipes/README.md (100%) rename test/{functional/shared/resources/testdata/recipes/test-terraform-recipes => testrecipes/test-terraform-recipes/azure-storage}/azure-storage/main.tf (100%) rename test/{functional/shared/resources/testdata/recipes/test-terraform-recipes => testrecipes/test-terraform-recipes/azure-storage}/azure-storage/output.tf (100%) rename test/{functional/shared/resources/testdata/recipes/test-terraform-recipes => testrecipes/test-terraform-recipes/azure-storage}/azure-storage/variables.tf (100%) create mode 100644 test/testrecipes/test-terraform-recipes/azure-storage/main.tf create mode 100644 test/testrecipes/test-terraform-recipes/azure-storage/output.tf create mode 100644 test/testrecipes/test-terraform-recipes/azure-storage/variables.tf rename test/{functional/shared/resources/testdata/recipes => testrecipes}/test-terraform-recipes/k8ssecret-context/main.tf (100%) rename test/{functional/shared/resources/testdata/recipes => testrecipes}/test-terraform-recipes/k8ssecret-context/variables.tf (100%) rename test/{functional/shared/resources/testdata/recipes => testrecipes}/test-terraform-recipes/kubernetes-redis/modules/main.tf (100%) rename test/{functional/shared/resources/testdata/recipes => testrecipes}/test-terraform-recipes/kubernetes-redis/modules/variables.tf (100%) rename test/{functional/shared/resources/testdata/recipes => testrecipes}/test-terraform-recipes/parameter-outputs/output.tf (100%) rename test/{functional/shared/resources/testdata/recipes => testrecipes}/test-terraform-recipes/parameter-outputs/variables.tf (100%) rename test/{functional/shared/resources/testdata/recipes => testrecipes}/test-terraform-recipes/wrong-output/output.tf (100%) diff --git a/.github/workflows/functional-test.yaml b/.github/workflows/functional-test.yaml index fcd8d6c11f..58d9de7444 100644 --- a/.github/workflows/functional-test.yaml +++ b/.github/workflows/functional-test.yaml @@ -211,7 +211,7 @@ jobs: * Dapr: ${{ env.DAPR_VER }} * Azure KeyVault CSI driver: ${{ env.AZURE_KEYVAULT_CSI_DRIVER_VER }} * Azure Workload identity webhook: ${{ env.AZURE_WORKLOAD_IDENTITY_WEBHOOK_VER }} - * Bicep recipe location `${{ env.BICEP_RECIPE_REGISTRY }}/test/functional/shared/recipes/:${{ env.REL_VERSION }}` + * Bicep recipe location `${{ env.BICEP_RECIPE_REGISTRY }}/test/testrecipes/test-bicep-recipes/:${{ env.REL_VERSION }}` * Terraform recipe location `${{ env.TF_RECIPE_MODULE_SERVER_URL }}/.zip` (in cluster) * applications-rp test image location: `${{ env.CONTAINER_REGISTRY }}/applications-rp:${{ env.REL_VERSION }}` * controller test image location: `${{ env.CONTAINER_REGISTRY }}/controller:${{ env.REL_VERSION }}` diff --git a/.github/workflows/long-running-azure.yaml b/.github/workflows/long-running-azure.yaml index 797f8b7994..1c3710c300 100644 --- a/.github/workflows/long-running-azure.yaml +++ b/.github/workflows/long-running-azure.yaml @@ -197,7 +197,7 @@ jobs: Click here to see the list of tools in the current test run * gotestsum ${{ env.GOTESTSUM_VER }} - * Bicep recipe location `${{ env.BICEP_RECIPE_REGISTRY }}/test/functional/shared/recipes/:${{ steps.gen-id.outputs.REL_VERSION }}` + * Bicep recipe location `${{ env.BICEP_RECIPE_REGISTRY }}/test/testrecipes/test-bicep-recipes/:${{ steps.gen-id.outputs.REL_VERSION }}` * Terraform recipe location `${{ env.TF_RECIPE_MODULE_SERVER_URL }}/.zip` (in cluster) * applications-rp test image location: `${{ env.CONTAINER_REGISTRY }}/applications-rp:${{ steps.gen-id.outputs.REL_VERSION }}` * controller test image location: `${{ env.CONTAINER_REGISTRY }}/controller:${{ steps.gen-id.outputs.REL_VERSION }}` diff --git a/build/recipes.mk b/build/recipes.mk index dcda7766bb..60173f8a4f 100644 --- a/build/recipes.mk +++ b/build/recipes.mk @@ -27,10 +27,10 @@ TERRAFORM_MODULE_CONFIGMAP_NAME=tf-module-server-content publish-test-bicep-recipes: ## Publishes test recipes to with version @if [ -z "$(BICEP_RECIPE_REGISTRY)" ]; then echo "Error: BICEP_RECIPE_REGISTRY must be set to a valid OCI registry"; exit 1; fi - @echo "$(ARROW) Publishing Bicep test recipes from ./test/functional/shared/resources/testdata/recipes/test-bicep-recipes..." + @echo "$(ARROW) Publishing Bicep test recipes from ./test/testrecipes/test-bicep-recipes..." ./.github/scripts/publish-recipes.sh \ - ./test/functional/shared/resources/testdata/recipes/test-bicep-recipes \ - ${BICEP_RECIPE_REGISTRY}/test/functional/shared/recipes \ + ./test/testrecipes/test-bicep-recipes \ + ${BICEP_RECIPE_REGISTRY}/test/testrecipes/test-bicep-recipes \ ${BICEP_RECIPE_TAG_VERSION} .PHONY: publish-test-terraform-recipes @@ -38,9 +38,9 @@ publish-test-terraform-recipes: ## Publishes test terraform recipes to the curre @echo "$(ARROW) Creating Kubernetes namespace $(TERRAFORM_MODULE_SERVER_NAMESPACE)..." kubectl create namespace $(TERRAFORM_MODULE_SERVER_NAMESPACE) --dry-run=client -o yaml | kubectl apply -f - - @echo "$(ARROW) Publishing Terraform test recipes from ./test/functional/shared/resources/testdata/recipes/test-terraform-recipes..." + @echo "$(ARROW) Publishing Terraform test recipes from ./test/testrecipes/test-terraform-recipes..." ./.github/scripts/publish-test-terraform-recipes.py \ - ./test/functional/shared/resources/testdata/recipes/test-terraform-recipes \ + ./test/testrecipes/test-terraform-recipes \ $(TERRAFORM_MODULE_SERVER_NAMESPACE) \ $(TERRAFORM_MODULE_CONFIGMAP_NAME) diff --git a/build/test.mk b/build/test.mk index 6dc4cf98d4..9c9741a1da 100644 --- a/build/test.mk +++ b/build/test.mk @@ -74,8 +74,13 @@ test-functional-kubernetes: test-functional-kubernetes-noncloud ## Runs all Kube test-functional-kubernetes-noncloud: ## Runs Kubernetes functional tests that do not require cloud resources CGO_ENABLED=1 $(GOTEST_TOOL) ./test/functional-portable/kubernetes/noncloud/... -timeout ${TEST_TIMEOUT} -v -parallel 5 $(GOTEST_OPTS) -test-functional-shared: ## Runs shared functional tests - CGO_ENABLED=1 $(GOTEST_TOOL) ./test/functional/shared/... -timeout ${TEST_TIMEOUT} -v -parallel 10 $(GOTEST_OPTS) +test-functional-shared: test-functional-corerp-noncloud test-functional-corerp-cloud ## Runs all Core RP functional tests (both cloud and non-cloud) + +test-functional-corerp-noncloud: ## Runs corerp functional tests that do not require cloud resources + CGO_ENABLED=1 $(GOTEST_TOOL) ./test/functional-portable/corerp/noncloud/... -timeout ${TEST_TIMEOUT} -v -parallel 10 $(GOTEST_OPTS) + +test-functional-corerp-cloud: ## Runs corerp functional tests that require cloud resources + CGO_ENABLED=1 $(GOTEST_TOOL) ./test/functional-portable/corerp/cloud/... -timeout ${TEST_TIMEOUT} -v -parallel 10 $(GOTEST_OPTS) test-functional-msgrp: test-functional-msgrp-noncloud ## Runs all Messaging RP functional tests (both cloud and non-cloud) diff --git a/docs/contributing/contributing-code/contributing-code-tests/tests-naming-conventions.md b/docs/contributing/contributing-code/contributing-code-tests/tests-naming-conventions.md index 231ca9260c..e3eeb76c6a 100644 --- a/docs/contributing/contributing-code/contributing-code-tests/tests-naming-conventions.md +++ b/docs/contributing/contributing-code/contributing-code-tests/tests-naming-conventions.md @@ -1,5 +1,5 @@ # Radius functional test naming conventions -Today, the [functional tests](https://github.com/radius-project/radius/tree/main/test/functional/shared/resources) use some abbreviations to make sure that the resource labels will not exceed 63 characters (application + resource name). Here are a list of some of the abbreviations and patterns: +Today, the [functional tests](https://github.com/radius-project/radius/tree/main/test/functional-portable/corerp/resources) use some abbreviations to make sure that the resource labels will not exceed 63 characters (application + resource name). Here are a list of some of the abbreviations and patterns: |Keyword|Abbreviation| |-|-| diff --git a/test/functional-portable/cli/noncloud/cli_test.go b/test/functional-portable/cli/noncloud/cli_test.go index 981530cab3..bc4fe05f84 100644 --- a/test/functional-portable/cli/noncloud/cli_test.go +++ b/test/functional-portable/cli/noncloud/cli_test.go @@ -44,8 +44,9 @@ import ( "github.com/radius-project/radius/pkg/corerp/api/v20231001preview" "github.com/radius-project/radius/pkg/ucp/resources" "github.com/radius-project/radius/pkg/version" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/radcli" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/testcontext" "github.com/radius-project/radius/test/testutil" @@ -59,21 +60,21 @@ const ( retries = 10 ) -func verifyRecipeCLI(ctx context.Context, t *testing.T, test shared.RPTest) { - options := shared.NewRPTestOptions(t) +func verifyRecipeCLI(ctx context.Context, t *testing.T, test rp.RPTest) { + options := rp.NewRPTestOptions(t) cli := radcli.NewCLI(t, options.ConfigFilePath) envName := test.Steps[0].RPResources.Resources[0].Name registry := strings.TrimPrefix(testutil.GetBicepRecipeRegistry(), "registry=") version := strings.TrimPrefix(testutil.GetBicepRecipeVersion(), "version=") resourceType := "Applications.Datastores/redisCaches" - file := "../../../functional/shared/resources/testdata/recipes/test-bicep-recipes/corerp-redis-recipe.bicep" + file := "../../../testrecipes/test-bicep-recipes/corerp-redis-recipe.bicep" target := fmt.Sprintf("br:ghcr.io/radius-project/dev/test-bicep-recipes/redis-recipe:%s", generateUniqueTag()) recipeName := "recipeName" recipeTemplate := fmt.Sprintf("%s/recipes/local-dev/rediscaches:%s", registry, version) bicepRecipe := "recipe1" - bicepRecipeTemplate := fmt.Sprintf("%s/test/functional/shared/recipes/corerp-redis-recipe:%s", registry, version) + bicepRecipeTemplate := fmt.Sprintf("%s/test/testrecipes/test-bicep-recipes/corerp-redis-recipe:%s", registry, version) templateKindBicep := "bicep" terraformRecipe := "recipe2" @@ -155,8 +156,8 @@ func verifyRecipeCLI(ctx context.Context, t *testing.T, test shared.RPTest) { }) } -func verifyCLIBasics(ctx context.Context, t *testing.T, test shared.RPTest) { - options := shared.NewRPTestOptions(t) +func verifyCLIBasics(ctx context.Context, t *testing.T, test rp.RPTest) { + options := rp.NewRPTestOptions(t) cli := radcli.NewCLI(t, options.ConfigFilePath) appName := test.Name containerName := "containerA" @@ -280,7 +281,7 @@ func Test_Run_Logger(t *testing.T) { // Will be used to cancel `rad run` ctx, cancel := testcontext.NewWithCancel(t) t.Cleanup(cancel) - options := shared.NewRPTestOptions(t) + options := rp.NewRPTestOptions(t) template := "testdata/corerp-kubernetes-cli-run.bicep" applicationName := "cli-run-logger" @@ -354,7 +355,7 @@ func Test_Run_Portforward(t *testing.T) { // Will be used to cancel `rad run` ctx, cancel := testcontext.NewWithCancel(t) t.Cleanup(cancel) - options := shared.NewRPTestOptions(t) + options := rp.NewRPTestOptions(t) template := "testdata/corerp-kubernetes-cli-run-portforward.bicep" applicationName := "cli-run-portforward" @@ -453,7 +454,7 @@ func Test_CLI(t *testing.T) { template := "testdata/corerp-kubernetes-cli.bicep" name := "kubernetes-cli" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage()), RPResources: &validation.RPResourceSet{ @@ -493,7 +494,7 @@ func Test_CLI_JSON(t *testing.T) { template := "testdata/corerp-kubernetes-cli.json" name := "kubernetes-cli-json" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage()), RPResources: &validation.RPResourceSet{ @@ -533,7 +534,7 @@ func Test_CLI_Delete(t *testing.T) { ctx, cancel := testcontext.NewWithCancel(t) t.Cleanup(cancel) - options := shared.NewRPTestOptions(t) + options := rp.NewRPTestOptions(t) appName := "kubernetes-cli-with-resources" appNameUnassociatedResources := "kubernetes-cli-with-unassociated-resources" appNameEmptyResources := "kubernetes-cli-empty-resources" @@ -631,7 +632,7 @@ func Test_CLI_DeploymentParameters(t *testing.T) { // corerp-kubernetes-cli-parameters.parameters.json uses ghcr.io/radius-project/dev as a registry parameter. // Use the specified tag only if the test uses ghcr.io/radius-project/dev registry. Otherwise, use latest tag. - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, "@"+parameterFilePath, testutil.GetMagpieTag()), RPResources: &validation.RPResourceSet{ @@ -670,7 +671,7 @@ func Test_CLI_version(t *testing.T) { ctx, cancel := testcontext.NewWithCancel(t) t.Cleanup(cancel) - options := shared.NewTestOptions(t) + options := rp.NewTestOptions(t) cli := radcli.NewCLI(t, options.ConfigFilePath) output, err := cli.Version(ctx) @@ -691,7 +692,7 @@ func Test_CLI_Only_version(t *testing.T) { ctx, cancel := testcontext.NewWithCancel(t) t.Cleanup(cancel) - options := shared.NewTestOptions(t) + options := rp.NewTestOptions(t) cli := radcli.NewCLI(t, options.ConfigFilePath) output, err := cli.CliVersion(ctx) @@ -709,7 +710,7 @@ func Test_RecipeCommands(t *testing.T) { template := "testdata/corerp-resources-recipe-env.bicep" name := "corerp-resources-recipe-env" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetBicepRecipeRegistry(), testutil.GetBicepRecipeVersion()), RPResources: &validation.RPResourceSet{ @@ -735,7 +736,7 @@ func Test_DevRecipes(t *testing.T) { ctx, cancel := testcontext.NewWithCancel(t) t.Cleanup(cancel) - options := shared.NewTestOptions(t) + options := rp.NewTestOptions(t) cli := radcli.NewCLI(t, options.ConfigFilePath) envName := "test-dev-recipes" @@ -797,7 +798,7 @@ func GetAvailablePort() (int, error) { // DeleteAppWithoutDeletingResources creates a client to delete an application without deleting its resources and returns // an error if one occurs. -func DeleteAppWithoutDeletingResources(t *testing.T, ctx context.Context, options shared.RPTestOptions, applicationName string) error { +func DeleteAppWithoutDeletingResources(t *testing.T, ctx context.Context, options rp.RPTestOptions, applicationName string) error { client := options.ManagementClient require.IsType(t, client, &clients.UCPApplicationsManagementClient{}) appManagementClient := client.(*clients.UCPApplicationsManagementClient) diff --git a/test/functional-portable/cli/noncloud/testdata/corerp-resources-recipe-env.bicep b/test/functional-portable/cli/noncloud/testdata/corerp-resources-recipe-env.bicep index 359b58fccc..9076ae069c 100644 --- a/test/functional-portable/cli/noncloud/testdata/corerp-resources-recipe-env.bicep +++ b/test/functional-portable/cli/noncloud/testdata/corerp-resources-recipe-env.bicep @@ -20,7 +20,7 @@ resource env 'Applications.Core/environments@2023-10-01-preview' = { 'Applications.Datastores/redisCaches':{ recipe1: { templateKind: 'bicep' - templatePath: '${registry}/test/functional/shared/recipes/corerp-redis-recipe:${version}' + templatePath: '${registry}/test/testrecipes/test-bicep-recipes/corerp-redis-recipe:${version}' } recipe2: { templateKind: 'terraform' diff --git a/test/functional/shared/mechanics/aws_mechanics_test.go b/test/functional-portable/corerp/cloud/mechanics/aws_mechanics_test.go similarity index 94% rename from test/functional/shared/mechanics/aws_mechanics_test.go rename to test/functional-portable/corerp/cloud/mechanics/aws_mechanics_test.go index ccc392e600..a8384255eb 100644 --- a/test/functional/shared/mechanics/aws_mechanics_test.go +++ b/test/functional-portable/corerp/cloud/mechanics/aws_mechanics_test.go @@ -21,7 +21,7 @@ import ( "testing" "github.com/google/uuid" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/testutil" "github.com/radius-project/radius/test/validation" @@ -32,7 +32,7 @@ func Test_AWSRedeployWithUpdatedResourceUpdatesResource(t *testing.T) { name := "radiusfunctionaltestbucket-" + uuid.New().String() creationTimestamp := testutil.GetCreationTimestamp() - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(fmt.Sprintf(templateFmt, 1), "bucketName="+name, "creationTimestamp="+creationTimestamp), SkipKubernetesOutputResourceValidation: true, @@ -89,5 +89,7 @@ func Test_AWSRedeployWithUpdatedResourceUpdatesResource(t *testing.T) { }, }, }) + + test.RequiredFeatures = []rp.RequiredFeature{rp.FeatureAWS} test.Test(t) } diff --git a/test/functional/shared/mechanics/testdata/aws-mechanics-redeploy-withcreateandwritepropertyupdate.step1.bicep b/test/functional-portable/corerp/cloud/mechanics/testdata/aws-mechanics-redeploy-withcreateandwritepropertyupdate.step1.bicep similarity index 100% rename from test/functional/shared/mechanics/testdata/aws-mechanics-redeploy-withcreateandwritepropertyupdate.step1.bicep rename to test/functional-portable/corerp/cloud/mechanics/testdata/aws-mechanics-redeploy-withcreateandwritepropertyupdate.step1.bicep diff --git a/test/functional/shared/mechanics/testdata/aws-mechanics-redeploy-withcreateandwritepropertyupdate.step2.bicep b/test/functional-portable/corerp/cloud/mechanics/testdata/aws-mechanics-redeploy-withcreateandwritepropertyupdate.step2.bicep similarity index 100% rename from test/functional/shared/mechanics/testdata/aws-mechanics-redeploy-withcreateandwritepropertyupdate.step2.bicep rename to test/functional-portable/corerp/cloud/mechanics/testdata/aws-mechanics-redeploy-withcreateandwritepropertyupdate.step2.bicep diff --git a/test/functional/shared/mechanics/testdata/aws-mechanics-redeploy-withupdatedresource.step1.bicep b/test/functional-portable/corerp/cloud/mechanics/testdata/aws-mechanics-redeploy-withupdatedresource.step1.bicep similarity index 100% rename from test/functional/shared/mechanics/testdata/aws-mechanics-redeploy-withupdatedresource.step1.bicep rename to test/functional-portable/corerp/cloud/mechanics/testdata/aws-mechanics-redeploy-withupdatedresource.step1.bicep diff --git a/test/functional/shared/mechanics/testdata/aws-mechanics-redeploy-withupdatedresource.step2.bicep b/test/functional-portable/corerp/cloud/mechanics/testdata/aws-mechanics-redeploy-withupdatedresource.step2.bicep similarity index 100% rename from test/functional/shared/mechanics/testdata/aws-mechanics-redeploy-withupdatedresource.step2.bicep rename to test/functional-portable/corerp/cloud/mechanics/testdata/aws-mechanics-redeploy-withupdatedresource.step2.bicep diff --git a/test/functional/shared/resources/aws_multi_identifier_resource_test.go b/test/functional-portable/corerp/cloud/resources/aws_multi_identifier_resource_test.go similarity index 92% rename from test/functional/shared/resources/aws_multi_identifier_resource_test.go rename to test/functional-portable/corerp/cloud/resources/aws_multi_identifier_resource_test.go index 0ef7f13c2e..c5d29da1c4 100644 --- a/test/functional/shared/resources/aws_multi_identifier_resource_test.go +++ b/test/functional-portable/corerp/cloud/resources/aws_multi_identifier_resource_test.go @@ -22,7 +22,7 @@ import ( "time" "github.com/google/uuid" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/validation" ) @@ -34,7 +34,7 @@ func Test_AWS_MultiIdentifier_Resource(t *testing.T) { testName := "ms" + uuid.New().String() creationTimestamp := fmt.Sprintf("%d", time.Now().Unix()) - test := shared.NewRPTest(t, testName, []shared.TestStep{ + test := rp.NewRPTest(t, testName, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, "filterName="+filterName, "logGroupName="+logGroupName, "creationTimestamp="+creationTimestamp), SkipKubernetesOutputResourceValidation: true, @@ -64,5 +64,6 @@ func Test_AWS_MultiIdentifier_Resource(t *testing.T) { }, }) + test.RequiredFeatures = []rp.RequiredFeature{rp.FeatureAWS} test.Test(t) } diff --git a/test/functional/shared/resources/aws_s3_bucket_test.go b/test/functional-portable/corerp/cloud/resources/aws_s3_bucket_test.go similarity index 93% rename from test/functional/shared/resources/aws_s3_bucket_test.go rename to test/functional-portable/corerp/cloud/resources/aws_s3_bucket_test.go index d6bfb25c9d..a2d7c5a317 100644 --- a/test/functional/shared/resources/aws_s3_bucket_test.go +++ b/test/functional-portable/corerp/cloud/resources/aws_s3_bucket_test.go @@ -19,7 +19,7 @@ package resource_test import ( "testing" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/testutil" "github.com/radius-project/radius/test/validation" @@ -30,7 +30,7 @@ func Test_AWS_S3Bucket(t *testing.T) { name := testutil.GenerateS3BucketName() creationTimestamp := testutil.GetCreationTimestamp() - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, "bucketName="+name, "creationTimestamp="+creationTimestamp), SkipKubernetesOutputResourceValidation: true, @@ -60,6 +60,7 @@ func Test_AWS_S3Bucket(t *testing.T) { }, }) + test.RequiredFeatures = []rp.RequiredFeature{rp.FeatureAWS} test.Test(t) } @@ -69,7 +70,7 @@ func Test_AWS_S3Bucket_Existing(t *testing.T) { name := testutil.GenerateS3BucketName() creationTimestamp := testutil.GetCreationTimestamp() - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, "bucketName="+name, "creationTimestamp="+creationTimestamp), SkipKubernetesOutputResourceValidation: true, @@ -129,6 +130,6 @@ func Test_AWS_S3Bucket_Existing(t *testing.T) { }, }) - test.RequiredFeatures = []shared.RequiredFeature{shared.FeatureAWS} + test.RequiredFeatures = []rp.RequiredFeature{rp.FeatureAWS} test.Test(t) } diff --git a/test/functional/shared/resources/azure_connections_test.go b/test/functional-portable/corerp/cloud/resources/azure_connections_test.go similarity index 91% rename from test/functional/shared/resources/azure_connections_test.go rename to test/functional-portable/corerp/cloud/resources/azure_connections_test.go index efe7a126d7..f314f5dda5 100644 --- a/test/functional/shared/resources/azure_connections_test.go +++ b/test/functional-portable/corerp/cloud/resources/azure_connections_test.go @@ -20,7 +20,7 @@ import ( "os" "testing" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/testutil" "github.com/radius-project/radius/test/validation" @@ -37,7 +37,7 @@ func Test_AzureConnections(t *testing.T) { cosmosmongodbresourceid := "cosmosmongodbresourceid=" + os.Getenv("AZURE_COSMOS_MONGODB_ACCOUNT_ID") appNamespace := "default-corerp-azure-connection-database-service" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage(), cosmosmongodbresourceid), RPResources: &validation.RPResourceSet{ @@ -63,6 +63,6 @@ func Test_AzureConnections(t *testing.T) { }, }) - test.RequiredFeatures = []shared.RequiredFeature{shared.FeatureAzure} + test.RequiredFeatures = []rp.RequiredFeature{rp.FeatureAzure} test.Test(t) } diff --git a/test/functional/shared/resources/extender_test.go b/test/functional-portable/corerp/cloud/resources/extender_test.go similarity index 62% rename from test/functional/shared/resources/extender_test.go rename to test/functional-portable/corerp/cloud/resources/extender_test.go index e18a9d46eb..961d98a5fb 100644 --- a/test/functional/shared/resources/extender_test.go +++ b/test/functional-portable/corerp/cloud/resources/extender_test.go @@ -22,81 +22,12 @@ import ( "os" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/testutil" "github.com/radius-project/radius/test/validation" ) -func Test_Extender_Manual(t *testing.T) { - template := "testdata/corerp-resources-extender.bicep" - name := "corerp-resources-extender" - appNamespace := "default-corerp-resources-extender" - - test := shared.NewRPTest(t, name, []shared.TestStep{ - { - Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage()), - RPResources: &validation.RPResourceSet{ - Resources: []validation.RPResource{ - { - Name: name, - Type: validation.ApplicationsResource, - }, - { - Name: "extr-ctnr", - Type: validation.ContainersResource, - App: name, - }, - { - Name: "extr-twilio", - Type: validation.ExtendersResource, - }, - }, - }, - K8sObjects: &validation.K8sObjectSet{ - Namespaces: map[string][]validation.K8sObject{ - appNamespace: { - validation.NewK8sPodForResource(name, "extr-ctnr"), - }, - }, - }, - }, - }) - - test.Test(t) -} - -func Test_Extender_Recipe(t *testing.T) { - template := "testdata/corerp-resources-extender-recipe.bicep" - name := "corerp-resources-extender-recipe" - - test := shared.NewRPTest(t, name, []shared.TestStep{ - { - Executor: step.NewDeployExecutor(template, testutil.GetBicepRecipeRegistry(), testutil.GetBicepRecipeVersion()), - RPResources: &validation.RPResourceSet{ - Resources: []validation.RPResource{ - { - Name: "corerp-resources-extender-recipe-env", - Type: validation.EnvironmentsResource, - }, - { - Name: name, - Type: validation.ApplicationsResource, - }, - { - Name: "extender-recipe", - Type: validation.ExtendersResource, - App: name, - }, - }, - }, - SkipObjectValidation: true, - }, - }) - - test.Test(t) -} - func Test_Extender_RecipeAWS(t *testing.T) { awsAccountID := os.Getenv("AWS_ACCOUNT_ID") awsRegion := os.Getenv("AWS_REGION") @@ -113,7 +44,7 @@ func Test_Extender_RecipeAWS(t *testing.T) { bucketID := fmt.Sprintf("/planes/aws/aws/accounts/%s/regions/%s/providers/AWS.S3/Bucket/%s", awsAccountID, awsRegion, bucketName) creationTimestamp := testutil.GetCreationTimestamp() - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor( template, diff --git a/test/functional/shared/resources/persistent_volume_test.go b/test/functional-portable/corerp/cloud/resources/persistent_volume_test.go similarity index 90% rename from test/functional/shared/resources/persistent_volume_test.go rename to test/functional-portable/corerp/cloud/resources/persistent_volume_test.go index 763ef6d65f..9722ffa6b3 100644 --- a/test/functional/shared/resources/persistent_volume_test.go +++ b/test/functional-portable/corerp/cloud/resources/persistent_volume_test.go @@ -19,7 +19,7 @@ package resource_test import ( "testing" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/testutil" "github.com/radius-project/radius/test/validation" @@ -30,7 +30,7 @@ func Test_PersistentVolume(t *testing.T) { name := "corerp-resources-volume-azure-keyvault" appNamespace := "corerp-resources-volume-azure-keyvault-app" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage(), testutil.GetOIDCIssuer()), RPResources: &validation.RPResourceSet{ @@ -64,7 +64,6 @@ func Test_PersistentVolume(t *testing.T) { }, }, }) - test.RequiredFeatures = []shared.RequiredFeature{shared.FeatureCSIDriver} - + test.RequiredFeatures = []rp.RequiredFeature{rp.FeatureCSIDriver, rp.FeatureAzure} test.Test(t) } diff --git a/test/functional-portable/corerp/cloud/resources/recipe_terraform_test.go b/test/functional-portable/corerp/cloud/resources/recipe_terraform_test.go new file mode 100644 index 0000000000..ee327ab830 --- /dev/null +++ b/test/functional-portable/corerp/cloud/resources/recipe_terraform_test.go @@ -0,0 +1,94 @@ +/* +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. +*/ + +package resource_test + +// This file contains tests for Terraform recipes functionality - covering general behaviors that should +// be consistent across all resource types. These tests mostly use the extender resource type and mostly +// avoid cloud resources to avoid unnecessary coupling and reliability issues. +// +// Tests in this file should only use cloud resources if absolutely necessary. +// +// Tests in this file should be kept *roughly* in sync with recipe_bicep_test and any other drivers. + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/radius-project/radius/test/functional-portable/corerp" + "github.com/radius-project/radius/test/rp" + "github.com/radius-project/radius/test/step" + "github.com/radius-project/radius/test/testutil" + "github.com/radius-project/radius/test/validation" +) + +var ( + secretNamespace = "radius-system" + secretPrefix = "tfstate-default-" +) + +// Test_TerraformRecipe_AzureStorage creates an Extender resource consuming a Terraform recipe that deploys an Azure blob storage instance. +func Test_TerraformRecipe_AzureStorage(t *testing.T) { + template := "testdata/corerp-resources-terraform-azurestorage.bicep" + name := "corerp-resources-terraform-azstorage" + appName := "corerp-resources-terraform-azstorage-app" + envName := "corerp-resources-terraform-azstorage-env" + + test := rp.NewRPTest(t, name, []rp.TestStep{ + { + Executor: step.NewDeployExecutor(template, testutil.GetTerraformRecipeModuleServerURL(), "appName="+appName), + RPResources: &validation.RPResourceSet{ + Resources: []validation.RPResource{ + { + Name: envName, + Type: validation.EnvironmentsResource, + }, + { + Name: appName, + Type: validation.ApplicationsResource, + }, + { + Name: name, + Type: validation.ExtendersResource, + App: appName, + }, + }, + }, + SkipObjectValidation: true, + PostStepVerify: func(ctx context.Context, t *testing.T, test rp.RPTest) { + resourceID := "/planes/radius/local/resourcegroups/kind-radius/providers/Applications.Core/extenders/" + name + secretSuffix, err := corerp.GetSecretSuffix(resourceID, envName, appName) + require.NoError(t, err) + + secret, err := test.Options.K8sClient.CoreV1().Secrets(secretNamespace). + Get(ctx, secretPrefix+secretSuffix, metav1.GetOptions{}) + require.NoError(t, err) + require.Equal(t, secretNamespace, secret.Namespace) + require.Equal(t, secretPrefix+secretSuffix, secret.Name) + }, + }, + }) + + test.PostDeleteVerify = func(ctx context.Context, t *testing.T, test rp.RPTest) { + resourceID := "/planes/radius/local/resourcegroups/kind-radius/providers/Applications.Core/extenders/" + name + corerp.TestSecretDeletion(t, ctx, test, appName, envName, resourceID, secretNamespace, secretPrefix) + } + + test.Test(t) +} diff --git a/test/functional/shared/resources/storage_test.go b/test/functional-portable/corerp/cloud/resources/storage_test.go similarity index 92% rename from test/functional/shared/resources/storage_test.go rename to test/functional-portable/corerp/cloud/resources/storage_test.go index d501707321..dcfbde80f6 100644 --- a/test/functional/shared/resources/storage_test.go +++ b/test/functional-portable/corerp/cloud/resources/storage_test.go @@ -19,7 +19,7 @@ package resource_test import ( "testing" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/testutil" "github.com/radius-project/radius/test/validation" @@ -31,7 +31,7 @@ func Test_Storage(t *testing.T) { name := "corerp-resources-container-workload" appNamespace := "azstorage-workload-app" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage(), testutil.GetOIDCIssuer()), RPResources: &validation.RPResourceSet{ @@ -61,5 +61,6 @@ func Test_Storage(t *testing.T) { }, }) + test.RequiredFeatures = []rp.RequiredFeature{rp.FeatureAzure} test.Test(t) } diff --git a/test/functional/shared/resources/testdata/aws-multi-identifier.bicep b/test/functional-portable/corerp/cloud/resources/testdata/aws-multi-identifier.bicep similarity index 100% rename from test/functional/shared/resources/testdata/aws-multi-identifier.bicep rename to test/functional-portable/corerp/cloud/resources/testdata/aws-multi-identifier.bicep diff --git a/test/functional/shared/resources/testdata/aws-s3-bucket-existing.bicep b/test/functional-portable/corerp/cloud/resources/testdata/aws-s3-bucket-existing.bicep similarity index 100% rename from test/functional/shared/resources/testdata/aws-s3-bucket-existing.bicep rename to test/functional-portable/corerp/cloud/resources/testdata/aws-s3-bucket-existing.bicep diff --git a/test/functional/shared/resources/testdata/aws-s3-bucket.bicep b/test/functional-portable/corerp/cloud/resources/testdata/aws-s3-bucket.bicep similarity index 100% rename from test/functional/shared/resources/testdata/aws-s3-bucket.bicep rename to test/functional-portable/corerp/cloud/resources/testdata/aws-s3-bucket.bicep diff --git a/test/functional/shared/resources/testdata/corerp-azure-connection-database-service.bicep b/test/functional-portable/corerp/cloud/resources/testdata/corerp-azure-connection-database-service.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-azure-connection-database-service.bicep rename to test/functional-portable/corerp/cloud/resources/testdata/corerp-azure-connection-database-service.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-container-workload.bicep b/test/functional-portable/corerp/cloud/resources/testdata/corerp-resources-container-workload.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-container-workload.bicep rename to test/functional-portable/corerp/cloud/resources/testdata/corerp-resources-container-workload.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-extender-aws-s3-recipe.bicep b/test/functional-portable/corerp/cloud/resources/testdata/corerp-resources-extender-aws-s3-recipe.bicep similarity index 93% rename from test/functional/shared/resources/testdata/corerp-resources-extender-aws-s3-recipe.bicep rename to test/functional-portable/corerp/cloud/resources/testdata/corerp-resources-extender-aws-s3-recipe.bicep index bd781ae120..d2c4fec050 100644 --- a/test/functional/shared/resources/testdata/corerp-resources-extender-aws-s3-recipe.bicep +++ b/test/functional-portable/corerp/cloud/resources/testdata/corerp-resources-extender-aws-s3-recipe.bicep @@ -25,7 +25,7 @@ resource env 'Applications.Core/environments@2023-10-01-preview' = { 'Applications.Core/extenders': { s3: { templateKind: 'bicep' - templatePath: '${registry}/test/functional/shared/recipes/extenders-aws-s3-recipe:${version}' + templatePath: '${registry}/test/testrecipes/test-bicep-recipes/extenders-aws-s3-recipe:${version}' parameters: { bucketName: bucketName } diff --git a/test/functional/shared/resources/testdata/corerp-resources-terraform-azurestorage.bicep b/test/functional-portable/corerp/cloud/resources/testdata/corerp-resources-terraform-azurestorage.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-terraform-azurestorage.bicep rename to test/functional-portable/corerp/cloud/resources/testdata/corerp-resources-terraform-azurestorage.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-volume-azure-keyvault.bicep b/test/functional-portable/corerp/cloud/resources/testdata/corerp-resources-volume-azure-keyvault.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-volume-azure-keyvault.bicep rename to test/functional-portable/corerp/cloud/resources/testdata/corerp-resources-volume-azure-keyvault.bicep diff --git a/test/functional/shared/api_test.go b/test/functional-portable/corerp/noncloud/api_test.go similarity index 97% rename from test/functional/shared/api_test.go rename to test/functional-portable/corerp/noncloud/api_test.go index 44c0f73297..8c9b843131 100644 --- a/test/functional/shared/api_test.go +++ b/test/functional-portable/corerp/noncloud/api_test.go @@ -14,20 +14,20 @@ See the License for the specific language governing permissions and limitations under the License. */ -package shared +package corerp import ( "fmt" "testing" + aztoken "github.com/radius-project/radius/pkg/azure/tokencredentials" "github.com/radius-project/radius/pkg/cli/clients" "github.com/radius-project/radius/pkg/cli/clients_new/generated" "github.com/radius-project/radius/pkg/ucp/resources" resources_radius "github.com/radius-project/radius/pkg/ucp/resources/radius" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/testcontext" "github.com/stretchr/testify/require" - - aztoken "github.com/radius-project/radius/pkg/azure/tokencredentials" ) // Test_ResourceList covers the plane and resource-group scope list APIs for all Radius resource types. @@ -35,7 +35,7 @@ import ( // This test exists as a smoke test that these APIs can be called safely. They are mainly used by the CLI // at this time, and this is a better way to get coverage. func Test_ResourceList(t *testing.T) { - options := NewRPTestOptions(t) + options := rp.NewRPTestOptions(t) // Extract the scope and client options from the management client so we can make our own API calls. require.IsType(t, options.ManagementClient, &clients.UCPApplicationsManagementClient{}) diff --git a/test/functional/shared/mechanics/k8s_extensibility_test.go b/test/functional-portable/corerp/noncloud/mechanics/k8s_extensibility_test.go similarity index 94% rename from test/functional/shared/mechanics/k8s_extensibility_test.go rename to test/functional-portable/corerp/noncloud/mechanics/k8s_extensibility_test.go index 747f507dee..3ec59a0928 100644 --- a/test/functional/shared/mechanics/k8s_extensibility_test.go +++ b/test/functional-portable/corerp/noncloud/mechanics/k8s_extensibility_test.go @@ -22,7 +22,7 @@ import ( "strings" "testing" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/validation" "gopkg.in/yaml.v3" @@ -33,7 +33,7 @@ func Test_Kubernetes_Extensibility(t *testing.T) { template := "testdata/k8s-extensibility/connection-string.bicep" name := "corerp-mechanics-k8s-extensibility" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template), RPResources: &validation.RPResourceSet{}, diff --git a/test/functional/shared/mechanics/mechanics_test.go b/test/functional-portable/corerp/noncloud/mechanics/mechanics_test.go similarity index 95% rename from test/functional/shared/mechanics/mechanics_test.go rename to test/functional-portable/corerp/noncloud/mechanics/mechanics_test.go index 89355c11e6..be521ff627 100644 --- a/test/functional/shared/mechanics/mechanics_test.go +++ b/test/functional-portable/corerp/noncloud/mechanics/mechanics_test.go @@ -24,7 +24,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/radius-project/radius/pkg/kubernetes" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/testutil" "github.com/radius-project/radius/test/validation" @@ -36,7 +36,7 @@ func Test_NestedModules(t *testing.T) { template := "testdata/corerp-mechanics-nestedmodules.bicep" name := "corerp-mechanics-nestedmodules" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template), RPResources: &validation.RPResourceSet{ @@ -63,7 +63,7 @@ func Test_RedeployWithAnotherResource(t *testing.T) { appNamespace := "default-corerp-mechanics-redeploy-with-another-resource" templateFmt := "testdata/corerp-mechanics-redeploy-withanotherresource.step%d.bicep" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(fmt.Sprintf(templateFmt, 1), testutil.GetMagpieImage()), RPResources: &validation.RPResourceSet{ @@ -126,7 +126,7 @@ func Test_RedeployWithUpdatedResourceUpdatesResource(t *testing.T) { appNamespace := "default-corerp-mechanics-redeploy-withupdatedresource" templateFmt := "testdata/corerp-mechanics-redeploy-withupdatedresource.step%d.bicep" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(fmt.Sprintf(templateFmt, 1), testutil.GetMagpieImage()), RPResources: &validation.RPResourceSet{ @@ -172,7 +172,7 @@ func Test_RedeployWithUpdatedResourceUpdatesResource(t *testing.T) { }, }, }, - PostStepVerify: func(ctx context.Context, t *testing.T, test shared.RPTest) { + PostStepVerify: func(ctx context.Context, t *testing.T, test rp.RPTest) { labelset := kubernetes.MakeSelectorLabels(name, "mechanicsd") deployments, err := test.Options.K8sClient.AppsV1().Deployments(appNamespace).List(context.Background(), metav1.ListOptions{ @@ -196,7 +196,7 @@ func Test_RedeployWithTwoSeparateResourcesKeepsResource(t *testing.T) { appNamespace := "default-corerp-mechanics-redeploy-withtwoseparateresource" templateFmt := "testdata/corerp-mechanics-redeploy-withtwoseparateresource.step%d.bicep" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(fmt.Sprintf(templateFmt, 1), testutil.GetMagpieImage()), RPResources: &validation.RPResourceSet{ @@ -259,7 +259,7 @@ func Test_CommunicationCycle(t *testing.T) { appNamespace := "default-corerp-mechanics-communication-cycle" template := "testdata/corerp-mechanics-communication-cycle.bicep" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage()), RPResources: &validation.RPResourceSet{ @@ -330,7 +330,7 @@ func Test_InvalidResourceIDs(t *testing.T) { }, }) - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployErrorExecutor(template, validate, testutil.GetMagpieImage(), testutil.GetBicepRecipeRegistry(), testutil.GetBicepRecipeVersion()), RPResources: &validation.RPResourceSet{ diff --git a/test/functional/shared/mechanics/testdata/corerp-mechanics-communication-cycle.bicep b/test/functional-portable/corerp/noncloud/mechanics/testdata/corerp-mechanics-communication-cycle.bicep similarity index 100% rename from test/functional/shared/mechanics/testdata/corerp-mechanics-communication-cycle.bicep rename to test/functional-portable/corerp/noncloud/mechanics/testdata/corerp-mechanics-communication-cycle.bicep diff --git a/test/functional/shared/mechanics/testdata/corerp-mechanics-invalid-resourceids.bicep b/test/functional-portable/corerp/noncloud/mechanics/testdata/corerp-mechanics-invalid-resourceids.bicep similarity index 94% rename from test/functional/shared/mechanics/testdata/corerp-mechanics-invalid-resourceids.bicep rename to test/functional-portable/corerp/noncloud/mechanics/testdata/corerp-mechanics-invalid-resourceids.bicep index 2a23f3a6e0..fd99bba623 100644 --- a/test/functional/shared/mechanics/testdata/corerp-mechanics-invalid-resourceids.bicep +++ b/test/functional-portable/corerp/noncloud/mechanics/testdata/corerp-mechanics-invalid-resourceids.bicep @@ -32,7 +32,7 @@ resource env 'Applications.Core/environments@2023-10-01-preview' = { 'Applications.Dapr/pubSubBrokers': { default: { templateKind: 'bicep' - templatePath: '${registry}/test/functional/shared/recipes/dapr-pubsub-broker:${version}' + templatePath: '${registry}/test/testrecipes/test-bicep-recipes/dapr-pubsub-broker:${version}' } } } diff --git a/test/functional/shared/mechanics/testdata/corerp-mechanics-nestedmodules.bicep b/test/functional-portable/corerp/noncloud/mechanics/testdata/corerp-mechanics-nestedmodules.bicep similarity index 100% rename from test/functional/shared/mechanics/testdata/corerp-mechanics-nestedmodules.bicep rename to test/functional-portable/corerp/noncloud/mechanics/testdata/corerp-mechanics-nestedmodules.bicep diff --git a/test/functional/shared/mechanics/testdata/corerp-mechanics-redeploy-withanotherresource.step1.bicep b/test/functional-portable/corerp/noncloud/mechanics/testdata/corerp-mechanics-redeploy-withanotherresource.step1.bicep similarity index 100% rename from test/functional/shared/mechanics/testdata/corerp-mechanics-redeploy-withanotherresource.step1.bicep rename to test/functional-portable/corerp/noncloud/mechanics/testdata/corerp-mechanics-redeploy-withanotherresource.step1.bicep diff --git a/test/functional/shared/mechanics/testdata/corerp-mechanics-redeploy-withanotherresource.step2.bicep b/test/functional-portable/corerp/noncloud/mechanics/testdata/corerp-mechanics-redeploy-withanotherresource.step2.bicep similarity index 100% rename from test/functional/shared/mechanics/testdata/corerp-mechanics-redeploy-withanotherresource.step2.bicep rename to test/functional-portable/corerp/noncloud/mechanics/testdata/corerp-mechanics-redeploy-withanotherresource.step2.bicep diff --git a/test/functional/shared/mechanics/testdata/corerp-mechanics-redeploy-withtwoseparateresource.step1.bicep b/test/functional-portable/corerp/noncloud/mechanics/testdata/corerp-mechanics-redeploy-withtwoseparateresource.step1.bicep similarity index 100% rename from test/functional/shared/mechanics/testdata/corerp-mechanics-redeploy-withtwoseparateresource.step1.bicep rename to test/functional-portable/corerp/noncloud/mechanics/testdata/corerp-mechanics-redeploy-withtwoseparateresource.step1.bicep diff --git a/test/functional/shared/mechanics/testdata/corerp-mechanics-redeploy-withtwoseparateresource.step2.bicep b/test/functional-portable/corerp/noncloud/mechanics/testdata/corerp-mechanics-redeploy-withtwoseparateresource.step2.bicep similarity index 100% rename from test/functional/shared/mechanics/testdata/corerp-mechanics-redeploy-withtwoseparateresource.step2.bicep rename to test/functional-portable/corerp/noncloud/mechanics/testdata/corerp-mechanics-redeploy-withtwoseparateresource.step2.bicep diff --git a/test/functional/shared/mechanics/testdata/corerp-mechanics-redeploy-withupdatedresource.step1.bicep b/test/functional-portable/corerp/noncloud/mechanics/testdata/corerp-mechanics-redeploy-withupdatedresource.step1.bicep similarity index 100% rename from test/functional/shared/mechanics/testdata/corerp-mechanics-redeploy-withupdatedresource.step1.bicep rename to test/functional-portable/corerp/noncloud/mechanics/testdata/corerp-mechanics-redeploy-withupdatedresource.step1.bicep diff --git a/test/functional/shared/mechanics/testdata/corerp-mechanics-redeploy-withupdatedresource.step2.bicep b/test/functional-portable/corerp/noncloud/mechanics/testdata/corerp-mechanics-redeploy-withupdatedresource.step2.bicep similarity index 100% rename from test/functional/shared/mechanics/testdata/corerp-mechanics-redeploy-withupdatedresource.step2.bicep rename to test/functional-portable/corerp/noncloud/mechanics/testdata/corerp-mechanics-redeploy-withupdatedresource.step2.bicep diff --git a/test/functional/shared/mechanics/testdata/k8s-extensibility/connection-string.bicep b/test/functional-portable/corerp/noncloud/mechanics/testdata/k8s-extensibility/connection-string.bicep similarity index 100% rename from test/functional/shared/mechanics/testdata/k8s-extensibility/connection-string.bicep rename to test/functional-portable/corerp/noncloud/mechanics/testdata/k8s-extensibility/connection-string.bicep diff --git a/test/functional/shared/mechanics/testdata/k8s-extensibility/secret.input.yaml b/test/functional-portable/corerp/noncloud/mechanics/testdata/k8s-extensibility/secret.input.yaml similarity index 100% rename from test/functional/shared/mechanics/testdata/k8s-extensibility/secret.input.yaml rename to test/functional-portable/corerp/noncloud/mechanics/testdata/k8s-extensibility/secret.input.yaml diff --git a/test/functional/shared/mechanics/testdata/k8s-extensibility/secret.output.yaml b/test/functional-portable/corerp/noncloud/mechanics/testdata/k8s-extensibility/secret.output.yaml similarity index 100% rename from test/functional/shared/mechanics/testdata/k8s-extensibility/secret.output.yaml rename to test/functional-portable/corerp/noncloud/mechanics/testdata/k8s-extensibility/secret.output.yaml diff --git a/test/functional/shared/mechanics/testdata/k8s-extensibility/service.input.yaml b/test/functional-portable/corerp/noncloud/mechanics/testdata/k8s-extensibility/service.input.yaml similarity index 100% rename from test/functional/shared/mechanics/testdata/k8s-extensibility/service.input.yaml rename to test/functional-portable/corerp/noncloud/mechanics/testdata/k8s-extensibility/service.input.yaml diff --git a/test/functional/shared/mechanics/testdata/modules/corerp-mechanics-nestedmodules-innerapp.bicep b/test/functional-portable/corerp/noncloud/mechanics/testdata/modules/corerp-mechanics-nestedmodules-innerapp.bicep similarity index 100% rename from test/functional/shared/mechanics/testdata/modules/corerp-mechanics-nestedmodules-innerapp.bicep rename to test/functional-portable/corerp/noncloud/mechanics/testdata/modules/corerp-mechanics-nestedmodules-innerapp.bicep diff --git a/test/functional/shared/mechanics/testdata/modules/corerp-mechanics-nestedmodules-outerapp.bicep b/test/functional-portable/corerp/noncloud/mechanics/testdata/modules/corerp-mechanics-nestedmodules-outerapp.bicep similarity index 100% rename from test/functional/shared/mechanics/testdata/modules/corerp-mechanics-nestedmodules-outerapp.bicep rename to test/functional-portable/corerp/noncloud/mechanics/testdata/modules/corerp-mechanics-nestedmodules-outerapp.bicep diff --git a/test/functional/shared/resources/application_environment_test.go b/test/functional-portable/corerp/noncloud/resources/application_environment_test.go similarity index 93% rename from test/functional/shared/resources/application_environment_test.go rename to test/functional-portable/corerp/noncloud/resources/application_environment_test.go index 23ee2a1adb..550fe216f1 100644 --- a/test/functional/shared/resources/application_environment_test.go +++ b/test/functional-portable/corerp/noncloud/resources/application_environment_test.go @@ -20,7 +20,7 @@ import ( "context" "testing" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/validation" "github.com/stretchr/testify/require" @@ -31,7 +31,7 @@ func Test_ApplicationAndEnvironment(t *testing.T) { template := "testdata/corerp-resources-app-env.bicep" name := "corerp-resources-app-env" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template), RPResources: &validation.RPResourceSet{ @@ -48,7 +48,7 @@ func Test_ApplicationAndEnvironment(t *testing.T) { }, // Application and Environment should not render any K8s Objects directly K8sObjects: &validation.K8sObjectSet{}, - PostStepVerify: func(ctx context.Context, t *testing.T, test shared.RPTest) { + PostStepVerify: func(ctx context.Context, t *testing.T, test rp.RPTest) { expectedNS := []string{ "corerp-resources-app-env", "corerp-resources-app-env-env-corerp-resources-app-env-app", diff --git a/test/functional/shared/resources/application_test.go b/test/functional-portable/corerp/noncloud/resources/application_test.go similarity index 92% rename from test/functional/shared/resources/application_test.go rename to test/functional-portable/corerp/noncloud/resources/application_test.go index 93fb90bc16..37e6ff4d9c 100644 --- a/test/functional/shared/resources/application_test.go +++ b/test/functional-portable/corerp/noncloud/resources/application_test.go @@ -20,7 +20,7 @@ import ( "context" "testing" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/testutil" "github.com/radius-project/radius/test/validation" @@ -37,7 +37,7 @@ func Test_Application(t *testing.T) { name := "corerp-resources-application" appNamespace := "corerp-resources-application-app" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template), RPResources: &validation.RPResourceSet{ @@ -50,7 +50,7 @@ func Test_Application(t *testing.T) { }, // Application should not render any K8s Objects directly K8sObjects: &validation.K8sObjectSet{}, - PostStepVerify: func(ctx context.Context, t *testing.T, test shared.RPTest) { + PostStepVerify: func(ctx context.Context, t *testing.T, test rp.RPTest) { _, err := test.Options.K8sClient.CoreV1().Namespaces().Get(ctx, appNamespace, metav1.GetOptions{}) require.NoErrorf(t, err, "%s must be created", appNamespace) }, @@ -65,7 +65,7 @@ func Test_ApplicationGraph(t *testing.T) { name := "corerp-application-simple1" appNamespace := "default-corerp-application-simple1" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage()), RPResources: &validation.RPResourceSet{ @@ -100,9 +100,9 @@ func Test_ApplicationGraph(t *testing.T) { }, }, }, - PostStepVerify: func(ctx context.Context, t *testing.T, ct shared.RPTest) { + PostStepVerify: func(ctx context.Context, t *testing.T, ct rp.RPTest) { // Verify the application graph - options := shared.NewRPTestOptions(t) + options := rp.NewRPTestOptions(t) client := options.ManagementClient require.IsType(t, client, &clients.UCPApplicationsManagementClient{}) diff --git a/test/functional/shared/resources/container_runtimes_test.go b/test/functional-portable/corerp/noncloud/resources/container_runtimes_test.go similarity index 96% rename from test/functional/shared/resources/container_runtimes_test.go rename to test/functional-portable/corerp/noncloud/resources/container_runtimes_test.go index b8c8389ca7..14a3478862 100644 --- a/test/functional/shared/resources/container_runtimes_test.go +++ b/test/functional-portable/corerp/noncloud/resources/container_runtimes_test.go @@ -20,7 +20,7 @@ import ( "context" "testing" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/testutil" "github.com/radius-project/radius/test/validation" @@ -41,7 +41,7 @@ func Test_Container_YAMLManifest(t *testing.T) { name := "corerp-resources-container-manifest" appNamespace := "corerp-resources-container-manifest" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage()), RPResources: &validation.RPResourceSet{ @@ -64,7 +64,7 @@ func Test_Container_YAMLManifest(t *testing.T) { }, }, }, - PostStepVerify: func(ctx context.Context, t *testing.T, test shared.RPTest) { + PostStepVerify: func(ctx context.Context, t *testing.T, test rp.RPTest) { deploy, err := test.Options.K8sClient.AppsV1().Deployments(appNamespace).Get(ctx, "ctnr-manifest", metav1.GetOptions{}) require.NoError(t, err) require.Equal(t, "base-manifest-test", deploy.ObjectMeta.Annotations["source"]) @@ -107,7 +107,7 @@ func Test_Container_YAMLManifest_SideCar(t *testing.T) { name := "corerp-resources-container-sidecar" appNamespace := "corerp-resources-container-sidecar" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage()), RPResources: &validation.RPResourceSet{ @@ -130,7 +130,7 @@ func Test_Container_YAMLManifest_SideCar(t *testing.T) { }, }, }, - PostStepVerify: func(ctx context.Context, t *testing.T, test shared.RPTest) { + PostStepVerify: func(ctx context.Context, t *testing.T, test rp.RPTest) { deploy, err := test.Options.K8sClient.AppsV1().Deployments(appNamespace).Get(ctx, "ctnr-sidecar", metav1.GetOptions{}) require.NoError(t, err) @@ -153,7 +153,7 @@ func Test_Container_pod_patching(t *testing.T) { name := "corerp-resources-container-podpatch" appNamespace := "corerp-resources-container-podpatch" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage()), RPResources: &validation.RPResourceSet{ @@ -176,7 +176,7 @@ func Test_Container_pod_patching(t *testing.T) { }, }, }, - PostStepVerify: func(ctx context.Context, t *testing.T, test shared.RPTest) { + PostStepVerify: func(ctx context.Context, t *testing.T, test rp.RPTest) { deploy, err := test.Options.K8sClient.AppsV1().Deployments(appNamespace).Get(ctx, "ctnr-podpatch", metav1.GetOptions{}) require.NoError(t, err) diff --git a/test/functional/shared/resources/container_test.go b/test/functional-portable/corerp/noncloud/resources/container_test.go similarity index 94% rename from test/functional/shared/resources/container_test.go rename to test/functional-portable/corerp/noncloud/resources/container_test.go index dcd1de21ee..4dc8e47e53 100644 --- a/test/functional/shared/resources/container_test.go +++ b/test/functional-portable/corerp/noncloud/resources/container_test.go @@ -21,7 +21,7 @@ import ( "fmt" "testing" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/testutil" "github.com/radius-project/radius/test/validation" @@ -34,7 +34,7 @@ func Test_Container(t *testing.T) { name := "corerp-resources-container" appNamespace := "corerp-resources-container-app" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage()), RPResources: &validation.RPResourceSet{ @@ -68,7 +68,7 @@ func Test_ContainerDNSSD_TwoContainersDNS(t *testing.T) { name := "corerp-resources-container-two-containers-dns" appNamespace := "corerp-resources-container-two-containers-dns" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage()), RPResources: &validation.RPResourceSet{ @@ -109,7 +109,7 @@ func Test_ContainerDNSSD_OptionalPortScheme(t *testing.T) { name := "corerp-resources-container-optional-port-scheme" appNamespace := "corerp-resources-container-optional-port-scheme" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage()), RPResources: &validation.RPResourceSet{ @@ -158,7 +158,7 @@ func Test_ContainerReadinessLiveness(t *testing.T) { name := "corerp-resources-container-live-ready" appNamespace := "corerp-resources-container-live-ready-app" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage()), RPResources: &validation.RPResourceSet{ @@ -192,7 +192,7 @@ func Test_ContainerManualScale(t *testing.T) { name := "corerp-resources-container-manualscale" appNamespace := "corerp-resources-container-manualscale-app" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage()), RPResources: &validation.RPResourceSet{ @@ -226,7 +226,7 @@ func Test_ContainerWithCommandAndArgs(t *testing.T) { name := "corerp-resources-container-cmd-args" appNamespace := "corerp-resources-container-cmd-args-app" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(container), RPResources: &validation.RPResourceSet{ @@ -249,7 +249,7 @@ func Test_ContainerWithCommandAndArgs(t *testing.T) { }, }, }, - PostStepVerify: func(ctx context.Context, t *testing.T, test shared.RPTest) { + PostStepVerify: func(ctx context.Context, t *testing.T, test rp.RPTest) { label := fmt.Sprintf("radapp.io/application=%s", name) pods, err := test.Options.K8sClient.CoreV1().Pods(appNamespace).List(ctx, metav1.ListOptions{ LabelSelector: label, @@ -299,7 +299,7 @@ func Test_Container_FailDueToNonExistentImage(t *testing.T) { }, }) - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployErrorExecutor(template, validate, "magpieimage=non-existent-image"), SkipKubernetesOutputResourceValidation: true, @@ -334,7 +334,7 @@ func Test_Container_FailDueToBadHealthProbe(t *testing.T) { }, }) - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployErrorExecutor(template, validate, testutil.GetMagpieImage()), SkipKubernetesOutputResourceValidation: true, diff --git a/test/functional/shared/resources/container_versioning_test.go b/test/functional-portable/corerp/noncloud/resources/container_versioning_test.go similarity index 95% rename from test/functional/shared/resources/container_versioning_test.go rename to test/functional-portable/corerp/noncloud/resources/container_versioning_test.go index 63786afcce..85cd3e54d3 100644 --- a/test/functional/shared/resources/container_versioning_test.go +++ b/test/functional-portable/corerp/noncloud/resources/container_versioning_test.go @@ -21,7 +21,7 @@ import ( "fmt" "testing" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/testutil" "github.com/radius-project/radius/test/validation" @@ -37,7 +37,7 @@ func Test_ContainerVersioning(t *testing.T) { name := "corerp-resources-container-versioning" appNamespace := "default-corerp-resources-container-versioning" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(containerV1, testutil.GetMagpieImage()), RPResources: &validation.RPResourceSet{ @@ -61,7 +61,7 @@ func Test_ContainerVersioning(t *testing.T) { }, }, SkipResourceDeletion: true, - PostStepVerify: func(ctx context.Context, t *testing.T, test shared.RPTest) { + PostStepVerify: func(ctx context.Context, t *testing.T, test rp.RPTest) { label := fmt.Sprintf("radapp.io/application=%s", name) secrets, err := test.Options.K8sClient.CoreV1().Secrets(appNamespace).List(ctx, metav1.ListOptions{ LabelSelector: label, @@ -92,7 +92,7 @@ func Test_ContainerVersioning(t *testing.T) { }, }, }, - PostStepVerify: func(ctx context.Context, t *testing.T, test shared.RPTest) { + PostStepVerify: func(ctx context.Context, t *testing.T, test rp.RPTest) { label := fmt.Sprintf("radapp.io/application=%s", name) secrets, err := test.Options.K8sClient.CoreV1().Secrets(appNamespace).List(ctx, metav1.ListOptions{ LabelSelector: label, diff --git a/test/functional/shared/resources/environment_test.go b/test/functional-portable/corerp/noncloud/resources/environment_test.go similarity index 91% rename from test/functional/shared/resources/environment_test.go rename to test/functional-portable/corerp/noncloud/resources/environment_test.go index 6c9249785e..58f26abb54 100644 --- a/test/functional/shared/resources/environment_test.go +++ b/test/functional-portable/corerp/noncloud/resources/environment_test.go @@ -19,7 +19,7 @@ package resource_test import ( "testing" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/validation" ) @@ -28,7 +28,7 @@ func Test_Environment(t *testing.T) { template := "testdata/corerp-resources-environment.bicep" name := "corerp-resources-environment" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template), RPResources: &validation.RPResourceSet{ diff --git a/test/functional-portable/corerp/noncloud/resources/extender_test.go b/test/functional-portable/corerp/noncloud/resources/extender_test.go new file mode 100644 index 0000000000..907fd4243b --- /dev/null +++ b/test/functional-portable/corerp/noncloud/resources/extender_test.go @@ -0,0 +1,95 @@ +/* +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. +*/ + +package resource_test + +import ( + "testing" + + "github.com/radius-project/radius/test/rp" + "github.com/radius-project/radius/test/step" + "github.com/radius-project/radius/test/testutil" + "github.com/radius-project/radius/test/validation" +) + +func Test_Extender_Manual(t *testing.T) { + template := "testdata/corerp-resources-extender.bicep" + name := "corerp-resources-extender" + appNamespace := "default-corerp-resources-extender" + + test := rp.NewRPTest(t, name, []rp.TestStep{ + { + Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage()), + RPResources: &validation.RPResourceSet{ + Resources: []validation.RPResource{ + { + Name: name, + Type: validation.ApplicationsResource, + }, + { + Name: "extr-ctnr", + Type: validation.ContainersResource, + App: name, + }, + { + Name: "extr-twilio", + Type: validation.ExtendersResource, + }, + }, + }, + K8sObjects: &validation.K8sObjectSet{ + Namespaces: map[string][]validation.K8sObject{ + appNamespace: { + validation.NewK8sPodForResource(name, "extr-ctnr"), + }, + }, + }, + }, + }) + + test.Test(t) +} + +func Test_Extender_Recipe(t *testing.T) { + template := "testdata/corerp-resources-extender-recipe.bicep" + name := "corerp-resources-extender-recipe" + + test := rp.NewRPTest(t, name, []rp.TestStep{ + { + Executor: step.NewDeployExecutor(template, testutil.GetBicepRecipeRegistry(), testutil.GetBicepRecipeVersion()), + RPResources: &validation.RPResourceSet{ + Resources: []validation.RPResource{ + { + Name: "corerp-resources-extender-recipe-env", + Type: validation.EnvironmentsResource, + }, + { + Name: name, + Type: validation.ApplicationsResource, + }, + { + Name: "extender-recipe", + Type: validation.ExtendersResource, + App: name, + }, + }, + }, + SkipObjectValidation: true, + }, + }) + + test.Test(t) +} diff --git a/test/functional/shared/resources/gateway_test.go b/test/functional-portable/corerp/noncloud/resources/gateway_test.go similarity index 95% rename from test/functional/shared/resources/gateway_test.go rename to test/functional-portable/corerp/noncloud/resources/gateway_test.go index 7a64f51be0..82fe1bc414 100644 --- a/test/functional/shared/resources/gateway_test.go +++ b/test/functional-portable/corerp/noncloud/resources/gateway_test.go @@ -27,7 +27,7 @@ import ( "testing" "time" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/testutil" "github.com/radius-project/radius/test/validation" @@ -51,7 +51,7 @@ func Test_GatewayDNS(t *testing.T) { name := "corerp-resources-gateway-dns" appNamespace := "default-corerp-resources-gateway-dns" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage()), RPResources: &validation.RPResourceSet{ @@ -90,7 +90,7 @@ func Test_GatewayDNS(t *testing.T) { }, }, }, - PostStepVerify: func(ctx context.Context, t *testing.T, ct shared.RPTest) { + PostStepVerify: func(ctx context.Context, t *testing.T, ct rp.RPTest) { // Get hostname from root HTTPProxy in application namespace metadata, err := testutil.GetHTTPProxyMetadata(ctx, ct.Options.Client, appNamespace, name) require.NoError(t, err) @@ -130,7 +130,7 @@ func Test_Gateway_SSLPassthrough(t *testing.T) { name := "corerp-resources-gateway-sslpassthrough" appNamespace := "default-corerp-resources-gateway-sslpassthrough" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage(), "@testdata/parameters/test-tls-cert.parameters.json"), RPResources: &validation.RPResourceSet{ @@ -161,7 +161,7 @@ func Test_Gateway_SSLPassthrough(t *testing.T) { }, }, }, - PostStepVerify: func(ctx context.Context, t *testing.T, ct shared.RPTest) { + PostStepVerify: func(ctx context.Context, t *testing.T, ct rp.RPTest) { // Get hostname from root HTTPProxy in application namespace metadata, err := testutil.GetHTTPProxyMetadata(ctx, ct.Options.Client, appNamespace, name) require.NoError(t, err) @@ -196,7 +196,7 @@ func Test_Gateway_TLSTermination(t *testing.T) { name := "corerp-resources-gateway-tlstermination" appNamespace := "default-corerp-resources-gateway-tlstermination" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage(), "@testdata/parameters/test-tls-cert.parameters.json"), RPResources: &validation.RPResourceSet{ @@ -233,7 +233,7 @@ func Test_Gateway_TLSTermination(t *testing.T) { }, }, }, - PostStepVerify: func(ctx context.Context, t *testing.T, ct shared.RPTest) { + PostStepVerify: func(ctx context.Context, t *testing.T, ct rp.RPTest) { // Get hostname from root HTTPProxy in application namespace metadata, err := testutil.GetHTTPProxyMetadata(ctx, ct.Options.Client, appNamespace, name) require.NoError(t, err) @@ -281,7 +281,7 @@ func Test_Gateway_Failure(t *testing.T) { }, }) - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployErrorExecutor(template, validateFn), SkipObjectValidation: true, @@ -307,7 +307,7 @@ func Test_Gateway_Failure(t *testing.T) { test.Test(t) } -func testGatewayWithPortForward(t *testing.T, ctx context.Context, at shared.RPTest, hostname string, remotePort int, isHttps bool, tests []GatewayTestConfig) error { +func testGatewayWithPortForward(t *testing.T, ctx context.Context, at rp.RPTest, hostname string, remotePort int, isHttps bool, tests []GatewayTestConfig) error { // stopChan will close the port-forward connection on close stopChan := make(chan struct{}) diff --git a/test/functional/shared/resources/kubemetadata_cascade_test.go b/test/functional-portable/corerp/noncloud/resources/kubemetadata_cascade_test.go similarity index 97% rename from test/functional/shared/resources/kubemetadata_cascade_test.go rename to test/functional-portable/corerp/noncloud/resources/kubemetadata_cascade_test.go index 06ee0cb625..0a17234119 100644 --- a/test/functional/shared/resources/kubemetadata_cascade_test.go +++ b/test/functional-portable/corerp/noncloud/resources/kubemetadata_cascade_test.go @@ -21,7 +21,7 @@ import ( "fmt" "testing" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/testutil" "github.com/radius-project/radius/test/validation" @@ -68,7 +68,7 @@ func Test_KubeMetadataCascade(t *testing.T) { "radapp.io/cntr.lbl.1": "reserved.lbl.val.1", } - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage()), RPResources: &validation.RPResourceSet{ @@ -95,7 +95,7 @@ func Test_KubeMetadataCascade(t *testing.T) { }, }, }, - PostStepVerify: func(ctx context.Context, t *testing.T, test shared.RPTest) { + PostStepVerify: func(ctx context.Context, t *testing.T, test rp.RPTest) { // Verify pod labels and annotations label := fmt.Sprintf("radapp.io/application=%s", name) pods, err := test.Options.K8sClient.CoreV1().Pods(appNamespace).List(ctx, metav1.ListOptions{ diff --git a/test/functional/shared/resources/kubemetadata_container_test.go b/test/functional-portable/corerp/noncloud/resources/kubemetadata_container_test.go similarity index 95% rename from test/functional/shared/resources/kubemetadata_container_test.go rename to test/functional-portable/corerp/noncloud/resources/kubemetadata_container_test.go index d1461783fe..c08e104b9d 100644 --- a/test/functional/shared/resources/kubemetadata_container_test.go +++ b/test/functional-portable/corerp/noncloud/resources/kubemetadata_container_test.go @@ -21,7 +21,7 @@ import ( "fmt" "testing" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/testutil" "github.com/radius-project/radius/test/validation" @@ -44,7 +44,7 @@ func Test_KubeMetadataContainer(t *testing.T) { "user.cntr.lbl.2": "user.cntr.lbl.val.2", } - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage()), RPResources: &validation.RPResourceSet{ @@ -71,7 +71,7 @@ func Test_KubeMetadataContainer(t *testing.T) { }, }, }, - PostStepVerify: func(ctx context.Context, t *testing.T, test shared.RPTest) { + PostStepVerify: func(ctx context.Context, t *testing.T, test rp.RPTest) { // Verify pod labels and annotations label := fmt.Sprintf("radapp.io/application=%s", name) pods, err := test.Options.K8sClient.CoreV1().Pods(appNamespace).List(ctx, metav1.ListOptions{ diff --git a/test/functional/shared/resources/kubemetadata_gateway_test.go b/test/functional-portable/corerp/noncloud/resources/kubemetadata_gateway_test.go similarity index 94% rename from test/functional/shared/resources/kubemetadata_gateway_test.go rename to test/functional-portable/corerp/noncloud/resources/kubemetadata_gateway_test.go index 7409fc4975..62e06caebd 100644 --- a/test/functional/shared/resources/kubemetadata_gateway_test.go +++ b/test/functional-portable/corerp/noncloud/resources/kubemetadata_gateway_test.go @@ -20,7 +20,7 @@ import ( "context" "testing" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/testutil" "github.com/radius-project/radius/test/validation" @@ -36,7 +36,7 @@ func Test_Gateway_KubernetesMetadata(t *testing.T) { "user.ann.2": "user.ann.val.2", } - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage()), RPResources: &validation.RPResourceSet{ @@ -73,7 +73,7 @@ func Test_Gateway_KubernetesMetadata(t *testing.T) { }, }, }, - PostStepVerify: func(ctx context.Context, t *testing.T, ct shared.RPTest) { + PostStepVerify: func(ctx context.Context, t *testing.T, ct rp.RPTest) { // Check labels and annotations t.Logf("Checking label, annotation values in HTTPProxy resources") httpproxies, err := testutil.GetHTTPProxyList(ctx, ct.Options.Client, appNamespace, name) diff --git a/test/functional/shared/resources/recipe_bicep_test.go b/test/functional-portable/corerp/noncloud/resources/recipe_bicep_test.go similarity index 96% rename from test/functional/shared/resources/recipe_bicep_test.go rename to test/functional-portable/corerp/noncloud/resources/recipe_bicep_test.go index b7afaacc69..f2b2683134 100644 --- a/test/functional/shared/resources/recipe_bicep_test.go +++ b/test/functional-portable/corerp/noncloud/resources/recipe_bicep_test.go @@ -25,7 +25,7 @@ import ( "github.com/radius-project/radius/pkg/recipes" "github.com/radius-project/radius/pkg/ucp/resources" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/testutil" "github.com/radius-project/radius/test/validation" @@ -68,7 +68,7 @@ func Test_BicepRecipe_ParametersAndOutputs(t *testing.T) { "@" + parametersFilePath, } - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, parameters...), RPResources: &validation.RPResourceSet{ @@ -84,7 +84,7 @@ func Test_BicepRecipe_ParametersAndOutputs(t *testing.T) { }, }, K8sObjects: &validation.K8sObjectSet{}, - PostStepVerify: func(ctx context.Context, t *testing.T, test shared.RPTest) { + PostStepVerify: func(ctx context.Context, t *testing.T, test rp.RPTest) { resource, err := test.Options.ManagementClient.ShowResource(ctx, "Applications.Core/extenders", name) require.NoError(t, err) @@ -122,7 +122,7 @@ func Test_BicepRecipe_ContextParameter(t *testing.T) { fmt.Sprintf("recipe=%s", "context-parameter"), } - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, parameters...), RPResources: &validation.RPResourceSet{ @@ -138,7 +138,7 @@ func Test_BicepRecipe_ContextParameter(t *testing.T) { }, }, K8sObjects: &validation.K8sObjectSet{}, - PostStepVerify: func(ctx context.Context, t *testing.T, test shared.RPTest) { + PostStepVerify: func(ctx context.Context, t *testing.T, test rp.RPTest) { resource, err := test.Options.ManagementClient.ShowResource(ctx, "Applications.Core/extenders", name) require.NoError(t, err) @@ -190,7 +190,7 @@ func Test_BicepRecipe_ResourceCreation(t *testing.T) { fmt.Sprintf("basename=%s", name), } - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(fmt.Sprintf(templateFmt, "step0"), parametersStep0...), RPResources: &validation.RPResourceSet{ @@ -238,7 +238,7 @@ func Test_BicepRecipe_ResourceCreation(t *testing.T) { // Trying to delete the resources can cause multiple concurrent delete requests. // This currently fails. SkipResourceDeletion: true, - PostStepVerify: func(ctx context.Context, t *testing.T, test shared.RPTest) { + PostStepVerify: func(ctx context.Context, t *testing.T, test rp.RPTest) { resource, err := test.Options.ManagementClient.ShowResource(ctx, "Applications.Core/extenders", name) require.NoError(t, err) @@ -313,7 +313,7 @@ func Test_BicepRecipe_ParameterNotDefined(t *testing.T) { }, }) - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployErrorExecutor(template, validate, parameters...), RPResources: &validation.RPResourceSet{ @@ -354,7 +354,7 @@ func Test_BicepRecipe_WrongOutput(t *testing.T) { }, }) - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployErrorExecutor(template, validate, parameters...), RPResources: &validation.RPResourceSet{ @@ -407,7 +407,7 @@ func Test_BicepRecipe_LanguageFailure(t *testing.T) { }, }) - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployErrorExecutor(template, validate, parameters...), RPResources: &validation.RPResourceSet{ @@ -466,7 +466,7 @@ func Test_BicepRecipe_ResourceCreationFailure(t *testing.T) { }, }) - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployErrorExecutor(template, validate, parameters...), RPResources: &validation.RPResourceSet{ diff --git a/test/functional/shared/resources/recipe_terraform_test.go b/test/functional-portable/corerp/noncloud/resources/recipe_terraform_test.go similarity index 76% rename from test/functional/shared/resources/recipe_terraform_test.go rename to test/functional-portable/corerp/noncloud/resources/recipe_terraform_test.go index ec02155b16..07f6a7b9b5 100644 --- a/test/functional/shared/resources/recipe_terraform_test.go +++ b/test/functional-portable/corerp/noncloud/resources/recipe_terraform_test.go @@ -33,15 +33,13 @@ import ( "testing" "github.com/stretchr/testify/require" - corev1 "k8s.io/api/core/v1" - apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/radius-project/radius/pkg/recipes" - "github.com/radius-project/radius/pkg/recipes/terraform/config/backends" "github.com/radius-project/radius/pkg/ucp/resources" resources_radius "github.com/radius-project/radius/pkg/ucp/resources/radius" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/functional-portable/corerp" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/testutil" "github.com/radius-project/radius/test/validation" @@ -63,10 +61,10 @@ func Test_TerraformRecipe_KubernetesRedis(t *testing.T) { envName := "corerp-resources-terraform-redis-env" redisCacheName := "tf-redis-cache" - secretSuffix, err := getSecretSuffix("/planes/radius/local/resourcegroups/kind-radius/providers/Applications.Core/extenders/"+name, envName, appName) + secretSuffix, err := corerp.GetSecretSuffix("/planes/radius/local/resourcegroups/kind-radius/providers/Applications.Core/extenders/"+name, envName, appName) require.NoError(t, err) - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetTerraformRecipeModuleServerURL(), "appName="+appName, "redisCacheName="+redisCacheName), RPResources: &validation.RPResourceSet{ @@ -102,7 +100,7 @@ func Test_TerraformRecipe_KubernetesRedis(t *testing.T) { }, }, }, - PostStepVerify: func(ctx context.Context, t *testing.T, test shared.RPTest) { + PostStepVerify: func(ctx context.Context, t *testing.T, test rp.RPTest) { secret, err := test.Options.K8sClient.CoreV1().Secrets(secretNamespace). Get(ctx, secretPrefix+secretSuffix, metav1.GetOptions{}) require.NoError(t, err) @@ -129,9 +127,9 @@ func Test_TerraformRecipe_KubernetesRedis(t *testing.T) { }, }) - test.PostDeleteVerify = func(ctx context.Context, t *testing.T, test shared.RPTest) { + test.PostDeleteVerify = func(ctx context.Context, t *testing.T, test rp.RPTest) { resourceID := "/planes/radius/local/resourcegroups/kind-radius/providers/Applications.Core/extenders/" + name - testSecretDeletion(t, ctx, test, appName, envName, resourceID) + corerp.TestSecretDeletion(t, ctx, test, appName, envName, resourceID, secretNamespace, secretPrefix) } test.Test(t) @@ -142,10 +140,10 @@ func Test_TerraformRecipe_Context(t *testing.T) { name := "corerp-resources-terraform-context" appNamespace := "corerp-resources-terraform-context-app" - secretSuffix, err := getSecretSuffix("/planes/radius/local/resourcegroups/kind-radius/providers/Applications.Core/extenders/"+name, name, name) + secretSuffix, err := corerp.GetSecretSuffix("/planes/radius/local/resourcegroups/kind-radius/providers/Applications.Core/extenders/"+name, name, name) require.NoError(t, err) - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetTerraformRecipeModuleServerURL()), RPResources: &validation.RPResourceSet{ @@ -175,7 +173,7 @@ func Test_TerraformRecipe_Context(t *testing.T) { }, }, }, - PostStepVerify: func(ctx context.Context, t *testing.T, test shared.RPTest) { + PostStepVerify: func(ctx context.Context, t *testing.T, test rp.RPTest) { // `k8ssecret-context` recipe should have created a secret with the populated recipe context. s, err := test.Options.K8sClient.CoreV1().Secrets(appNamespace).Get(ctx, name, metav1.GetOptions{}) require.NoError(t, err) @@ -222,59 +220,9 @@ func Test_TerraformRecipe_Context(t *testing.T) { }, }) - test.PostDeleteVerify = func(ctx context.Context, t *testing.T, test shared.RPTest) { + test.PostDeleteVerify = func(ctx context.Context, t *testing.T, test rp.RPTest) { resourceID := "/planes/radius/local/resourcegroups/kind-radius/providers/Applications.Core/extenders/" + name - testSecretDeletion(t, ctx, test, name, name, resourceID) - } - - test.Test(t) -} - -// Test_TerraformRecipe_AzureStorage creates an Extender resource consuming a Terraform recipe that deploys an Azure blob storage instance. -func Test_TerraformRecipe_AzureStorage(t *testing.T) { - template := "testdata/corerp-resources-terraform-azurestorage.bicep" - name := "corerp-resources-terraform-azstorage" - appName := "corerp-resources-terraform-azstorage-app" - envName := "corerp-resources-terraform-azstorage-env" - - test := shared.NewRPTest(t, name, []shared.TestStep{ - { - Executor: step.NewDeployExecutor(template, testutil.GetTerraformRecipeModuleServerURL(), "appName="+appName), - RPResources: &validation.RPResourceSet{ - Resources: []validation.RPResource{ - { - Name: envName, - Type: validation.EnvironmentsResource, - }, - { - Name: appName, - Type: validation.ApplicationsResource, - }, - { - Name: name, - Type: validation.ExtendersResource, - App: appName, - }, - }, - }, - SkipObjectValidation: true, - PostStepVerify: func(ctx context.Context, t *testing.T, test shared.RPTest) { - resourceID := "/planes/radius/local/resourcegroups/kind-radius/providers/Applications.Core/extenders/" + name - secretSuffix, err := getSecretSuffix(resourceID, envName, appName) - require.NoError(t, err) - - secret, err := test.Options.K8sClient.CoreV1().Secrets(secretNamespace). - Get(ctx, secretPrefix+secretSuffix, metav1.GetOptions{}) - require.NoError(t, err) - require.Equal(t, secretNamespace, secret.Namespace) - require.Equal(t, secretPrefix+secretSuffix, secret.Name) - }, - }, - }) - - test.PostDeleteVerify = func(ctx context.Context, t *testing.T, test shared.RPTest) { - resourceID := "/planes/radius/local/resourcegroups/kind-radius/providers/Applications.Core/extenders/" + name - testSecretDeletion(t, ctx, test, appName, envName, resourceID) + corerp.TestSecretDeletion(t, ctx, test, name, name, resourceID, secretNamespace, secretPrefix) } test.Test(t) @@ -307,7 +255,7 @@ func Test_TerraformRecipe_ParametersAndOutputs(t *testing.T) { "@" + parametersFilePath, } - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, parameters...), RPResources: &validation.RPResourceSet{ @@ -327,7 +275,7 @@ func Test_TerraformRecipe_ParametersAndOutputs(t *testing.T) { }, }, K8sObjects: &validation.K8sObjectSet{}, - PostStepVerify: func(ctx context.Context, t *testing.T, test shared.RPTest) { + PostStepVerify: func(ctx context.Context, t *testing.T, test rp.RPTest) { resource, err := test.Options.ManagementClient.ShowResource(ctx, "Applications.Core/extenders", name) require.NoError(t, err) @@ -372,7 +320,7 @@ func Test_TerraformRecipe_WrongOutput(t *testing.T) { }, }) - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployErrorExecutor(template, validate, parameters...), RPResources: &validation.RPResourceSet{ @@ -393,35 +341,3 @@ func Test_TerraformRecipe_WrongOutput(t *testing.T) { test.Test(t) } - -func testSecretDeletion(t *testing.T, ctx context.Context, test shared.RPTest, appName, envName, resourceID string) { - secretSuffix, err := getSecretSuffix(resourceID, envName, appName) - require.NoError(t, err) - - secret, err := test.Options.K8sClient.CoreV1().Secrets(secretNamespace). - Get(ctx, secretPrefix+secretSuffix, metav1.GetOptions{}) - require.Error(t, err) - require.True(t, apierrors.IsNotFound(err)) - require.Equal(t, secret, &corev1.Secret{}) -} - -func getSecretSuffix(resourceID, envName, appName string) (string, error) { - envID := "/planes/radius/local/resourcegroups/kind-radius/providers/Applications.Core/environments/" + envName - appID := "/planes/radius/local/resourcegroups/kind-radius/providers/Applications.Core/applications/" + appName - - resourceRecipe := recipes.ResourceMetadata{ - EnvironmentID: envID, - ApplicationID: appID, - ResourceID: resourceID, - Parameters: nil, - } - - backend := backends.NewKubernetesBackend(nil) - secretMap, err := backend.BuildBackend(&resourceRecipe) - if err != nil { - return "", err - } - kubernetes := secretMap["kubernetes"].(map[string]any) - - return kubernetes["secret_suffix"].(string), nil -} diff --git a/test/functional/shared/resources/recipe_test.go b/test/functional-portable/corerp/noncloud/resources/recipe_test.go similarity index 94% rename from test/functional/shared/resources/recipe_test.go rename to test/functional-portable/corerp/noncloud/resources/recipe_test.go index 28ca5f5eeb..fe5af73eb1 100644 --- a/test/functional/shared/resources/recipe_test.go +++ b/test/functional-portable/corerp/noncloud/resources/recipe_test.go @@ -21,7 +21,7 @@ import ( "testing" "github.com/radius-project/radius/pkg/recipes" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/validation" ) @@ -47,7 +47,7 @@ func Test_Recipe_NotFound(t *testing.T) { }, }) - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployErrorExecutor(template, validate, fmt.Sprintf("basename=%s", name)), RPResources: &validation.RPResourceSet{ diff --git a/test/functional/shared/resources/simulated_environment_test.go b/test/functional-portable/corerp/noncloud/resources/simulated_environment_test.go similarity index 92% rename from test/functional/shared/resources/simulated_environment_test.go rename to test/functional-portable/corerp/noncloud/resources/simulated_environment_test.go index b98a79e81a..cc782a2e72 100644 --- a/test/functional/shared/resources/simulated_environment_test.go +++ b/test/functional-portable/corerp/noncloud/resources/simulated_environment_test.go @@ -21,7 +21,7 @@ import ( "fmt" "testing" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/testutil" "github.com/radius-project/radius/test/validation" @@ -34,7 +34,7 @@ func Test_Deployment_SimulatedEnv(t *testing.T) { name := "corerp-resources-simulatedenv" appNamespace := "default-corerp-resources-simulatedenv" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage()), RPResources: &validation.RPResourceSet{ @@ -72,7 +72,7 @@ func Test_Deployment_SimulatedEnv(t *testing.T) { }, SkipKubernetesOutputResourceValidation: true, SkipObjectValidation: true, - PostStepVerify: func(ctx context.Context, t *testing.T, ct shared.RPTest) { + PostStepVerify: func(ctx context.Context, t *testing.T, ct rp.RPTest) { // Get pods in app namespace label := fmt.Sprintf("radapp.io/application=%s", name) pods, err := ct.Options.K8sClient.CoreV1().Pods(appNamespace).List(ctx, metav1.ListOptions{ diff --git a/test/functional/shared/resources/testdata/containers/corerp-resources-friendly-container-version-1.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/containers/corerp-resources-friendly-container-version-1.bicep similarity index 100% rename from test/functional/shared/resources/testdata/containers/corerp-resources-friendly-container-version-1.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/containers/corerp-resources-friendly-container-version-1.bicep diff --git a/test/functional/shared/resources/testdata/containers/corerp-resources-friendly-container-version-2.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/containers/corerp-resources-friendly-container-version-2.bicep similarity index 100% rename from test/functional/shared/resources/testdata/containers/corerp-resources-friendly-container-version-2.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/containers/corerp-resources-friendly-container-version-2.bicep diff --git a/test/functional/shared/resources/testdata/corerp-azure-container-manualscale.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-azure-container-manualscale.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-azure-container-manualscale.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-azure-container-manualscale.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-app-env.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-app-env.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-app-env.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-app-env.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-application-graph-out.json b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-application-graph-out.json similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-application-graph-out.json rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-application-graph-out.json diff --git a/test/functional/shared/resources/testdata/corerp-resources-application-graph.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-application-graph.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-application-graph.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-application-graph.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-application.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-application.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-application.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-application.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-container-bad-healthprobe.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-container-bad-healthprobe.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-container-bad-healthprobe.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-container-bad-healthprobe.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-container-cmd-args.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-container-cmd-args.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-container-cmd-args.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-container-cmd-args.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-container-liveness-readiness.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-container-liveness-readiness.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-container-liveness-readiness.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-container-liveness-readiness.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-container-manifest-sidecar.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-container-manifest-sidecar.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-container-manifest-sidecar.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-container-manifest-sidecar.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-container-manifest.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-container-manifest.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-container-manifest.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-container-manifest.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-container-multiple-containers-multiple-ports-dns.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-container-multiple-containers-multiple-ports-dns.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-container-multiple-containers-multiple-ports-dns.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-container-multiple-containers-multiple-ports-dns.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-container-multiple-ports.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-container-multiple-ports.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-container-multiple-ports.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-container-multiple-ports.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-container-nonexistent-container-image.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-container-nonexistent-container-image.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-container-nonexistent-container-image.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-container-nonexistent-container-image.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-container-optional-port-scheme.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-container-optional-port-scheme.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-container-optional-port-scheme.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-container-optional-port-scheme.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-container-pod-patching.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-container-pod-patching.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-container-pod-patching.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-container-pod-patching.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-container-single-dns-request.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-container-single-dns-request.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-container-single-dns-request.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-container-single-dns-request.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-container-single-dns-service-creation.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-container-single-dns-service-creation.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-container-single-dns-service-creation.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-container-single-dns-service-creation.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-container-two-containers-dns.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-container-two-containers-dns.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-container-two-containers-dns.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-container-two-containers-dns.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-container.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-container.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-container.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-container.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-environment.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-environment.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-environment.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-environment.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-extender-recipe.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-extender-recipe.bicep similarity index 92% rename from test/functional/shared/resources/testdata/corerp-resources-extender-recipe.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-extender-recipe.bicep index b111e6d8c8..bca6d696ed 100644 --- a/test/functional/shared/resources/testdata/corerp-resources-extender-recipe.bicep +++ b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-extender-recipe.bicep @@ -18,7 +18,7 @@ resource env 'Applications.Core/environments@2023-10-01-preview' = { 'Applications.Core/extenders':{ default: { templateKind: 'bicep' - templatePath: '${registry}/test/functional/shared/recipes/extender-recipe:${version}' + templatePath: '${registry}/test/testrecipes/test-bicep-recipes/extender-recipe:${version}' parameters: { containerImage: '${registry}/magpiego:${version}' } diff --git a/test/functional/shared/resources/testdata/corerp-resources-extender.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-extender.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-extender.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-extender.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-gateway-dns.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-gateway-dns.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-gateway-dns.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-gateway-dns.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-gateway-failure.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-gateway-failure.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-gateway-failure.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-gateway-failure.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-gateway-kubernetesmetadata.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-gateway-kubernetesmetadata.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-gateway-kubernetesmetadata.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-gateway-kubernetesmetadata.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-gateway-sslpassthrough.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-gateway-sslpassthrough.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-gateway-sslpassthrough.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-gateway-sslpassthrough.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-gateway-tlstermination.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-gateway-tlstermination.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-gateway-tlstermination.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-gateway-tlstermination.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-httproute-kubernetesmetadata.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-httproute-kubernetesmetadata.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-httproute-kubernetesmetadata.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-httproute-kubernetesmetadata.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-kubemetadata-cascade.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-kubemetadata-cascade.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-kubemetadata-cascade.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-kubemetadata-cascade.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-kubemetadata-container.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-kubemetadata-container.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-kubemetadata-container.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-kubemetadata-container.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-recipe-bicep-resourcecreation.step0.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-recipe-bicep-resourcecreation.step0.bicep similarity index 94% rename from test/functional/shared/resources/testdata/corerp-resources-recipe-bicep-resourcecreation.step0.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-recipe-bicep-resourcecreation.step0.bicep index c09b173e28..6f6393b7fa 100644 --- a/test/functional/shared/resources/testdata/corerp-resources-recipe-bicep-resourcecreation.step0.bicep +++ b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-recipe-bicep-resourcecreation.step0.bicep @@ -26,7 +26,7 @@ resource env 'Applications.Core/environments@2023-10-01-preview' = { 'Applications.Core/extenders': { '${environmentRecipeName}': { templateKind: 'bicep' - templatePath: '${registry}/test/functional/shared/recipes/${recipe}:${version}' + templatePath: '${registry}/test/testrecipes/test-bicep-recipes/${recipe}:${version}' parameters: environmentParameters } } diff --git a/test/functional/shared/resources/testdata/corerp-resources-recipe-bicep-resourcecreation.step1.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-recipe-bicep-resourcecreation.step1.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-recipe-bicep-resourcecreation.step1.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-recipe-bicep-resourcecreation.step1.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-recipe-bicep.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-recipe-bicep.bicep similarity index 94% rename from test/functional/shared/resources/testdata/corerp-resources-recipe-bicep.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-recipe-bicep.bicep index 39cca4d3bf..cb30e86ec6 100644 --- a/test/functional/shared/resources/testdata/corerp-resources-recipe-bicep.bicep +++ b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-recipe-bicep.bicep @@ -30,7 +30,7 @@ resource env 'Applications.Core/environments@2023-10-01-preview' = { 'Applications.Core/extenders': { '${environmentRecipeName}': { templateKind: 'bicep' - templatePath: '${registry}/test/functional/shared/recipes/${recipe}:${version}' + templatePath: '${registry}/test/testrecipes/test-bicep-recipes/${recipe}:${version}' parameters: environmentParameters } } diff --git a/test/functional/shared/resources/testdata/corerp-resources-recipe-notfound.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-recipe-notfound.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-recipe-notfound.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-recipe-notfound.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-simulatedenv.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-simulatedenv.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-simulatedenv.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-simulatedenv.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-terraform-context.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-terraform-context.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-terraform-context.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-terraform-context.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-terraform-recipe-terraform.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-terraform-recipe-terraform.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-terraform-recipe-terraform.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-terraform-recipe-terraform.bicep diff --git a/test/functional/shared/resources/testdata/corerp-resources-terraform-redis.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-terraform-redis.bicep similarity index 100% rename from test/functional/shared/resources/testdata/corerp-resources-terraform-redis.bicep rename to test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-terraform-redis.bicep diff --git a/test/functional/shared/resources/testdata/manifest/basemanifest.yaml b/test/functional-portable/corerp/noncloud/resources/testdata/manifest/basemanifest.yaml similarity index 100% rename from test/functional/shared/resources/testdata/manifest/basemanifest.yaml rename to test/functional-portable/corerp/noncloud/resources/testdata/manifest/basemanifest.yaml diff --git a/test/functional/shared/resources/testdata/manifest/sidecar.yaml b/test/functional-portable/corerp/noncloud/resources/testdata/manifest/sidecar.yaml similarity index 100% rename from test/functional/shared/resources/testdata/manifest/sidecar.yaml rename to test/functional-portable/corerp/noncloud/resources/testdata/manifest/sidecar.yaml diff --git a/test/functional/shared/resources/testdata/parameters/test-tls-cert.parameters.json b/test/functional-portable/corerp/noncloud/resources/testdata/parameters/test-tls-cert.parameters.json similarity index 100% rename from test/functional/shared/resources/testdata/parameters/test-tls-cert.parameters.json rename to test/functional-portable/corerp/noncloud/resources/testdata/parameters/test-tls-cert.parameters.json diff --git a/test/functional-portable/corerp/util.go b/test/functional-portable/corerp/util.go new file mode 100644 index 0000000000..6063171872 --- /dev/null +++ b/test/functional-portable/corerp/util.go @@ -0,0 +1,65 @@ +/* +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. +*/ + +package corerp + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + corev1 "k8s.io/api/core/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/radius-project/radius/pkg/recipes" + "github.com/radius-project/radius/pkg/recipes/terraform/config/backends" + "github.com/radius-project/radius/test/rp" +) + +// TestSecretDeletion tests that the secret is deleted after the resource is deleted +func TestSecretDeletion(t *testing.T, ctx context.Context, test rp.RPTest, appName, envName, resourceID string, secretNamespace string, secretPrefix string) { + secretSuffix, err := GetSecretSuffix(resourceID, envName, appName) + require.NoError(t, err) + + secret, err := test.Options.K8sClient.CoreV1().Secrets(secretNamespace). + Get(ctx, secretPrefix+secretSuffix, metav1.GetOptions{}) + require.Error(t, err) + require.True(t, apierrors.IsNotFound(err)) + require.Equal(t, secret, &corev1.Secret{}) +} + +// GetSecretSuffix returns the secret suffix for a given resource +func GetSecretSuffix(resourceID, envName, appName string) (string, error) { + envID := "/planes/radius/local/resourcegroups/kind-radius/providers/Applications.Core/environments/" + envName + appID := "/planes/radius/local/resourcegroups/kind-radius/providers/Applications.Core/applications/" + appName + + resourceRecipe := recipes.ResourceMetadata{ + EnvironmentID: envID, + ApplicationID: appID, + ResourceID: resourceID, + Parameters: nil, + } + + backend := backends.NewKubernetesBackend(nil) + secretMap, err := backend.BuildBackend(&resourceRecipe) + if err != nil { + return "", err + } + kubernetes := secretMap["kubernetes"].(map[string]any) + + return kubernetes["secret_suffix"].(string), nil +} diff --git a/test/functional-portable/daprrp/noncloud/resources/common.go b/test/functional-portable/daprrp/noncloud/resources/common.go index 3d4b53d380..97c84c6f85 100644 --- a/test/functional-portable/daprrp/noncloud/resources/common.go +++ b/test/functional-portable/daprrp/noncloud/resources/common.go @@ -22,7 +22,7 @@ import ( "github.com/radius-project/radius/pkg/cli/clients" "github.com/radius-project/radius/pkg/cli/clients_new/generated" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/stretchr/testify/require" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -30,7 +30,7 @@ import ( "k8s.io/client-go/dynamic" ) -func verifyDaprComponentsDeleted(ctx context.Context, t *testing.T, test shared.RPTest, resourceType, resourceName, namespace string) { +func verifyDaprComponentsDeleted(ctx context.Context, t *testing.T, test rp.RPTest, resourceType, resourceName, namespace string) { resource, err := test.Options.ManagementClient.ShowResource(ctx, resourceType, resourceName) require.Error(t, err) require.True(t, clients.Is404Error(err)) diff --git a/test/functional-portable/daprrp/noncloud/resources/dapr_component_name_conflict_test.go b/test/functional-portable/daprrp/noncloud/resources/dapr_component_name_conflict_test.go index acdd7049a2..81317a294d 100644 --- a/test/functional-portable/daprrp/noncloud/resources/dapr_component_name_conflict_test.go +++ b/test/functional-portable/daprrp/noncloud/resources/dapr_component_name_conflict_test.go @@ -20,7 +20,7 @@ import ( "testing" v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/validation" ) @@ -39,14 +39,14 @@ func Test_DaprComponentNameConflict(t *testing.T) { }, }) - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployErrorExecutor(template, validate), SkipKubernetesOutputResourceValidation: true, K8sObjects: &validation.K8sObjectSet{}, }, }) - test.RequiredFeatures = []shared.RequiredFeature{shared.FeatureDapr} + test.RequiredFeatures = []rp.RequiredFeature{rp.FeatureDapr} test.Test(t) } diff --git a/test/functional-portable/daprrp/noncloud/resources/dapr_pubsub_test.go b/test/functional-portable/daprrp/noncloud/resources/dapr_pubsub_test.go index 7641c5e4e3..ea49c3d0da 100644 --- a/test/functional-portable/daprrp/noncloud/resources/dapr_pubsub_test.go +++ b/test/functional-portable/daprrp/noncloud/resources/dapr_pubsub_test.go @@ -21,7 +21,7 @@ import ( "fmt" "testing" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/testutil" "github.com/radius-project/radius/test/validation" @@ -32,7 +32,7 @@ func Test_DaprPubSubBroker_Manual(t *testing.T) { name := "dpsb-manual-app" appNamespace := "default-dpsb-manual-app" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage(), fmt.Sprintf("namespace=%s", appNamespace)), RPResources: &validation.RPResourceSet{ @@ -70,9 +70,9 @@ func Test_DaprPubSubBroker_Manual(t *testing.T) { }, }) - test.RequiredFeatures = []shared.RequiredFeature{shared.FeatureDapr} + test.RequiredFeatures = []rp.RequiredFeature{rp.FeatureDapr} - test.PostDeleteVerify = func(ctx context.Context, t *testing.T, test shared.RPTest) { + test.PostDeleteVerify = func(ctx context.Context, t *testing.T, test rp.RPTest) { verifyDaprComponentsDeleted(ctx, t, test, "Applications.Dapr/pubSubBrokers", "dpsb-manual", appNamespace) } @@ -84,7 +84,7 @@ func Test_DaprPubSubBroker_Recipe(t *testing.T) { name := "dpsb-recipe-app" appNamespace := "dpsb-recipe-env" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage(), testutil.GetBicepRecipeRegistry(), testutil.GetBicepRecipeVersion()), RPResources: &validation.RPResourceSet{ @@ -124,9 +124,9 @@ func Test_DaprPubSubBroker_Recipe(t *testing.T) { }, }) - test.RequiredFeatures = []shared.RequiredFeature{shared.FeatureDapr} + test.RequiredFeatures = []rp.RequiredFeature{rp.FeatureDapr} - test.PostDeleteVerify = func(ctx context.Context, t *testing.T, test shared.RPTest) { + test.PostDeleteVerify = func(ctx context.Context, t *testing.T, test rp.RPTest) { verifyDaprComponentsDeleted(ctx, t, test, "Applications.Dapr/pubSubBrokers", "dpsb-recipe", appNamespace) } diff --git a/test/functional-portable/daprrp/noncloud/resources/dapr_secretstore_test.go b/test/functional-portable/daprrp/noncloud/resources/dapr_secretstore_test.go index 342d6f6e72..bb2459de3c 100644 --- a/test/functional-portable/daprrp/noncloud/resources/dapr_secretstore_test.go +++ b/test/functional-portable/daprrp/noncloud/resources/dapr_secretstore_test.go @@ -20,7 +20,7 @@ import ( "context" "testing" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/testutil" "github.com/radius-project/radius/test/validation" @@ -31,7 +31,7 @@ func Test_DaprSecretStore_Manual(t *testing.T) { name := "daprrp-rs-secretstore-manual" appNamespace := "default-daprrp-rs-secretstore-manual" - test := shared.NewRPTest(t, appNamespace, []shared.TestStep{ + test := rp.NewRPTest(t, appNamespace, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage()), RPResources: &validation.RPResourceSet{ @@ -64,11 +64,11 @@ func Test_DaprSecretStore_Manual(t *testing.T) { }, }, }, - }, shared.K8sSecretResource(appNamespace, "mysecret", "", "fakekey", []byte("fakevalue"))) + }, rp.K8sSecretResource(appNamespace, "mysecret", "", "fakekey", []byte("fakevalue"))) - test.RequiredFeatures = []shared.RequiredFeature{shared.FeatureDapr} + test.RequiredFeatures = []rp.RequiredFeature{rp.FeatureDapr} - test.PostDeleteVerify = func(ctx context.Context, t *testing.T, test shared.RPTest) { + test.PostDeleteVerify = func(ctx context.Context, t *testing.T, test rp.RPTest) { verifyDaprComponentsDeleted(ctx, t, test, "Applications.Dapr/secretStores", "gnrc-scs-manual", appNamespace) } @@ -80,7 +80,7 @@ func Test_DaprSecretStore_Recipe(t *testing.T) { name := "daprrp-rs-secretstore-recipe" appNamespace := "daprrp-rs-secretstore-recipe" - test := shared.NewRPTest(t, appNamespace, []shared.TestStep{ + test := rp.NewRPTest(t, appNamespace, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage(), testutil.GetBicepRecipeRegistry(), testutil.GetBicepRecipeVersion()), RPResources: &validation.RPResourceSet{ @@ -113,11 +113,11 @@ func Test_DaprSecretStore_Recipe(t *testing.T) { }, }, }, - }, shared.K8sSecretResource(appNamespace, "mysecret", "", "fakekey", []byte("fakevalue"))) + }, rp.K8sSecretResource(appNamespace, "mysecret", "", "fakekey", []byte("fakevalue"))) - test.RequiredFeatures = []shared.RequiredFeature{shared.FeatureDapr} + test.RequiredFeatures = []rp.RequiredFeature{rp.FeatureDapr} - test.PostDeleteVerify = func(ctx context.Context, t *testing.T, test shared.RPTest) { + test.PostDeleteVerify = func(ctx context.Context, t *testing.T, test rp.RPTest) { verifyDaprComponentsDeleted(ctx, t, test, "Applications.Dapr/secretStores", "gnrc-scs-recipe", appNamespace) } diff --git a/test/functional-portable/daprrp/noncloud/resources/dapr_serviceinvocation_test.go b/test/functional-portable/daprrp/noncloud/resources/dapr_serviceinvocation_test.go index fbc3297fd4..765e51e172 100644 --- a/test/functional-portable/daprrp/noncloud/resources/dapr_serviceinvocation_test.go +++ b/test/functional-portable/daprrp/noncloud/resources/dapr_serviceinvocation_test.go @@ -19,7 +19,7 @@ package resource_test import ( "testing" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/testutil" "github.com/radius-project/radius/test/validation" @@ -30,7 +30,7 @@ func Test_DaprServiceInvocation(t *testing.T) { name := "dapr-serviceinvocation" appNamespace := "default-dapr-serviceinvocation" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage()), RPResources: &validation.RPResourceSet{ @@ -61,7 +61,7 @@ func Test_DaprServiceInvocation(t *testing.T) { }, }, }) - test.RequiredFeatures = []shared.RequiredFeature{shared.FeatureDapr} + test.RequiredFeatures = []rp.RequiredFeature{rp.FeatureDapr} test.Test(t) } diff --git a/test/functional-portable/daprrp/noncloud/resources/dapr_statestore_test.go b/test/functional-portable/daprrp/noncloud/resources/dapr_statestore_test.go index 21bc7e2a75..448e298c9e 100644 --- a/test/functional-portable/daprrp/noncloud/resources/dapr_statestore_test.go +++ b/test/functional-portable/daprrp/noncloud/resources/dapr_statestore_test.go @@ -21,7 +21,7 @@ import ( "fmt" "testing" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/testutil" "github.com/radius-project/radius/test/validation" @@ -32,7 +32,7 @@ func Test_DaprStateStore_Manual(t *testing.T) { name := "daprrp-rs-statestore-manual" appNamespace := "default-daprrp-rs-statestore-manual" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage(), fmt.Sprintf("namespace=%s", appNamespace)), RPResources: &validation.RPResourceSet{ @@ -72,9 +72,9 @@ func Test_DaprStateStore_Manual(t *testing.T) { }, }) - test.RequiredFeatures = []shared.RequiredFeature{shared.FeatureDapr} + test.RequiredFeatures = []rp.RequiredFeature{rp.FeatureDapr} - test.PostDeleteVerify = func(ctx context.Context, t *testing.T, test shared.RPTest) { + test.PostDeleteVerify = func(ctx context.Context, t *testing.T, test rp.RPTest) { verifyDaprComponentsDeleted(ctx, t, test, "Applications.Dapr/stateStores", "dapr-sts-manual", appNamespace) } @@ -86,7 +86,7 @@ func Test_DaprStateStore_Recipe(t *testing.T) { name := "daprrp-rs-sts-recipe" appNamespace := "daprrp-env-recipes-env" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage(), testutil.GetBicepRecipeRegistry(), testutil.GetBicepRecipeVersion()), RPResources: &validation.RPResourceSet{ @@ -126,9 +126,9 @@ func Test_DaprStateStore_Recipe(t *testing.T) { }, }) - test.RequiredFeatures = []shared.RequiredFeature{shared.FeatureDapr} + test.RequiredFeatures = []rp.RequiredFeature{rp.FeatureDapr} - test.PostDeleteVerify = func(ctx context.Context, t *testing.T, test shared.RPTest) { + test.PostDeleteVerify = func(ctx context.Context, t *testing.T, test rp.RPTest) { verifyDaprComponentsDeleted(ctx, t, test, "Applications.Dapr/stateStores", "dapr-sts-recipe", appNamespace) } diff --git a/test/functional-portable/daprrp/noncloud/resources/testdata/daprrp-resources-pubsub-broker-manual.bicep b/test/functional-portable/daprrp/noncloud/resources/testdata/daprrp-resources-pubsub-broker-manual.bicep index 4dd9371036..39218a6580 100644 --- a/test/functional-portable/daprrp/noncloud/resources/testdata/daprrp-resources-pubsub-broker-manual.bicep +++ b/test/functional-portable/daprrp/noncloud/resources/testdata/daprrp-resources-pubsub-broker-manual.bicep @@ -39,7 +39,7 @@ resource myapp 'Applications.Core/containers@2023-10-01-preview' = { } -module redis '../../../../../functional/shared/resources/testdata/modules/redis-selfhost.bicep' = { +module redis '../../../../../../test/testrecipes/modules/redis-selfhost.bicep' = { name: 'dpsb-manual-redis-deployment' params: { name: 'dpsb-manual-redis' diff --git a/test/functional-portable/daprrp/noncloud/resources/testdata/daprrp-resources-pubsub-broker-recipe.bicep b/test/functional-portable/daprrp/noncloud/resources/testdata/daprrp-resources-pubsub-broker-recipe.bicep index 0fa7d537cc..04bd396d5e 100644 --- a/test/functional-portable/daprrp/noncloud/resources/testdata/daprrp-resources-pubsub-broker-recipe.bicep +++ b/test/functional-portable/daprrp/noncloud/resources/testdata/daprrp-resources-pubsub-broker-recipe.bicep @@ -16,7 +16,7 @@ resource env 'Applications.Core/environments@2023-10-01-preview' = { 'Applications.Dapr/pubSubBrokers': { default: { templateKind: 'bicep' - templatePath: '${registry}/test/functional/shared/recipes/dapr-pubsub-broker:${version}' + templatePath: '${registry}/test/testrecipes/test-bicep-recipes/dapr-pubsub-broker:${version}' } } } diff --git a/test/functional-portable/daprrp/noncloud/resources/testdata/daprrp-resources-secretstore-recipe.bicep b/test/functional-portable/daprrp/noncloud/resources/testdata/daprrp-resources-secretstore-recipe.bicep index fcac516e9b..aa911c23e6 100644 --- a/test/functional-portable/daprrp/noncloud/resources/testdata/daprrp-resources-secretstore-recipe.bicep +++ b/test/functional-portable/daprrp/noncloud/resources/testdata/daprrp-resources-secretstore-recipe.bicep @@ -18,7 +18,7 @@ resource env 'Applications.Core/environments@2023-10-01-preview' = { 'Applications.Dapr/secretStores': { default: { templateKind: 'bicep' - templatePath: '${registry}/test/functional/shared/recipes/dapr-secret-store:${version}' + templatePath: '${registry}/test/testrecipes/test-bicep-recipes/dapr-secret-store:${version}' } } } diff --git a/test/functional-portable/daprrp/noncloud/resources/testdata/daprrp-resources-statestore-manual.bicep b/test/functional-portable/daprrp/noncloud/resources/testdata/daprrp-resources-statestore-manual.bicep index 0d96d0a543..ed39af5123 100644 --- a/test/functional-portable/daprrp/noncloud/resources/testdata/daprrp-resources-statestore-manual.bicep +++ b/test/functional-portable/daprrp/noncloud/resources/testdata/daprrp-resources-statestore-manual.bicep @@ -39,7 +39,7 @@ resource myapp 'Applications.Core/containers@2023-10-01-preview' = { } -module redis '../../../../../functional/shared/resources/testdata/modules/redis-selfhost.bicep' = { +module redis '../../../../../../test/testrecipes/modules/redis-selfhost.bicep' = { name: 'dapr-sts-manual-redis-deployment' params: { name: 'dapr-sts-manual-redis' diff --git a/test/functional-portable/daprrp/noncloud/resources/testdata/daprrp-resources-statestore-recipe.bicep b/test/functional-portable/daprrp/noncloud/resources/testdata/daprrp-resources-statestore-recipe.bicep index 36ef27176e..4054e67582 100644 --- a/test/functional-portable/daprrp/noncloud/resources/testdata/daprrp-resources-statestore-recipe.bicep +++ b/test/functional-portable/daprrp/noncloud/resources/testdata/daprrp-resources-statestore-recipe.bicep @@ -16,7 +16,7 @@ resource env 'Applications.Core/environments@2023-10-01-preview' = { 'Applications.Dapr/stateStores': { default: { templateKind: 'bicep' - templatePath: '${registry}/test/functional/shared/recipes/dapr-state-store:${version}' + templatePath: '${registry}/test/testrecipes/test-bicep-recipes/dapr-state-store:${version}' } } } diff --git a/test/functional-portable/datastoresrp/cloud/resources/microsoftsql_test.go b/test/functional-portable/datastoresrp/cloud/resources/microsoftsql_test.go index 3e694c4753..1b836fc42a 100644 --- a/test/functional-portable/datastoresrp/cloud/resources/microsoftsql_test.go +++ b/test/functional-portable/datastoresrp/cloud/resources/microsoftsql_test.go @@ -20,7 +20,7 @@ import ( "os" "testing" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/testutil" "github.com/radius-project/radius/test/validation" @@ -49,7 +49,7 @@ func Test_MicrosoftSQL_Manual(t *testing.T) { sqlServer := "server=" + os.Getenv("AZURE_MSSQL_SERVER") appNamespace := "default-dsrp-resources-microsoft-sql" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage(), mssqlresourceid, adminUsername, adminPassword, sqlDatabse, sqlServer), RPResources: &validation.RPResourceSet{ @@ -75,6 +75,6 @@ func Test_MicrosoftSQL_Manual(t *testing.T) { }, }) - test.RequiredFeatures = []shared.RequiredFeature{shared.FeatureAzure} + test.RequiredFeatures = []rp.RequiredFeature{rp.FeatureAzure} test.Test(t) } diff --git a/test/functional-portable/datastoresrp/noncloud/resources/mongodb_test.go b/test/functional-portable/datastoresrp/noncloud/resources/mongodb_test.go index 5c8d2b15ae..ee4a8de670 100644 --- a/test/functional-portable/datastoresrp/noncloud/resources/mongodb_test.go +++ b/test/functional-portable/datastoresrp/noncloud/resources/mongodb_test.go @@ -19,7 +19,7 @@ package resource_test import ( "testing" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/testutil" "github.com/radius-project/radius/test/validation" @@ -31,7 +31,7 @@ func Test_MongoDB_Manual(t *testing.T) { name := "dsrp-resources-mongodb-manual" appNamespace := "default-cdsrp-resources-mongodb-manual" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage()), RPResources: &validation.RPResourceSet{ @@ -78,7 +78,7 @@ func Test_MongoDB_Recipe(t *testing.T) { name := "dsrp-resources-mongodb-recipe" appNamespace := "dsrp-resources-mongodb-recipe-app" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage(), testutil.GetBicepRecipeRegistry(), testutil.GetBicepRecipeVersion()), RPResources: &validation.RPResourceSet{ diff --git a/test/functional-portable/datastoresrp/noncloud/resources/redis_test.go b/test/functional-portable/datastoresrp/noncloud/resources/redis_test.go index d62a62bf1c..d5c128ba8f 100644 --- a/test/functional-portable/datastoresrp/noncloud/resources/redis_test.go +++ b/test/functional-portable/datastoresrp/noncloud/resources/redis_test.go @@ -21,7 +21,7 @@ import ( "strings" "testing" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/testutil" "github.com/radius-project/radius/test/validation" @@ -33,7 +33,7 @@ func Test_Redis_Manual(t *testing.T) { name := "dsrp-resources-redis-manual" appNamespace := "default-dsrp-resources-redis-manual" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage()), RPResources: &validation.RPResourceSet{ @@ -77,7 +77,7 @@ func Test_Redis_Recipe(t *testing.T) { template := "testdata/datastoresrp-resources-redis-recipe.bicep" name := "dsrp-resources-redis-recipe" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetBicepRecipeRegistry(), testutil.GetBicepRecipeVersion()), RPResources: &validation.RPResourceSet{ @@ -98,7 +98,7 @@ func Test_Redis_Recipe(t *testing.T) { }, }, SkipObjectValidation: true, - PostStepVerify: func(ctx context.Context, t *testing.T, test shared.RPTest) { + PostStepVerify: func(ctx context.Context, t *testing.T, test rp.RPTest) { redis, err := test.Options.ManagementClient.ShowResource(ctx, "Applications.Datastores/redisCaches", "rds-recipe") require.NoError(t, err) require.NotNil(t, redis) @@ -106,7 +106,7 @@ func Test_Redis_Recipe(t *testing.T) { recipe := status["recipe"].(map[string]interface{}) require.Equal(t, "bicep", recipe["templateKind"].(string)) templatePath := strings.Split(recipe["templatePath"].(string), ":")[0] - require.Equal(t, "ghcr.io/radius-project/dev/test/functional/shared/recipes/redis-recipe-value-backed", templatePath) + require.Equal(t, "ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/redis-recipe-value-backed", templatePath) }, }, }) @@ -118,7 +118,7 @@ func Test_Redis_DefaultRecipe(t *testing.T) { template := "testdata/datastoresrp-resources-redis-default-recipe.bicep" name := "dsrp-resources-redis-default-recipe" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetBicepRecipeRegistry(), testutil.GetBicepRecipeVersion()), RPResources: &validation.RPResourceSet{ diff --git a/test/functional-portable/datastoresrp/noncloud/resources/simulated_environment_test.go b/test/functional-portable/datastoresrp/noncloud/resources/simulated_environment_test.go index cc2f6b7b4d..828e4065a7 100644 --- a/test/functional-portable/datastoresrp/noncloud/resources/simulated_environment_test.go +++ b/test/functional-portable/datastoresrp/noncloud/resources/simulated_environment_test.go @@ -21,7 +21,7 @@ import ( "fmt" "testing" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/testutil" "github.com/radius-project/radius/test/validation" @@ -37,7 +37,7 @@ func Test_Deployment_SimulatedEnv_BicepRecipe(t *testing.T) { mongoDBName := "mongodb-db-simenv" envName := "dsrp-resources-simenv-recipe-env" - test := shared.NewRPTest(t, appName, []shared.TestStep{ + test := rp.NewRPTest(t, appName, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage(), testutil.GetBicepRecipeRegistry(), testutil.GetBicepRecipeVersion()), RPResources: &validation.RPResourceSet{ @@ -65,7 +65,7 @@ func Test_Deployment_SimulatedEnv_BicepRecipe(t *testing.T) { }, SkipKubernetesOutputResourceValidation: true, SkipObjectValidation: true, - PostStepVerify: func(ctx context.Context, t *testing.T, ct shared.RPTest) { + PostStepVerify: func(ctx context.Context, t *testing.T, ct rp.RPTest) { // Get pods in app namespace label := fmt.Sprintf("radapp.io/application=%s", appName) pods, err := ct.Options.K8sClient.CoreV1().Pods(appNamespace).List(ctx, metav1.ListOptions{ diff --git a/test/functional-portable/datastoresrp/noncloud/resources/sql_test.go b/test/functional-portable/datastoresrp/noncloud/resources/sql_test.go index 0f0a8bb6a6..f1f265114f 100644 --- a/test/functional-portable/datastoresrp/noncloud/resources/sql_test.go +++ b/test/functional-portable/datastoresrp/noncloud/resources/sql_test.go @@ -20,7 +20,7 @@ import ( "runtime" "testing" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/testutil" "github.com/radius-project/radius/test/validation" @@ -35,7 +35,7 @@ func Test_SQLDatabase_Manual(t *testing.T) { name := "dsrp-resources-sql" appNamespace := "default-dsrp-resources-sql" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage()), RPResources: &validation.RPResourceSet{ @@ -82,7 +82,7 @@ func Test_SQLDatabase_Recipe(t *testing.T) { template := "testdata/datastoresrp-resources-sqldb-recipe.bicep" name := "dsrp-resources-sqldb-recipe" appNamespace := "dsrp-resources-sqldb-recipe-app" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage(), testutil.GetBicepRecipeRegistry(), testutil.GetBicepRecipeVersion()), RPResources: &validation.RPResourceSet{ diff --git a/test/functional-portable/datastoresrp/noncloud/resources/testdata/datastoresrp-resources-mongodb-recipe-context.bicep b/test/functional-portable/datastoresrp/noncloud/resources/testdata/datastoresrp-resources-mongodb-recipe-context.bicep index a4899038a9..5c7a0ef04d 100644 --- a/test/functional-portable/datastoresrp/noncloud/resources/testdata/datastoresrp-resources-mongodb-recipe-context.bicep +++ b/test/functional-portable/datastoresrp/noncloud/resources/testdata/datastoresrp-resources-mongodb-recipe-context.bicep @@ -28,7 +28,7 @@ resource env 'Applications.Core/environments@2023-10-01-preview' = { 'Applications.Datastores/mongoDatabases':{ default: { templateKind: 'bicep' - templatePath: '${registry}/test/functional/shared/recipes/mongodb-recipe-context:${version}' + templatePath: '${registry}/test/testrecipes/test-bicep-recipes/mongodb-recipe-context:${version}' } } } diff --git a/test/functional-portable/datastoresrp/noncloud/resources/testdata/datastoresrp-resources-mongodb-recipe.bicep b/test/functional-portable/datastoresrp/noncloud/resources/testdata/datastoresrp-resources-mongodb-recipe.bicep index 9041e75a93..ccdc10dd63 100644 --- a/test/functional-portable/datastoresrp/noncloud/resources/testdata/datastoresrp-resources-mongodb-recipe.bicep +++ b/test/functional-portable/datastoresrp/noncloud/resources/testdata/datastoresrp-resources-mongodb-recipe.bicep @@ -28,7 +28,7 @@ resource env 'Applications.Core/environments@2023-10-01-preview' = { 'Applications.Datastores/mongoDatabases':{ mongoazure: { templateKind: 'bicep' - templatePath: '${registry}/test/functional/shared/recipes/mongodb-recipe-kubernetes:${version}' + templatePath: '${registry}/test/testrecipes/test-bicep-recipes/mongodb-recipe-kubernetes:${version}' } } } diff --git a/test/functional-portable/datastoresrp/noncloud/resources/testdata/datastoresrp-resources-redis-default-recipe.bicep b/test/functional-portable/datastoresrp/noncloud/resources/testdata/datastoresrp-resources-redis-default-recipe.bicep index dff0fccce7..81fed90878 100644 --- a/test/functional-portable/datastoresrp/noncloud/resources/testdata/datastoresrp-resources-redis-default-recipe.bicep +++ b/test/functional-portable/datastoresrp/noncloud/resources/testdata/datastoresrp-resources-redis-default-recipe.bicep @@ -24,7 +24,7 @@ resource env 'Applications.Core/environments@2023-10-01-preview' = { 'Applications.Datastores/redisCaches': { default: { templateKind: 'bicep' - templatePath: '${registry}/test/functional/shared/recipes/redis-recipe-value-backed:${version}' + templatePath: '${registry}/test/testrecipes/test-bicep-recipes/redis-recipe-value-backed:${version}' } } } diff --git a/test/functional-portable/datastoresrp/noncloud/resources/testdata/datastoresrp-resources-redis-recipe.bicep b/test/functional-portable/datastoresrp/noncloud/resources/testdata/datastoresrp-resources-redis-recipe.bicep index 2f518b3614..99304a666a 100644 --- a/test/functional-portable/datastoresrp/noncloud/resources/testdata/datastoresrp-resources-redis-recipe.bicep +++ b/test/functional-portable/datastoresrp/noncloud/resources/testdata/datastoresrp-resources-redis-recipe.bicep @@ -24,7 +24,7 @@ resource env 'Applications.Core/environments@2023-10-01-preview' = { 'Applications.Datastores/redisCaches':{ rediscache: { templateKind: 'bicep' - templatePath: '${registry}/test/functional/shared/recipes/redis-recipe-value-backed:${version}' + templatePath: '${registry}/test/testrecipes/test-bicep-recipes/redis-recipe-value-backed:${version}' } } } diff --git a/test/functional-portable/datastoresrp/noncloud/resources/testdata/datastoresrp-resources-simulatedenv-recipe.bicep b/test/functional-portable/datastoresrp/noncloud/resources/testdata/datastoresrp-resources-simulatedenv-recipe.bicep index 42fbbef164..b590629c85 100644 --- a/test/functional-portable/datastoresrp/noncloud/resources/testdata/datastoresrp-resources-simulatedenv-recipe.bicep +++ b/test/functional-portable/datastoresrp/noncloud/resources/testdata/datastoresrp-resources-simulatedenv-recipe.bicep @@ -19,7 +19,7 @@ resource env 'Applications.Core/environments@2023-10-01-preview' = { 'Applications.Datastores/mongoDatabases':{ 'mongodb-recipe-kubernetes': { templateKind: 'bicep' - templatePath: '${registry}/test/functional/shared/recipes/mongodb-recipe-kubernetes:${version}' + templatePath: '${registry}/test/testrecipes/test-bicep-recipes/mongodb-recipe-kubernetes:${version}' } } } diff --git a/test/functional-portable/datastoresrp/noncloud/resources/testdata/datastoresrp-resources-sqldb-recipe.bicep b/test/functional-portable/datastoresrp/noncloud/resources/testdata/datastoresrp-resources-sqldb-recipe.bicep index 545ba3edf4..9e438bf2bb 100644 --- a/test/functional-portable/datastoresrp/noncloud/resources/testdata/datastoresrp-resources-sqldb-recipe.bicep +++ b/test/functional-portable/datastoresrp/noncloud/resources/testdata/datastoresrp-resources-sqldb-recipe.bicep @@ -33,7 +33,7 @@ resource env 'Applications.Core/environments@2023-10-01-preview' = { 'Applications.Datastores/sqlDatabases': { default: { templateKind: 'bicep' - templatePath: '${registry}/test/functional/shared/recipes/sqldb-recipe:${version}' + templatePath: '${registry}/test/testrecipes/test-bicep-recipes/sqldb-recipe:${version}' parameters: { username: username password: password diff --git a/test/functional-portable/kubernetes/noncloud/kubernetes_test.go b/test/functional-portable/kubernetes/noncloud/kubernetes_test.go index 75baf35a11..47ae1150d9 100644 --- a/test/functional-portable/kubernetes/noncloud/kubernetes_test.go +++ b/test/functional-portable/kubernetes/noncloud/kubernetes_test.go @@ -28,8 +28,8 @@ import ( radappiov1alpha3 "github.com/radius-project/radius/pkg/controller/api/radapp.io/v1alpha3" "github.com/radius-project/radius/pkg/controller/reconciler" "github.com/radius-project/radius/pkg/sdk" - "github.com/radius-project/radius/test/functional/shared" "github.com/radius-project/radius/test/radcli" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/testcontext" "github.com/radius-project/radius/test/testutil" "github.com/stretchr/testify/require" @@ -49,7 +49,7 @@ import ( func Test_TutorialApplication_KubernetesManifests(t *testing.T) { ctx := testcontext.New(t) - opts := shared.NewRPTestOptions(t) + opts := rp.NewRPTestOptions(t) namespace := "kubernetes-interop-tutorial" environmentName := namespace + "-env" diff --git a/test/functional-portable/kubernetes/noncloud/testdata/tutorial-environment.bicep b/test/functional-portable/kubernetes/noncloud/testdata/tutorial-environment.bicep index 68308687f0..5c38e0074f 100644 --- a/test/functional-portable/kubernetes/noncloud/testdata/tutorial-environment.bicep +++ b/test/functional-portable/kubernetes/noncloud/testdata/tutorial-environment.bicep @@ -17,7 +17,7 @@ resource env 'Applications.Core/environments@2023-10-01-preview' = { 'Applications.Datastores/redisCaches': { default: { templateKind: 'bicep' - templatePath: '${registry}/test/functional/shared/recipes/redis-recipe-value-backed:${version}' + templatePath: '${registry}/test/testrecipes/test-bicep-recipes/redis-recipe-value-backed:${version}' } } } diff --git a/test/functional-portable/messagingrp/noncloud/resources/rabbitmq_test.go b/test/functional-portable/messagingrp/noncloud/resources/rabbitmq_test.go index 94ddf7bdcc..490fced203 100644 --- a/test/functional-portable/messagingrp/noncloud/resources/rabbitmq_test.go +++ b/test/functional-portable/messagingrp/noncloud/resources/rabbitmq_test.go @@ -19,7 +19,7 @@ package resource_test import ( "testing" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/testutil" "github.com/radius-project/radius/test/validation" @@ -30,7 +30,7 @@ func Test_RabbitMQ_Manual(t *testing.T) { name := "msgrp-resources-rabbitmq" appNamespace := "default-msgrp-resources-rabbitmq" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage(), "password=guest"), RPResources: &validation.RPResourceSet{ @@ -76,7 +76,7 @@ func Test_RabbitMQ_Recipe(t *testing.T) { name := "msgrp-resources-rabbitmq-recipe" appNamespace := "default-msgrp-resources-rabbitmq-recipe" - test := shared.NewRPTest(t, name, []shared.TestStep{ + test := rp.NewRPTest(t, name, []rp.TestStep{ { Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage(), "password=guest", testutil.GetBicepRecipeRegistry(), testutil.GetBicepRecipeVersion()), RPResources: &validation.RPResourceSet{ diff --git a/test/functional-portable/messagingrp/noncloud/resources/testdata/msgrp-resources-rabbitmq-recipe.bicep b/test/functional-portable/messagingrp/noncloud/resources/testdata/msgrp-resources-rabbitmq-recipe.bicep index 499281a5aa..a7860e9264 100644 --- a/test/functional-portable/messagingrp/noncloud/resources/testdata/msgrp-resources-rabbitmq-recipe.bicep +++ b/test/functional-portable/messagingrp/noncloud/resources/testdata/msgrp-resources-rabbitmq-recipe.bicep @@ -30,7 +30,7 @@ resource env 'Applications.Core/environments@2023-10-01-preview' = { 'Applications.Messaging/rabbitMQQueues': { default: { templateKind: 'bicep' - templatePath: '${registry}/test/functional/shared/recipes/rabbitmq-recipe:${version}' + templatePath: '${registry}/test/testrecipes/test-bicep-recipes/rabbitmq-recipe:${version}' parameters: { password: password } diff --git a/test/functional-portable/samples/noncloud/testdata/tutorial-environment.bicep b/test/functional-portable/samples/noncloud/testdata/tutorial-environment.bicep index bdb8ee0302..3301e213fb 100644 --- a/test/functional-portable/samples/noncloud/testdata/tutorial-environment.bicep +++ b/test/functional-portable/samples/noncloud/testdata/tutorial-environment.bicep @@ -15,7 +15,7 @@ resource env 'Applications.Core/environments@2023-10-01-preview' = { 'Applications.Datastores/redisCaches': { default: { templateKind: 'bicep' - templatePath: '${registry}/test/functional/shared/recipes/redis-recipe-value-backed:${version}' + templatePath: '${registry}/test/testrecipes/test-bicep-recipes/redis-recipe-value-backed:${version}' } } } diff --git a/test/functional-portable/samples/noncloud/tutorial_test.go b/test/functional-portable/samples/noncloud/tutorial_test.go index 25eb6a3e8d..9fd6f18db0 100644 --- a/test/functional-portable/samples/noncloud/tutorial_test.go +++ b/test/functional-portable/samples/noncloud/tutorial_test.go @@ -30,7 +30,7 @@ import ( "time" "github.com/radius-project/radius/pkg/kubernetes" - "github.com/radius-project/radius/test/functional/shared" + "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/testutil" "github.com/radius-project/radius/test/validation" @@ -64,7 +64,7 @@ func Test_FirstApplicationSample(t *testing.T) { appName := "demo" appNamespace := "tutorial-demo" - test := shared.NewRPTest(t, appName, []shared.TestStep{ + test := rp.NewRPTest(t, appName, []rp.TestStep{ { Executor: step.NewDeployExecutor("testdata/tutorial-environment.bicep", testutil.GetBicepRecipeRegistry(), testutil.GetBicepRecipeVersion()), SkipKubernetesOutputResourceValidation: true, @@ -89,7 +89,7 @@ func Test_FirstApplicationSample(t *testing.T) { }, }, }, - PostStepVerify: func(ctx context.Context, t *testing.T, ct shared.RPTest) { + PostStepVerify: func(ctx context.Context, t *testing.T, ct rp.RPTest) { // Set up pod port-forwarding for the pod for i := 1; i <= retries; i++ { t.Logf("Setting up portforward (attempt %d/%d)", i, retries) @@ -120,7 +120,7 @@ func Test_FirstApplicationSample(t *testing.T) { test.Test(t) } -func testWithPortForward(t *testing.T, ctx context.Context, at shared.RPTest, namespace string, container string, remotePort int) error { +func testWithPortForward(t *testing.T, ctx context.Context, at rp.RPTest, namespace string, container string, remotePort int) error { // stopChan will close the port-forward connection on close stopChan := make(chan struct{}) diff --git a/test/functional-portable/ucp/noncloud/tracked_resource_test.go b/test/functional-portable/ucp/noncloud/tracked_resource_test.go index 5ed7375afe..750715218e 100644 --- a/test/functional-portable/ucp/noncloud/tracked_resource_test.go +++ b/test/functional-portable/ucp/noncloud/tracked_resource_test.go @@ -31,7 +31,7 @@ import ( "github.com/radius-project/radius/pkg/sdk" ucp "github.com/radius-project/radius/pkg/ucp/api/v20231001preview" "github.com/radius-project/radius/pkg/ucp/resources" - "github.com/radius-project/radius/test/functional/shared" + corerptest "github.com/radius-project/radius/test/rp" "github.com/radius-project/radius/test/testcontext" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -45,7 +45,7 @@ func Test_TrackedResources(t *testing.T) { } ctx := testcontext.New(t) - options := shared.NewRPTestOptions(t) + options := corerptest.NewRPTestOptions(t) resourceGroupID := resources.MustParse("/planes/radius/local/resourcegroups/test-" + uuid.New().String()) rgc, err := ucp.NewResourceGroupsClient(&aztoken.AnonymousCredential{}, sdk.NewClientOptions(options.Connection)) diff --git a/test/functional/README.md b/test/functional/README.md deleted file mode 100644 index dfc9c96b3e..0000000000 --- a/test/functional/README.md +++ /dev/null @@ -1,3 +0,0 @@ -* [Writing functional tests](../../docs/contributing/contributing-code/contributing-code-tests/writing-functional-tests.md) - -* [Running functional tests](../../docs/contributing/contributing-code/contributing-code-tests/running-functional-tests.md) diff --git a/test/functional/shared/resources/kubemetadata_httproute_test.go b/test/functional/shared/resources/kubemetadata_httproute_test.go deleted file mode 100644 index 3b9df23c26..0000000000 --- a/test/functional/shared/resources/kubemetadata_httproute_test.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -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. -*/ - -package resource_test - -import ( - "context" - "testing" - - "github.com/radius-project/radius/test/functional/shared" - "github.com/radius-project/radius/test/step" - "github.com/radius-project/radius/test/testutil" - "github.com/radius-project/radius/test/validation" - "github.com/stretchr/testify/require" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -func Test_KubeMetadataHTTPRoute(t *testing.T) { - template := "testdata/corerp-resources-httproute-kubernetesmetadata.bicep" - name := "corerp-app-rte-kme" - appNamespace := "corerp-ns-rte-kme-app" - - expectedAnnotations := map[string]string{ - "user.ann.1": "user.ann.val.1", - "user.ann.2": "user.ann.val.2", - } - - expectedLabels := map[string]string{ - "app.kubernetes.io/managed-by": "radius-rp", - "app.kubernetes.io/name": "ctnr-rte-kme-ctnr", - "app.kubernetes.io/part-of": "corerp-app-rte-kme", - "radapp.io/application": "corerp-app-rte-kme", - "radapp.io/resource": "ctnr-rte-kme-ctnr", - "radapp.io/resource-type": "applications.core-containers", - "user.lbl.1": "user.lbl.val.1", - "user.lbl.2": "user.lbl.val.2", - } - - test := shared.NewRPTest(t, name, []shared.TestStep{ - { - Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage()), - RPResources: &validation.RPResourceSet{ - Resources: []validation.RPResource{ - { - Name: name, - Type: validation.ApplicationsResource, - }, - { - Name: "ctnr-rte-kme-ctnr", - Type: validation.ContainersResource, - App: name, - }, - }, - }, - K8sObjects: &validation.K8sObjectSet{ - Namespaces: map[string][]validation.K8sObject{ - appNamespace: { - validation.NewK8sPodForResource(name, "ctnr-rte-kme-ctnr"), - validation.NewK8sServiceForResource(name, "ctnr-rte-kme-ctnr"), - }, - }, - }, - PostStepVerify: func(ctx context.Context, t *testing.T, test shared.RPTest) { - - // Verify service labels and annotations - service, err := test.Options.K8sClient.CoreV1().Services(appNamespace).Get(ctx, "ctnr-rte-kme-ctnr", metav1.GetOptions{}) - require.NoError(t, err) - require.NotNil(t, service) - - require.Truef(t, testutil.IsMapSubSet(expectedAnnotations, service.Annotations), "Annotations do not match. expected: %v, actual: %v", expectedAnnotations, service.Annotations) - require.Truef(t, testutil.IsMapSubSet(expectedLabels, service.Labels), "Labels do not match. expected: %v, actual: %v", expectedLabels, service.Labels) - }, - }, - }) - - test.Test(t) -} diff --git a/test/functional/shared/test.go b/test/functional/shared/test.go deleted file mode 100644 index de9f1f0d97..0000000000 --- a/test/functional/shared/test.go +++ /dev/null @@ -1,105 +0,0 @@ -/* -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. -*/ - -package shared - -import ( - "strings" - "testing" - - "github.com/aws/aws-sdk-go-v2/service/cloudcontrol" - "github.com/stretchr/testify/require" - - awsconfig "github.com/aws/aws-sdk-go-v2/config" - "github.com/radius-project/radius/pkg/azure/clientv2" - aztoken "github.com/radius-project/radius/pkg/azure/tokencredentials" - "github.com/radius-project/radius/pkg/cli" - "github.com/radius-project/radius/pkg/cli/clients" - "github.com/radius-project/radius/pkg/cli/connections" - "github.com/radius-project/radius/pkg/cli/workspaces" - "github.com/radius-project/radius/pkg/sdk" - "github.com/radius-project/radius/pkg/ucp/aws" - "github.com/radius-project/radius/test" - "github.com/radius-project/radius/test/testcontext" - "github.com/radius-project/radius/test/testutil" -) - -// NewRPTestOptions sets up the test environment by loading configs, creating a test context, creating an -// ApplicationsManagementClient, creating an AWSCloudControlClient, and returning an RPTestOptions struct. -func NewRPTestOptions(t *testing.T) RPTestOptions { - registry, tag := testutil.SetDefault() - t.Logf("Using container registry: %s - set DOCKER_REGISTRY to override", registry) - t.Logf("Using container tag: %s - set REL_VERSION to override", tag) - t.Logf("Using magpie image: %s/magpiego:%s", registry, tag) - - _, bicepRecipeRegistry, _ := strings.Cut(testutil.GetBicepRecipeRegistry(), "=") - _, bicepRecipeTag, _ := strings.Cut(testutil.GetBicepRecipeVersion(), "=") - t.Logf("Using recipe registry: %s - set BICEP_RECIPE_REGISTRY to override", bicepRecipeRegistry) - t.Logf("Using recipe tag: %s - set BICEP_RECIPE_TAG_VERSION to override", bicepRecipeTag) - - _, terraformRecipeModuleServerURL, _ := strings.Cut(testutil.GetTerraformRecipeModuleServerURL(), "=") - t.Logf("Using terraform recipe module server URL: %s - set TF_RECIPE_MODULE_SERVER_URL to override", terraformRecipeModuleServerURL) - - ctx := testcontext.New(t) - - config, err := cli.LoadConfig("") - require.NoError(t, err, "failed to read radius config") - - workspace, err := cli.GetWorkspace(config, "") - require.NoError(t, err, "failed to read default workspace") - require.NotNil(t, workspace, "default workspace is not set") - - t.Logf("Loaded workspace: %s (%s)", workspace.Name, workspace.FmtConnection()) - - client, err := connections.DefaultFactory.CreateApplicationsManagementClient(ctx, *workspace) - require.NoError(t, err, "failed to create ApplicationsManagementClient") - - connection, err := workspace.Connect() - require.NoError(t, err, "failed to connect to workspace") - - customAction, err := clientv2.NewCustomActionClient("", &clientv2.Options{ - BaseURI: strings.TrimRight(connection.Endpoint(), "/"), - Cred: &aztoken.AnonymousCredential{}, - }, sdk.NewClientOptions(connection)) - require.NoError(t, err, "failed to create CustomActionClient") - - cfg, err := awsconfig.LoadDefaultConfig(ctx) - require.NoError(t, err) - var awsClient aws.AWSCloudControlClient = cloudcontrol.NewFromConfig(cfg) - - return RPTestOptions{ - TestOptions: test.NewTestOptions(t), - Workspace: workspace, - CustomAction: customAction, - ManagementClient: client, - AWSClient: awsClient, - Connection: connection, - } -} - -type RPTestOptions struct { - test.TestOptions - - CustomAction *clientv2.CustomActionClient - ManagementClient clients.ApplicationsManagementClient - AWSClient aws.AWSCloudControlClient - - // Connection gets access to the Radius connection which can be used to create API clients. - Connection sdk.Connection - - // Workspace gets access to the Radius workspace which can be used to create API clients. - Workspace *workspaces.Workspace -} diff --git a/test/functional/shared/rptest.go b/test/rp/rptest.go similarity index 82% rename from test/functional/shared/rptest.go rename to test/rp/rptest.go index 427fa70219..ed9b515b0d 100644 --- a/test/functional/shared/rptest.go +++ b/test/rp/rptest.go @@ -14,16 +14,18 @@ See the License for the specific language governing permissions and limitations under the License. */ -package shared +package rp import ( "context" "fmt" "os" + "strings" "sync" "testing" "time" + "github.com/aws/aws-sdk-go-v2/service/cloudcontrol" "github.com/stretchr/testify/require" apiextv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" @@ -32,11 +34,21 @@ import ( "k8s.io/client-go/discovery" "sigs.k8s.io/controller-runtime/pkg/client" + awsconfig "github.com/aws/aws-sdk-go-v2/config" + "github.com/radius-project/radius/pkg/azure/clientv2" + aztoken "github.com/radius-project/radius/pkg/azure/tokencredentials" + "github.com/radius-project/radius/pkg/cli" + "github.com/radius-project/radius/pkg/cli/clients" + "github.com/radius-project/radius/pkg/cli/connections" "github.com/radius-project/radius/pkg/cli/kubernetes" + "github.com/radius-project/radius/pkg/cli/workspaces" + "github.com/radius-project/radius/pkg/sdk" + "github.com/radius-project/radius/pkg/ucp/aws" "github.com/radius-project/radius/test" "github.com/radius-project/radius/test/radcli" "github.com/radius-project/radius/test/step" "github.com/radius-project/radius/test/testcontext" + "github.com/radius-project/radius/test/testutil" "github.com/radius-project/radius/test/validation" ) @@ -88,6 +100,20 @@ const ( RequiredFeatureValidatorTypeCloud RequiredFeatureValidatorType = "ValidatorCloud" ) +type RPTestOptions struct { + test.TestOptions + + CustomAction *clientv2.CustomActionClient + ManagementClient clients.ApplicationsManagementClient + AWSClient aws.AWSCloudControlClient + + // Connection gets access to the Radius connection which can be used to create API clients. + Connection sdk.Connection + + // Workspace gets access to the Radius workspace which can be used to create API clients. + Workspace *workspaces.Workspace +} + type TestStep struct { Executor step.Executor RPResources *validation.RPResourceSet @@ -118,6 +144,59 @@ type TestOptions struct { DiscoveryClient discovery.DiscoveryInterface } +// NewRPTestOptions sets up the test environment by loading configs, creating a test context, creating an +// ApplicationsManagementClient, creating an AWSCloudControlClient, and returning an RPTestOptions struct. +func NewRPTestOptions(t *testing.T) RPTestOptions { + registry, tag := testutil.SetDefault() + t.Logf("Using container registry: %s - set DOCKER_REGISTRY to override", registry) + t.Logf("Using container tag: %s - set REL_VERSION to override", tag) + t.Logf("Using magpie image: %s/magpiego:%s", registry, tag) + + _, bicepRecipeRegistry, _ := strings.Cut(testutil.GetBicepRecipeRegistry(), "=") + _, bicepRecipeTag, _ := strings.Cut(testutil.GetBicepRecipeVersion(), "=") + t.Logf("Using recipe registry: %s - set BICEP_RECIPE_REGISTRY to override", bicepRecipeRegistry) + t.Logf("Using recipe tag: %s - set BICEP_RECIPE_TAG_VERSION to override", bicepRecipeTag) + + _, terraformRecipeModuleServerURL, _ := strings.Cut(testutil.GetTerraformRecipeModuleServerURL(), "=") + t.Logf("Using terraform recipe module server URL: %s - set TF_RECIPE_MODULE_SERVER_URL to override", terraformRecipeModuleServerURL) + + ctx := testcontext.New(t) + + config, err := cli.LoadConfig("") + require.NoError(t, err, "failed to read radius config") + + workspace, err := cli.GetWorkspace(config, "") + require.NoError(t, err, "failed to read default workspace") + require.NotNil(t, workspace, "default workspace is not set") + + t.Logf("Loaded workspace: %s (%s)", workspace.Name, workspace.FmtConnection()) + + client, err := connections.DefaultFactory.CreateApplicationsManagementClient(ctx, *workspace) + require.NoError(t, err, "failed to create ApplicationsManagementClient") + + connection, err := workspace.Connect() + require.NoError(t, err, "failed to connect to workspace") + + customAction, err := clientv2.NewCustomActionClient("", &clientv2.Options{ + BaseURI: strings.TrimRight(connection.Endpoint(), "/"), + Cred: &aztoken.AnonymousCredential{}, + }, sdk.NewClientOptions(connection)) + require.NoError(t, err, "failed to create CustomActionClient") + + cfg, err := awsconfig.LoadDefaultConfig(ctx) + require.NoError(t, err) + var awsClient aws.AWSCloudControlClient = cloudcontrol.NewFromConfig(cfg) + + return RPTestOptions{ + TestOptions: test.NewTestOptions(t), + Workspace: workspace, + CustomAction: customAction, + ManagementClient: client, + AWSClient: awsClient, + Connection: connection, + } +} + // NewTestOptions creates a new TestOptions object with the given testing.T object. func NewTestOptions(t *testing.T) TestOptions { return TestOptions{TestOptions: test.NewTestOptions(t)} diff --git a/test/functional/shared/resources/testdata/modules/redis-selfhost.bicep b/test/testrecipes/modules/redis-selfhost.bicep similarity index 100% rename from test/functional/shared/resources/testdata/modules/redis-selfhost.bicep rename to test/testrecipes/modules/redis-selfhost.bicep diff --git a/test/functional/shared/resources/testdata/recipes/test-bicep-recipes/README.md b/test/testrecipes/test-bicep-recipes/README.md similarity index 83% rename from test/functional/shared/resources/testdata/recipes/test-bicep-recipes/README.md rename to test/testrecipes/test-bicep-recipes/README.md index 22ac1bf1bc..1fe19b3572 100644 --- a/test/functional/shared/resources/testdata/recipes/test-bicep-recipes/README.md +++ b/test/testrecipes/test-bicep-recipes/README.md @@ -2,7 +2,7 @@ The recipes in this folder are published as part of the PR process to: -> `ghcr.io/radius-project/dev/test/functional/shared/recipes/:pr-` +> `ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/:pr-` This is important because it allows us to make changes to the recipes, and test them in the same PR that contains the change. diff --git a/test/functional/shared/resources/testdata/recipes/test-bicep-recipes/_resource-creation.bicep b/test/testrecipes/test-bicep-recipes/_resource-creation.bicep similarity index 100% rename from test/functional/shared/resources/testdata/recipes/test-bicep-recipes/_resource-creation.bicep rename to test/testrecipes/test-bicep-recipes/_resource-creation.bicep diff --git a/test/functional/shared/resources/testdata/recipes/test-bicep-recipes/context-parameter.bicep b/test/testrecipes/test-bicep-recipes/context-parameter.bicep similarity index 100% rename from test/functional/shared/resources/testdata/recipes/test-bicep-recipes/context-parameter.bicep rename to test/testrecipes/test-bicep-recipes/context-parameter.bicep diff --git a/test/functional/shared/resources/testdata/recipes/test-bicep-recipes/corerp-redis-recipe.bicep b/test/testrecipes/test-bicep-recipes/corerp-redis-recipe.bicep similarity index 100% rename from test/functional/shared/resources/testdata/recipes/test-bicep-recipes/corerp-redis-recipe.bicep rename to test/testrecipes/test-bicep-recipes/corerp-redis-recipe.bicep diff --git a/test/functional/shared/resources/testdata/recipes/test-bicep-recipes/dapr-pubsub-broker.bicep b/test/testrecipes/test-bicep-recipes/dapr-pubsub-broker.bicep similarity index 92% rename from test/functional/shared/resources/testdata/recipes/test-bicep-recipes/dapr-pubsub-broker.bicep rename to test/testrecipes/test-bicep-recipes/dapr-pubsub-broker.bicep index 71dfd3c686..88c6ab7de5 100644 --- a/test/functional/shared/resources/testdata/recipes/test-bicep-recipes/dapr-pubsub-broker.bicep +++ b/test/testrecipes/test-bicep-recipes/dapr-pubsub-broker.bicep @@ -5,7 +5,7 @@ import kubernetes as kubernetes { param context object -module redis '../../modules/redis-selfhost.bicep' = { +module redis '../../../test/testrecipes/modules/redis-selfhost.bicep' = { name: 'redis-${uniqueString(context.resource.id)}' params: { name: 'redis-${uniqueString(context.resource.id)}' diff --git a/test/functional/shared/resources/testdata/recipes/test-bicep-recipes/dapr-secret-store.bicep b/test/testrecipes/test-bicep-recipes/dapr-secret-store.bicep similarity index 100% rename from test/functional/shared/resources/testdata/recipes/test-bicep-recipes/dapr-secret-store.bicep rename to test/testrecipes/test-bicep-recipes/dapr-secret-store.bicep diff --git a/test/functional/shared/resources/testdata/recipes/test-bicep-recipes/dapr-state-store.bicep b/test/testrecipes/test-bicep-recipes/dapr-state-store.bicep similarity index 92% rename from test/functional/shared/resources/testdata/recipes/test-bicep-recipes/dapr-state-store.bicep rename to test/testrecipes/test-bicep-recipes/dapr-state-store.bicep index 181ccc006e..6d0b8c5bc8 100644 --- a/test/functional/shared/resources/testdata/recipes/test-bicep-recipes/dapr-state-store.bicep +++ b/test/testrecipes/test-bicep-recipes/dapr-state-store.bicep @@ -5,7 +5,7 @@ import kubernetes as kubernetes { param context object -module redis '../../modules/redis-selfhost.bicep' = { +module redis '../../../test/testrecipes/modules/redis-selfhost.bicep' = { name: 'redis-${uniqueString(context.resource.id)}' params: { name: 'redis-${uniqueString(context.resource.id)}' diff --git a/test/functional/shared/resources/testdata/recipes/test-bicep-recipes/empty-recipe.bicep b/test/testrecipes/test-bicep-recipes/empty-recipe.bicep similarity index 100% rename from test/functional/shared/resources/testdata/recipes/test-bicep-recipes/empty-recipe.bicep rename to test/testrecipes/test-bicep-recipes/empty-recipe.bicep diff --git a/test/functional/shared/resources/testdata/recipes/test-bicep-recipes/extender-recipe.bicep b/test/testrecipes/test-bicep-recipes/extender-recipe.bicep similarity index 100% rename from test/functional/shared/resources/testdata/recipes/test-bicep-recipes/extender-recipe.bicep rename to test/testrecipes/test-bicep-recipes/extender-recipe.bicep diff --git a/test/functional/shared/resources/testdata/recipes/test-bicep-recipes/extenders-aws-s3-recipe.bicep b/test/testrecipes/test-bicep-recipes/extenders-aws-s3-recipe.bicep similarity index 100% rename from test/functional/shared/resources/testdata/recipes/test-bicep-recipes/extenders-aws-s3-recipe.bicep rename to test/testrecipes/test-bicep-recipes/extenders-aws-s3-recipe.bicep diff --git a/test/functional/shared/resources/testdata/recipes/test-bicep-recipes/language-failure.bicep b/test/testrecipes/test-bicep-recipes/language-failure.bicep similarity index 100% rename from test/functional/shared/resources/testdata/recipes/test-bicep-recipes/language-failure.bicep rename to test/testrecipes/test-bicep-recipes/language-failure.bicep diff --git a/test/functional/shared/resources/testdata/recipes/test-bicep-recipes/mongodb-recipe-context.bicep b/test/testrecipes/test-bicep-recipes/mongodb-recipe-context.bicep similarity index 100% rename from test/functional/shared/resources/testdata/recipes/test-bicep-recipes/mongodb-recipe-context.bicep rename to test/testrecipes/test-bicep-recipes/mongodb-recipe-context.bicep diff --git a/test/functional/shared/resources/testdata/recipes/test-bicep-recipes/mongodb-recipe-kubernetes.bicep b/test/testrecipes/test-bicep-recipes/mongodb-recipe-kubernetes.bicep similarity index 100% rename from test/functional/shared/resources/testdata/recipes/test-bicep-recipes/mongodb-recipe-kubernetes.bicep rename to test/testrecipes/test-bicep-recipes/mongodb-recipe-kubernetes.bicep diff --git a/test/functional/shared/resources/testdata/recipes/test-bicep-recipes/parameters-outputs.bicep b/test/testrecipes/test-bicep-recipes/parameters-outputs.bicep similarity index 100% rename from test/functional/shared/resources/testdata/recipes/test-bicep-recipes/parameters-outputs.bicep rename to test/testrecipes/test-bicep-recipes/parameters-outputs.bicep diff --git a/test/functional/shared/resources/testdata/recipes/test-bicep-recipes/rabbitmq-recipe.bicep b/test/testrecipes/test-bicep-recipes/rabbitmq-recipe.bicep similarity index 100% rename from test/functional/shared/resources/testdata/recipes/test-bicep-recipes/rabbitmq-recipe.bicep rename to test/testrecipes/test-bicep-recipes/rabbitmq-recipe.bicep diff --git a/test/functional/shared/resources/testdata/recipes/test-bicep-recipes/redis-recipe-value-backed.bicep b/test/testrecipes/test-bicep-recipes/redis-recipe-value-backed.bicep similarity index 100% rename from test/functional/shared/resources/testdata/recipes/test-bicep-recipes/redis-recipe-value-backed.bicep rename to test/testrecipes/test-bicep-recipes/redis-recipe-value-backed.bicep diff --git a/test/functional/shared/resources/testdata/recipes/test-bicep-recipes/resource-creation-failure.bicep b/test/testrecipes/test-bicep-recipes/resource-creation-failure.bicep similarity index 100% rename from test/functional/shared/resources/testdata/recipes/test-bicep-recipes/resource-creation-failure.bicep rename to test/testrecipes/test-bicep-recipes/resource-creation-failure.bicep diff --git a/test/functional/shared/resources/testdata/recipes/test-bicep-recipes/resource-creation.bicep b/test/testrecipes/test-bicep-recipes/resource-creation.bicep similarity index 100% rename from test/functional/shared/resources/testdata/recipes/test-bicep-recipes/resource-creation.bicep rename to test/testrecipes/test-bicep-recipes/resource-creation.bicep diff --git a/test/functional/shared/resources/testdata/recipes/test-bicep-recipes/sqldb-recipe.bicep b/test/testrecipes/test-bicep-recipes/sqldb-recipe.bicep similarity index 100% rename from test/functional/shared/resources/testdata/recipes/test-bicep-recipes/sqldb-recipe.bicep rename to test/testrecipes/test-bicep-recipes/sqldb-recipe.bicep diff --git a/test/functional/shared/resources/testdata/recipes/test-bicep-recipes/wrong-output.bicep b/test/testrecipes/test-bicep-recipes/wrong-output.bicep similarity index 100% rename from test/functional/shared/resources/testdata/recipes/test-bicep-recipes/wrong-output.bicep rename to test/testrecipes/test-bicep-recipes/wrong-output.bicep diff --git a/test/functional/shared/resources/testdata/recipes/test-terraform-recipes/README.md b/test/testrecipes/test-terraform-recipes/README.md similarity index 100% rename from test/functional/shared/resources/testdata/recipes/test-terraform-recipes/README.md rename to test/testrecipes/test-terraform-recipes/README.md diff --git a/test/functional/shared/resources/testdata/recipes/test-terraform-recipes/azure-storage/main.tf b/test/testrecipes/test-terraform-recipes/azure-storage/azure-storage/main.tf similarity index 100% rename from test/functional/shared/resources/testdata/recipes/test-terraform-recipes/azure-storage/main.tf rename to test/testrecipes/test-terraform-recipes/azure-storage/azure-storage/main.tf diff --git a/test/functional/shared/resources/testdata/recipes/test-terraform-recipes/azure-storage/output.tf b/test/testrecipes/test-terraform-recipes/azure-storage/azure-storage/output.tf similarity index 100% rename from test/functional/shared/resources/testdata/recipes/test-terraform-recipes/azure-storage/output.tf rename to test/testrecipes/test-terraform-recipes/azure-storage/azure-storage/output.tf diff --git a/test/functional/shared/resources/testdata/recipes/test-terraform-recipes/azure-storage/variables.tf b/test/testrecipes/test-terraform-recipes/azure-storage/azure-storage/variables.tf similarity index 100% rename from test/functional/shared/resources/testdata/recipes/test-terraform-recipes/azure-storage/variables.tf rename to test/testrecipes/test-terraform-recipes/azure-storage/azure-storage/variables.tf diff --git a/test/testrecipes/test-terraform-recipes/azure-storage/main.tf b/test/testrecipes/test-terraform-recipes/azure-storage/main.tf new file mode 100644 index 0000000000..8655f5fa5d --- /dev/null +++ b/test/testrecipes/test-terraform-recipes/azure-storage/main.tf @@ -0,0 +1,32 @@ +terraform { + required_providers { + azurerm = { + source = "hashicorp/azurerm" + version = "~> 3.0.0" + } + } +} + +resource "random_id" "unique_name" { + byte_length = 8 +} + +resource "azurerm_storage_account" "test_storage_account" { + name = "acct${random_id.unique_name.hex}" + resource_group_name = var.resource_group_name + location = var.location + account_tier = "Standard" + account_replication_type = "LRS" +} + +resource "azurerm_storage_container" "test_container" { + name = "ctr${random_id.unique_name.hex}" + storage_account_name = azurerm_storage_account.test_storage_account.name +} + +resource "azurerm_storage_blob" "test_blob" { + name = "blob${random_id.unique_name.hex}" + storage_account_name = azurerm_storage_account.test_storage_account.name + storage_container_name = azurerm_storage_container.test_container.name + type = "Block" +} \ No newline at end of file diff --git a/test/testrecipes/test-terraform-recipes/azure-storage/output.tf b/test/testrecipes/test-terraform-recipes/azure-storage/output.tf new file mode 100644 index 0000000000..a4026b54f3 --- /dev/null +++ b/test/testrecipes/test-terraform-recipes/azure-storage/output.tf @@ -0,0 +1,5 @@ +output "result" { + value = { + resources = [azurerm_storage_account.test_storage_account.id] + } +} \ No newline at end of file diff --git a/test/testrecipes/test-terraform-recipes/azure-storage/variables.tf b/test/testrecipes/test-terraform-recipes/azure-storage/variables.tf new file mode 100644 index 0000000000..b448fb39f2 --- /dev/null +++ b/test/testrecipes/test-terraform-recipes/azure-storage/variables.tf @@ -0,0 +1,7 @@ +variable "resource_group_name" { + type = string +} + +variable "location" { + type = string +} \ No newline at end of file diff --git a/test/functional/shared/resources/testdata/recipes/test-terraform-recipes/k8ssecret-context/main.tf b/test/testrecipes/test-terraform-recipes/k8ssecret-context/main.tf similarity index 100% rename from test/functional/shared/resources/testdata/recipes/test-terraform-recipes/k8ssecret-context/main.tf rename to test/testrecipes/test-terraform-recipes/k8ssecret-context/main.tf diff --git a/test/functional/shared/resources/testdata/recipes/test-terraform-recipes/k8ssecret-context/variables.tf b/test/testrecipes/test-terraform-recipes/k8ssecret-context/variables.tf similarity index 100% rename from test/functional/shared/resources/testdata/recipes/test-terraform-recipes/k8ssecret-context/variables.tf rename to test/testrecipes/test-terraform-recipes/k8ssecret-context/variables.tf diff --git a/test/functional/shared/resources/testdata/recipes/test-terraform-recipes/kubernetes-redis/modules/main.tf b/test/testrecipes/test-terraform-recipes/kubernetes-redis/modules/main.tf similarity index 100% rename from test/functional/shared/resources/testdata/recipes/test-terraform-recipes/kubernetes-redis/modules/main.tf rename to test/testrecipes/test-terraform-recipes/kubernetes-redis/modules/main.tf diff --git a/test/functional/shared/resources/testdata/recipes/test-terraform-recipes/kubernetes-redis/modules/variables.tf b/test/testrecipes/test-terraform-recipes/kubernetes-redis/modules/variables.tf similarity index 100% rename from test/functional/shared/resources/testdata/recipes/test-terraform-recipes/kubernetes-redis/modules/variables.tf rename to test/testrecipes/test-terraform-recipes/kubernetes-redis/modules/variables.tf diff --git a/test/functional/shared/resources/testdata/recipes/test-terraform-recipes/parameter-outputs/output.tf b/test/testrecipes/test-terraform-recipes/parameter-outputs/output.tf similarity index 100% rename from test/functional/shared/resources/testdata/recipes/test-terraform-recipes/parameter-outputs/output.tf rename to test/testrecipes/test-terraform-recipes/parameter-outputs/output.tf diff --git a/test/functional/shared/resources/testdata/recipes/test-terraform-recipes/parameter-outputs/variables.tf b/test/testrecipes/test-terraform-recipes/parameter-outputs/variables.tf similarity index 100% rename from test/functional/shared/resources/testdata/recipes/test-terraform-recipes/parameter-outputs/variables.tf rename to test/testrecipes/test-terraform-recipes/parameter-outputs/variables.tf diff --git a/test/functional/shared/resources/testdata/recipes/test-terraform-recipes/wrong-output/output.tf b/test/testrecipes/test-terraform-recipes/wrong-output/output.tf similarity index 100% rename from test/functional/shared/resources/testdata/recipes/test-terraform-recipes/wrong-output/output.tf rename to test/testrecipes/test-terraform-recipes/wrong-output/output.tf From ea053147c74c4d9a830e78209a46007c8585fdf7 Mon Sep 17 00:00:00 2001 From: Young Bu Park Date: Tue, 26 Mar 2024 18:49:35 -0700 Subject: [PATCH 08/19] Increase test interval for `[TEST] Functional tests with retry` (#7399) # Description 20 minutes interval creates too many test resources. So this PR increase the interval not to create many test resources. ## Type of change - This pull request is a minor refactor, code cleanup, test improvement, or other maintenance task and doesn't change the functionality of Radius (issue link optional). Fixes: #issue_number Signed-off-by: Young Bu Park --- .github/workflows/retry-functional-test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/retry-functional-test.yaml b/.github/workflows/retry-functional-test.yaml index dc624b7683..ef0f4d5f1d 100644 --- a/.github/workflows/retry-functional-test.yaml +++ b/.github/workflows/retry-functional-test.yaml @@ -23,8 +23,8 @@ permissions: on: schedule: - # Run every 20 minutes - - cron: "*/20 * * * *" + # Run every 2 hours + - cron: "0 */2 * * *" env: # Go version From f8633519b844fa9074717ea8fe0e4333a9a90c57 Mon Sep 17 00:00:00 2001 From: Young Bu Park Date: Wed, 27 Mar 2024 12:16:22 -0700 Subject: [PATCH 09/19] Release 0.32.0-rc1 (#7403) # Description This is to release 0.32.0-rc1. ## Type of change - This pull request is a minor refactor, code cleanup, test improvement, or other maintenance task and doesn't change the functionality of Radius (issue link optional). Fixes: #issue_number Signed-off-by: Young Bu Park --- versions.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/versions.yaml b/versions.yaml index 6793141bc4..890c1332bc 100644 --- a/versions.yaml +++ b/versions.yaml @@ -1,4 +1,6 @@ supported: + - channel: '0.32' + version: 'v0.32.0-rc1' - channel: '0.31' version: 'v0.31.0' deprecated: From 1fc0eaa66c9a180336d30550a482c51830379ada Mon Sep 17 00:00:00 2001 From: Karishma Chawla Date: Wed, 27 Mar 2024 14:21:09 -0700 Subject: [PATCH 10/19] Update logging for failed async operations (#7370) # Description Controllers currently have two ways of bubbling up errors to the async worker: 1. By returning the error, which is then added to the result by the async worker. 2. By directly returning a non-empty result with error message populated and provisioning state set to "failed". We have a few gaps in the logging today which results into false data or no data, this PR aims to fix these gaps - * Error is not logged if it is returned as a part of the result (scenario 2 above). * Operation is logged as successful if a direct error is returned (scenario 1 above). * Provisioning state is set to succeeded even if the controller returns an error (scenario 1 above). ## Type of change - This pull request fixes a bug in Radius and has an approved issue (issue link required). Part of https://github.com/radius-project/radius/issues/7369 --------- Signed-off-by: karishma-chawla <74574173+karishma-chawla@users.noreply.github.com> Co-authored-by: karishma-chawla <74574173+karishma-chawla@users.noreply.github.com> --- pkg/armrpc/asyncoperation/worker/worker.go | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/pkg/armrpc/asyncoperation/worker/worker.go b/pkg/armrpc/asyncoperation/worker/worker.go index 20640b57d7..a0da38b562 100644 --- a/pkg/armrpc/asyncoperation/worker/worker.go +++ b/pkg/armrpc/asyncoperation/worker/worker.go @@ -251,25 +251,21 @@ func (w *AsyncRequestProcessWorker) runOperation(ctx context.Context, message *q logger.Info("Start processing operation.") result, err := asyncCtrl.Run(asyncReqCtx, asyncReq) - - code := "" - if result.Error != nil { - code = result.Error.Code + // Update the result if an error is returned from the controller. + // Check that the result is empty to ensure we don't override it, it shouldn't happen. + // Controller should always either return non-empty error or non-empty result, but not both. + if err != nil && result.Error == nil { + armErr := extractError(err) + result.SetFailed(armErr, false) } - logger.Info("Operation returned", "success", result.Error == nil, "code", code, "provisioningState", result.ProvisioningState(), "err", err) + logger.Info("Operation returned", "success", result.Error == nil, "provisioningState", result.ProvisioningState(), "err", result.Error) // There are two cases when asyncReqCtx is canceled. // 1. When the operation is timed out, w.completeOperation will be called in L186 // 2. When parent context is canceled or done, we need to requeue the operation to reprocess the request. // Such cases should not call w.completeOperation. if !errors.Is(asyncReqCtx.Err(), context.Canceled) { - if err != nil { - armErr := extractError(err) - result.SetFailed(armErr, false) - logger.Error(err, "Operation Failed") - } - w.completeOperation(ctx, message, result, asyncCtrl.StorageClient()) } trace.SetAsyncResultStatus(result, span) From 901b735267d5d613c7176214fd16901034b8b058 Mon Sep 17 00:00:00 2001 From: Young Bu Park Date: Thu, 28 Mar 2024 13:25:37 -0700 Subject: [PATCH 11/19] Official Release 0.32.0 (#7405) # Description This is the official release for 0.32.0 ## Type of change - This pull request fixes a bug in Radius and has an approved issue (issue link required). - This pull request adds or changes features of Radius and has an approved issue (issue link required). - This pull request is a minor refactor, code cleanup, test improvement, or other maintenance task and doesn't change the functionality of Radius (issue link optional). Fixes: #issue_number --------- Signed-off-by: Young Bu Park Signed-off-by: Will <28876888+willtsai@users.noreply.github.com> Co-authored-by: Will <28876888+willtsai@users.noreply.github.com> Co-authored-by: Reshma Abdul Rahim <61033581+Reshrahim@users.noreply.github.com> --- docs/release-notes/v0.32.0.md | 79 +++++++++++++++++++++++++++++++++++ versions.yaml | 4 +- 2 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 docs/release-notes/v0.32.0.md diff --git a/docs/release-notes/v0.32.0.md b/docs/release-notes/v0.32.0.md new file mode 100644 index 0000000000..f1bf0146b7 --- /dev/null +++ b/docs/release-notes/v0.32.0.md @@ -0,0 +1,79 @@ +## Announcing Radius v0.32.0 + +Today we're happy to announce the release of Radius v0.32.0. Check out the [highlights](#highlights) below, along with the [full changelog](#full-changelog) for more details. + +We would like to extend our thanks to all the [new](#new-contributors) and existing contributors who helped make this release possible! + +## Intro to Radius + +If you're new to Radius, check out our website, [radapp.io](https://radapp.io), for more information. Also visit our [getting started guide](https://docs.radapp.io/getting-started/) to learn how to install Radius and create your first app. + +## Highlights + +### Support for Terraform modules from private git repositories + +Radius Environments can now be configured to pull Terraform Recipe templates from private git repositories. Visit the [private registry how-to guide](https://docs.radapp.io/guides/recipes/howto-private-registry/) to learn more. + +## Community Contributions + +- Thanks to @gpltaylor for enabling `rad app graph` output to make connection graph output resources name as a link. +- Thanks to @lechnerc77 for adding dependabot configuration, fixing dashboard crash for recipes, and adding zoom control to application graph on dashboard. + +## Breaking changes + +None + +## New contributors + +None + +## Upgrading to Radius v0.32.0 + +During our preview stage, an upgrade to Radius v0.32.0 requires a full reinstallation of the Radius control-plane, rad CLI, and all Radius apps. Stay tuned for an in-place upgrade path in the future. + +1. Delete any environments you have created: + ```bash + rad env delete + ``` +1. Uninstall the previous version of the Radius control-plane: + ```bash + rad uninstall kubernetes + ``` +1. Visit the [Radius installation guide](https://docs.radapp.io/getting-started/install/) to install the latest CLI, or download a binary below +1. Install the latest version of the Radius control-plane: + ```bash + rad install kubernetes + ``` + +## Full changelog + +* Fix release workflow to include dashboard repo clone by @willdavsmith in https://github.com/radius-project/radius/pull/7206 +* Do not try to load recipes for a simulated environment by @vinayada1 in https://github.com/radius-project/radius/pull/7157 +* Add AWS/Azure to required features list. by @vinayada1 in https://github.com/radius-project/radius/pull/7218 +* Change organization for messaging RP tests and separate cloud/non-cloud tests by @vinayada1 in https://github.com/radius-project/radius/pull/7221 +* make graph as default cmmand and connections as alias by @nithyatsu in https://github.com/radius-project/radius/pull/7217 +* Change test organization for cli tests by @vinayada1 in https://github.com/radius-project/radius/pull/7226 +* Change test organization for samples tests by @vinayada1 in https://github.com/radius-project/radius/pull/7225 +* Change test organization for kubernetes tests by @vinayada1 in https://github.com/radius-project/radius/pull/7222 +* Change test organization for datastoresrp tests by @vinayada1 in https://github.com/radius-project/radius/pull/7224 +* Change test organization for daprrp tests by @vinayada1 in https://github.com/radius-project/radius/pull/7223 +* Change organization for UCP tests and separate cloud/non-cloud tests by @vinayada1 in https://github.com/radius-project/radius/pull/7219 +* Change open portal hyperlinks by @gpltaylor in https://github.com/radius-project/radius/pull/7229 +* Fix test file path by @kachawla in https://github.com/radius-project/radius/pull/7275 +* Add reorganized cli tests to the matrix by @vinayada1 in https://github.com/radius-project/radius/pull/7286 +* Use the right version of bicep using oras in workflow by @youngbupark in https://github.com/radius-project/radius/pull/7293 +* Updating environment variables set at Terraform process to include env variables at current process by @lakshmimsft in https://github.com/radius-project/radius/pull/7272 +* Adding env variables in functional test yaml to test private git module source. by @vishwahiremat in https://github.com/radius-project/radius/pull/7304 +* Update github token to use secret.GITHUB_TOKEN by @vishwahiremat in https://github.com/radius-project/radius/pull/7305 +* Only set Functional Test Run as passing if all subtests pass by @willdavsmith in https://github.com/radius-project/radius/pull/7303 +* chore: add dependabot configuration by @lechnerc77 in https://github.com/radius-project/radius/pull/7307 +* Use workload identity in workflow by @youngbupark in https://github.com/radius-project/radius/pull/7337 +* Adding Fix for flakey test caused while buildng bicep template by @vishwahiremat in https://github.com/radius-project/radius/pull/7345 +* Add error handling for failed `oras pull` during installation. by @AaronCrawfis in https://github.com/radius-project/radius/pull/7302 +* Migrate long-running test to new cluster to enable monitoring by @youngbupark in https://github.com/radius-project/radius/pull/7357 +* Fixing the wrong message in workspace switch command by @ytimocin in https://github.com/radius-project/radius/pull/7389 +* Randomize the id with GITHUB_RUN_NUMBER for scheduled test by @youngbupark in https://github.com/radius-project/radius/pull/7392 +* Change test organization for shared tests. by @vinayada1 in https://github.com/radius-project/radius/pull/7227 +* chore: add dependabot configuration by @lechnerc77 in https://github.com/radius-project/dashboard/pull/58 +* fix: dashboard crash for recipes by @lechnerc77 in https://github.com/radius-project/dashboard/pull/60 +* feat: add zoom control to application graph by @lechnerc77 in https://github.com/radius-project/dashboard/pull/61 diff --git a/versions.yaml b/versions.yaml index 890c1332bc..8888b8fa82 100644 --- a/versions.yaml +++ b/versions.yaml @@ -1,9 +1,9 @@ supported: - channel: '0.32' - version: 'v0.32.0-rc1' + version: 'v0.32.0' +deprecated: - channel: '0.31' version: 'v0.31.0' -deprecated: - channel: '0.30' version: 'v0.30.0' - channel: '0.29' From 4bf82f6c4d5f0e9066f8898828e0ff958b388ea3 Mon Sep 17 00:00:00 2001 From: Young Bu Park Date: Mon, 1 Apr 2024 10:13:15 -0700 Subject: [PATCH 12/19] Upgrade action versions of workflow to resolve openSSF issues (#7415) # Description * Upgrade action versions of workflow to the latest * Remove Delete artifact because we do not have storage limit anymore ## Type of change - This pull request is a minor refactor, code cleanup, test improvement, or other maintenance task and doesn't change the functionality of Radius (issue link optional). Fixes: #7404 --------- Signed-off-by: Young Bu Park --- .../actions/process-test-results/action.yaml | 2 +- .../actions/save-pr-as-artifact/action.yaml | 2 +- .github/workflows/assets.yaml | 2 +- .github/workflows/build.yaml | 66 +++++++------------ .../devcontainer-feature-release.yaml | 2 +- .../workflows/devcontainer-feature-test.yaml | 4 +- .github/workflows/functional-test.yaml | 20 +++--- .../workflows/functional-tests-approval.yaml | 2 +- .github/workflows/lint.yaml | 14 ++-- .github/workflows/long-running-azure.yaml | 19 ++---- .github/workflows/publish-bicep.yaml | 4 +- .github/workflows/publish-docs.yaml | 12 ++-- .github/workflows/radius-bot.yaml | 2 +- .github/workflows/release-verification.yaml | 2 +- .github/workflows/release.yaml | 18 ++--- .github/workflows/retry-functional-test.yaml | 20 +++--- .github/workflows/scorecard.yaml | 21 +++--- .github/workflows/validate-bicep.yaml | 4 +- .../validate-devcontainer-feature.yaml | 2 +- .github/workflows/validate-installers.yaml | 2 +- 20 files changed, 98 insertions(+), 122 deletions(-) diff --git a/.github/actions/process-test-results/action.yaml b/.github/actions/process-test-results/action.yaml index 5293c3ae76..22eceee76c 100644 --- a/.github/actions/process-test-results/action.yaml +++ b/.github/actions/process-test-results/action.yaml @@ -59,7 +59,7 @@ runs: files: | ${{ inputs.result_directory }}/processed/*.xml - name: 'Upload ${{ inputs.test_group_name }} Results' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() with: name: ${{ inputs.artifact_name }} diff --git a/.github/actions/save-pr-as-artifact/action.yaml b/.github/actions/save-pr-as-artifact/action.yaml index 3e01cdf876..10d58f1eba 100644 --- a/.github/actions/save-pr-as-artifact/action.yaml +++ b/.github/actions/save-pr-as-artifact/action.yaml @@ -10,7 +10,7 @@ runs: run: | mkdir -p ./pr echo $PR_NUMBER > ./pr/pr_number - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: pr_number path: pr/ diff --git a/.github/workflows/assets.yaml b/.github/workflows/assets.yaml index 96d92f26c8..49b75d04b2 100644 --- a/.github/workflows/assets.yaml +++ b/.github/workflows/assets.yaml @@ -29,7 +29,7 @@ jobs: if: github.repository == 'radius-project/radius' steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Parse release version and set environment variables run: python ./.github/scripts/get_release_version.py # The install scripts are not versioned. They go to tools/rad/install.{sh,ps1} diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4f386eb4c0..2d542adf25 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -82,14 +82,14 @@ jobs: target_arch: arm64 steps: - name: Check out repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Go ${{ env.GOVER }} - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: ${{ env.GOVER }} cache-dependency-path: go.sum - name: Restore the previous coverage - uses: actions/cache/restore@v3 + uses: actions/cache/restore@v4 with: path: ./dist/cache key: radius-coverage- @@ -123,18 +123,11 @@ jobs: run: | mkdir ${{ env.RELEASE_PATH }} cp ./dist/${{ matrix.target_os}}_${{ matrix.target_arch}}/release/rad.exe ${{ env.RELEASE_PATH }}/rad_${{ matrix.target_os}}_${{ matrix.target_arch}}.exe - - name: Upload Release binaries - uses: actions/upload-artifact@v3 - with: - name: rad_cli_release - path: ${{ env.RELEASE_PATH }} - name: Upload CLI binary - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: rad_cli_${{ matrix.target_os}}_${{ matrix.target_arch}} - path: | - ./dist/${{ matrix.target_os}}_${{ matrix.target_arch}}/release/rad - ./dist/${{ matrix.target_os}}_${{ matrix.target_arch}}/release/rad.exe + path: ${{ env.RELEASE_PATH }} - name: Generate unit-test coverage files if: matrix.target_arch == 'amd64' && matrix.target_os == 'linux' run: | @@ -173,7 +166,7 @@ jobs: GO_TOOL_COVER: go tool cover - name: Upload unit-test coverage artifact if: matrix.target_arch == 'amd64' && matrix.target_os == 'linux' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: unit_test_coverage path: | @@ -206,12 +199,12 @@ jobs: path: ./dist/cache key: radius-coverage-${{ github.sha }}-${{ github.run_number }} - name: Login to GitHub Container Registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - uses: oras-project/setup-oras@v1 + - uses: oras-project/setup-oras@main with: version: ${{ env.ORAS_VERSION }} - name: Push latest rad cli binary to GHCR (unix-like) @@ -231,23 +224,23 @@ jobs: if: github.repository == 'radius-project/radius' steps: - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Parse release version and set environment variables run: python ./.github/scripts/get_release_version.py - name: Set up Go ${{ env.GOVER }} - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: ${{ env.GOVER }} - name: Login to GitHub Container Registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 with: platforms: linux/amd64,linux/arm64,linux/arm/v7 - name: Push container images (latest) @@ -291,9 +284,9 @@ jobs: OCI_REPOSITORY: 'radius-project/helm-chart' steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install helm - uses: Azure/setup-helm@v3 + uses: azure/setup-helm@v4 with: version: 'v3.11.1' - name: Parse release version and set environment variables @@ -333,16 +326,19 @@ jobs: GITHUB_TOKEN: ${{ secrets.GH_RAD_CI_BOT_PAT }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Parse release version and set environment variables run: python ./.github/scripts/get_release_version.py - name: Download release artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: - name: rad_cli_release + pattern: rad_cli_* + merge-multiple: true path: ${{ env.RELEASE_PATH }} - name: generate checksum files - run: cd ${{ env.RELEASE_PATH }} && for i in *; do sha256sum -b $i > "$i.sha256"; done && cd - + run: | + cd ${{ env.RELEASE_PATH }} && for i in *; do sha256sum -b $i > "$i.sha256"; done && cd - + ls -l ${{ env.RELEASE_PATH }} - name: Create GitHub RC Release (pre-release and auto-generate release notes) if: ${{ contains(env.REL_VERSION, 'rc') }} run: | @@ -360,21 +356,3 @@ jobs: --title "Radius v${{ env.REL_VERSION }}" \ --notes-file docs/release-notes/v${{ env.REL_VERSION }}.md \ --verify-tag - - delete_artifacts: - name: Delete artifacts - needs: ['build-and-push-cli'] - if: github.repository == 'radius-project/radius' && ${{ always() && !contains(needs.build-and-push-cli.result, 'failure') }} - runs-on: ubuntu-latest - steps: - - name: Delete release artifacts - uses: geekyeggo/delete-artifact@v1 - with: - name: | - rad_cli_windows_amd64 - rad_cli_linux_amd64 - rad_cli_darwin_amd64 - rad_cli_linux_arm - rad_cli_darwin_arm64 - rad_cli_linux_arm64 - failOnError: false diff --git a/.github/workflows/devcontainer-feature-release.yaml b/.github/workflows/devcontainer-feature-release.yaml index 8085bbc06b..017f0189b3 100644 --- a/.github/workflows/devcontainer-feature-release.yaml +++ b/.github/workflows/devcontainer-feature-release.yaml @@ -18,7 +18,7 @@ jobs: pull-requests: write packages: write steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Publish Features" uses: devcontainers/action@v1 diff --git a/.github/workflows/devcontainer-feature-test.yaml b/.github/workflows/devcontainer-feature-test.yaml index 180f8ccdae..9a19c3577c 100644 --- a/.github/workflows/devcontainer-feature-test.yaml +++ b/.github/workflows/devcontainer-feature-test.yaml @@ -22,7 +22,7 @@ jobs: - mcr.microsoft.com/devcontainers/base:ubuntu - mcr.microsoft.com/devcontainers/base:debian steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Install latest devcontainer CLI" run: npm install -g @devcontainers/cli @@ -34,7 +34,7 @@ jobs: test-scenarios: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Install latest devcontainer CLI" run: npm install -g @devcontainers/cli diff --git a/.github/workflows/functional-test.yaml b/.github/workflows/functional-test.yaml index 58d9de7444..56bc75ffdf 100644 --- a/.github/workflows/functional-test.yaml +++ b/.github/workflows/functional-test.yaml @@ -117,7 +117,7 @@ jobs: echo "CHECKOUT_REF=${{ github.ref }}" >> $GITHUB_ENV echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> $GITHUB_ENV - name: Use custom actions - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: 'Download PR data artifacts' if: github.event_name == 'workflow_run' uses: ./.github/actions/download-pr-data-artifact @@ -153,12 +153,12 @@ jobs: ); } - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ${{ env.CHECKOUT_REPO }} ref: ${{ env.CHECKOUT_REF }} - name: Set up Go ${{ env.GOVER }} - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: ${{ env.GOVER }} - name: Generate ID for release @@ -244,7 +244,7 @@ jobs: DOCKER_REGISTRY: ${{ env.CONTAINER_REGISTRY }} DOCKER_TAG_VERSION: ${{ env.REL_VERSION }} - name: Upload CLI binary - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ steps.gen-id.outputs.RAD_CLI_ARTIFACT_NAME }} path: | @@ -344,7 +344,7 @@ jobs: with: app_id: ${{ env.FUNCTIONAL_TEST_APP_ID }} private_key: ${{ secrets.FUNCTIONAL_TEST_APP_PRIVATE_KEY }} - - uses: LouisBrunner/checks-action@v1.6.1 + - uses: LouisBrunner/checks-action@v2.0.0 if: always() with: token: ${{ steps.get_installation_token.outputs.token }} @@ -354,12 +354,12 @@ jobs: sha: ${{ env.CHECKOUT_REF }} details_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ${{ env.CHECKOUT_REPO }} ref: ${{ env.CHECKOUT_REF }} - name: Checkout samples repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 if: matrix.name == 'samples' with: repository: radius-project/samples @@ -586,7 +586,7 @@ jobs: kubectl describe pods -A >> $POD_STATE_LOG_FILENAME - name: Upload container logs if: always() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ matrix.name }}_container_logs path: ./${{ env.RADIUS_CONTAINER_LOG_BASE }} @@ -606,7 +606,7 @@ jobs: # Get kubernetes events and save to file kubectl get events -n $namespace > recipes/pod-logs/events.txt - name: Upload Terraform recipe publishing logs - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() with: name: recipes-pod-logs @@ -676,7 +676,7 @@ jobs: done echo "Test Status: $TEST_STATUS" echo "test_status=$TEST_STATUS" >> $GITHUB_OUTPUT - - uses: LouisBrunner/checks-action@v1.6.1 + - uses: LouisBrunner/checks-action@v2.0.0 if: always() with: token: ${{ steps.get_installation_token.outputs.token }} diff --git a/.github/workflows/functional-tests-approval.yaml b/.github/workflows/functional-tests-approval.yaml index 669c299b2c..2e8b6bfb11 100644 --- a/.github/workflows/functional-tests-approval.yaml +++ b/.github/workflows/functional-tests-approval.yaml @@ -12,6 +12,6 @@ jobs: environment: functional-tests steps: - name: Use custom actions - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Save PR number uses: ./.github/actions/save-pr-as-artifact diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index b96210ebe8..b68f1019a9 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -38,13 +38,13 @@ jobs: HELM_CHARTS_DIR: deploy/Chart steps: - name: Check out repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Go ${{ env.GOVER }} - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: ${{ env.GOVER }} - name: Setup NodeJS - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: '18' - name: Install TypeSpec compiler @@ -61,17 +61,19 @@ jobs: - name: Install controller-gen run: go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.9.1 - name: Install helm - uses: Azure/setup-helm@v3 + uses: azure/setup-helm@v4 with: version: 'v3.11.1' - name: Run Helm linter run: | helm lint ${{ env.HELM_CHARTS_DIR }} - name: Run linter - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v4 with: - version: 'latest' + version: 'v1.57.2' args: --timeout=10m + skip-cache: true + install-mode: "binary" - name: Run make generate run: make generate - name: Check if generated code is up to date diff --git a/.github/workflows/long-running-azure.yaml b/.github/workflows/long-running-azure.yaml index 1c3710c300..2a9639ba9a 100644 --- a/.github/workflows/long-running-azure.yaml +++ b/.github/workflows/long-running-azure.yaml @@ -49,11 +49,6 @@ on: schedule: # Run every 2 hours - cron: "0 */2 * * *" - pull_request: - branches: - - main - paths: - - ".github/workflows/long-running-azure.yaml" env: # Go version @@ -170,13 +165,13 @@ jobs: fi - name: Check out code if: steps.skip-build.outputs.SKIP_BUILD != 'true' - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ${{ env.CHECKOUT_REPO }} ref: ${{ env.CHECKOUT_REF }} - name: Set up Go ${{ env.GOVER }} if: steps.skip-build.outputs.SKIP_BUILD != 'true' - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: ${{ env.GOVER }} - name: Log the summary of build info for new version. @@ -233,7 +228,7 @@ jobs: DOCKER_TAG_VERSION: ${{ env.REL_VERSION }} - name: Upload CLI binary if: steps.skip-build.outputs.SKIP_BUILD != 'true' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ steps.gen-id.outputs.RAD_CLI_ARTIFACT_NAME }} path: | @@ -310,19 +305,19 @@ jobs: BICEP_RECIPE_TAG_VERSION: ${{ needs.build.outputs.REL_VERSION }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ${{ env.CHECKOUT_REPO }} ref: ${{ env.CHECKOUT_REF }} - name: Checkout samples repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: radius-project/samples ref: refs/heads/edge token: ${{ secrets.GH_RAD_CI_BOT_PAT }} path: samples - name: Set up Go ${{ env.GOVER }} - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: ${{ env.GOVER }} - name: Download rad CLI @@ -478,7 +473,7 @@ jobs: kubectl describe pods -A >> $POD_STATE_LOG_FILENAME - name: Upload container logs if: always() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: all_container_logs path: ./${{ env.RADIUS_CONTAINER_LOG_BASE }} diff --git a/.github/workflows/publish-bicep.yaml b/.github/workflows/publish-bicep.yaml index 8430d8db97..8c424686e1 100644 --- a/.github/workflows/publish-bicep.yaml +++ b/.github/workflows/publish-bicep.yaml @@ -33,7 +33,7 @@ jobs: timeout-minutes: 10 steps: - name: Checkout PR branch - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha }} @@ -44,7 +44,7 @@ jobs: echo "gh_uri=https://github.com/radius-project/radius/tree/$(git rev-parse HEAD)/hack/bicep-types-radius/generated" >> $GITHUB_OUTPUT - name: Clone https://github.com/radius-project/bicep - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: token: ${{ secrets.GH_RAD_CI_BOT_PAT }} repository: radius-project/bicep diff --git a/.github/workflows/publish-docs.yaml b/.github/workflows/publish-docs.yaml index aac8d718f7..604f359c23 100644 --- a/.github/workflows/publish-docs.yaml +++ b/.github/workflows/publish-docs.yaml @@ -27,7 +27,7 @@ jobs: GOPRIVATE: github.com/radius-project steps: - name: Checkout radius repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: radius-project/radius path: radius @@ -41,19 +41,19 @@ jobs: echo DOCS_BRANCH="edge" >> $GITHUB_ENV fi - name: Checkout docs repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: radius-project/docs path: docs ref: ${{ env.DOCS_BRANCH }} # Setup dependencies - name: Set up Go ${{ env.GOVER }} - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: ${{ env.GOVER }} cache-dependency-path: radius/go.sum - name: Setup NodeJS - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: '18' - name: Install TypeSpec compiler @@ -82,7 +82,7 @@ jobs: - name: Generate resource reference docs run: python docs/.github/scripts/generate_resource_references.py ./radius/hack/bicep-types-radius/generated/ ./docs/docs/content/reference/resources - name: Upload resource reference docs - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: resource-docs path: docs/docs/content/reference/resources @@ -93,7 +93,7 @@ jobs: cd radius go run cmd/docgen/main.go ../docs/docs/content/reference/cli - name: Upload CLI docs - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: cli-docs path: docs/docs/content/reference/cli diff --git a/.github/workflows/radius-bot.yaml b/.github/workflows/radius-bot.yaml index a16c13b14a..994f0ced5c 100644 --- a/.github/workflows/radius-bot.yaml +++ b/.github/workflows/radius-bot.yaml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: sparse-checkout: | .github/scripts/radius-bot.js diff --git a/.github/workflows/release-verification.yaml b/.github/workflows/release-verification.yaml index cef4bf0d7c..c5f9c7de23 100644 --- a/.github/workflows/release-verification.yaml +++ b/.github/workflows/release-verification.yaml @@ -30,7 +30,7 @@ jobs: runs-on: ubuntu-latest if: github.repository == 'radius-project/radius' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Ensure inputs.version is valid semver run: | python ./.github/scripts/validate_semver.py ${{ inputs.version }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index b217e159bf..6602d64405 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -43,7 +43,7 @@ jobs: RELNOTE_FOUND: false steps: - name: Checkout radius-project/radius - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Get supported versions from versions.yaml id: get-supported-versions uses: mikefarah/yq@v4.34.2 @@ -55,7 +55,7 @@ jobs: run: | ./.github/scripts/release-get-version.sh ${{ steps.get-supported-versions.outputs.result }} "." - name: Find the previous tag - uses: actions/github-script@v6 + uses: actions/github-script@v7 id: latest-release-tag with: github-token: ${{ secrets.GH_RAD_CI_BOT_PAT }} @@ -67,7 +67,7 @@ jobs: }) return data.tag_name - name: Generate the release notes - uses: actions/github-script@v6 + uses: actions/github-script@v7 id: generate-notes with: github-token: ${{ secrets.GH_RAD_CI_BOT_PAT }} @@ -125,35 +125,35 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout radius-project/radius@main - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: radius-project/radius ref: main token: ${{ secrets.GH_RAD_CI_BOT_PAT }} path: radius - name: Checkout radius-project/bicep@bicep-extensibility - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: radius-project/bicep ref: bicep-extensibility token: ${{ secrets.GH_RAD_CI_BOT_PAT }} path: bicep - name: Checkout radius-project/deployment-engine@main - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: radius-project/deployment-engine ref: main token: ${{ secrets.GH_RAD_CI_BOT_PAT }} path: deployment-engine - name: Checkout radius-project/recipes@main - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: radius-project/recipes ref: main token: ${{ secrets.GH_RAD_CI_BOT_PAT }} path: recipes - name: Checkout radius-project/dashboard@main - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: radius-project/dashboard ref: main @@ -175,7 +175,7 @@ jobs: ./radius/.github/scripts/release-get-version.sh ${{ steps.get-supported-versions.outputs.result }} radius - name: Check if release branch exists id: release-branch-exists - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: result-encoding: string script: | diff --git a/.github/workflows/retry-functional-test.yaml b/.github/workflows/retry-functional-test.yaml index ef0f4d5f1d..26e25f4df0 100644 --- a/.github/workflows/retry-functional-test.yaml +++ b/.github/workflows/retry-functional-test.yaml @@ -100,12 +100,12 @@ jobs: echo "CHECKOUT_REPO=youngbupark/radius" >> $GITHUB_ENV echo "CHECKOUT_REF=refs/heads/youngp/enable-retry-test" >> $GITHUB_ENV - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ${{ env.CHECKOUT_REPO }} ref: ${{ env.CHECKOUT_REF }} - name: Set up Go ${{ env.GOVER }} - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: ${{ env.GOVER }} - name: Generate ID for release @@ -191,7 +191,7 @@ jobs: DOCKER_REGISTRY: ${{ env.CONTAINER_REGISTRY }} DOCKER_TAG_VERSION: ${{ env.REL_VERSION }} - name: Upload CLI binary - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ steps.gen-id.outputs.RAD_CLI_ARTIFACT_NAME }} path: | @@ -291,19 +291,19 @@ jobs: app_id: ${{ env.FUNCTIONAL_TEST_APP_ID }} private_key: ${{ secrets.FUNCTIONAL_TEST_APP_PRIVATE_KEY }} - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ${{ env.CHECKOUT_REPO }} ref: ${{ env.CHECKOUT_REF }} - name: Checkout samples repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 if: matrix.name == 'samples' with: repository: radius-project/samples ref: refs/heads/edge path: samples - name: Set up Go ${{ env.GOVER }} - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: go-version: ${{ env.GOVER }} - name: Get Go Cache path @@ -311,7 +311,7 @@ jobs: run: | echo "go-build=$(go env GOCACHE)" >> $GITHUB_OUTPUT echo "go-mod=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: | ${{ steps.go-cache-paths.outputs.go-build }} @@ -350,7 +350,7 @@ jobs: while [ $(az group exists --name $RESOURCE_GROUP) = false ]; do sleep 2; done env: RESOURCE_GROUP: ${{ env.AZURE_TEST_RESOURCE_GROUP }} - - uses: azure/setup-helm@v3 + - uses: azure/setup-helm@v4 with: version: ${{ env.HELM_VER }} - name: Create KinD cluster @@ -523,7 +523,7 @@ jobs: kubectl describe pods -A >> $POD_STATE_LOG_FILENAME - name: Upload container logs if: always() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ matrix.name }}_container_logs path: ./${{ env.RADIUS_CONTAINER_LOG_BASE }} @@ -543,7 +543,7 @@ jobs: # Get kubernetes events and save to file kubectl get events -n $namespace > recipes/pod-logs/events.txt - name: Upload Terraform recipe publishing logs - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() with: name: recipes-pod-logs diff --git a/.github/workflows/scorecard.yaml b/.github/workflows/scorecard.yaml index 87918bcccc..af6c3c9e38 100644 --- a/.github/workflows/scorecard.yaml +++ b/.github/workflows/scorecard.yaml @@ -35,30 +35,31 @@ jobs: runs-on: ubuntu-latest if: github.repository == 'radius-project/radius' permissions: - # Needed to upload the results to code-scanning dashboard. + # Needed for Code scanning upload security-events: write - # Needed to publish results and get a badge (see publish_results below). + # Needed for GitHub OIDC token if publish_results is true id-token: write steps: - name: "Checkout code" - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: persist-credentials: false - name: "Run analysis" - uses: ossf/scorecard-action@e38b1902ae4f44df626f11ba0734b14fb91f8f86 # v2.1.2 + uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1 with: results_file: results.sarif results_format: sarif - # Publish results to enable scorecard badge. For more details, see - # https://github.com/ossf/scorecard-action#publishing-results. + # Scorecard team runs a weekly scan of public GitHub repos, + # see https://github.com/ossf/scorecard#public-data. publish_results: true - # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF - # format to the repository Actions tab. + # Upload the results as artifacts (optional). Commenting out will disable + # uploads of run results in SARIF format to the repository Actions tab. + # https://docs.github.com/en/actions/advanced-guides/storing-workflow-data-as-artifacts - name: "Upload artifact" - uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 with: name: OpenSSF scan results path: results.sarif @@ -66,6 +67,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@17573ee1cc1b9d061760f3a006fc4aac4f944fd5 # v2.2.4 + uses: github/codeql-action/upload-sarif@83a02f7883b12e0e4e1a146174f5e2292a01e601 # v2.16.4 with: sarif_file: results.sarif diff --git a/.github/workflows/validate-bicep.yaml b/.github/workflows/validate-bicep.yaml index 29e70fad59..209a017709 100644 --- a/.github/workflows/validate-bicep.yaml +++ b/.github/workflows/validate-bicep.yaml @@ -32,10 +32,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Parse release version and set environment variables run: python ./.github/scripts/get_release_version.py - - uses: oras-project/setup-oras@v1 + - uses: oras-project/setup-oras@main - name: Download rad-bicep run: | oras pull ghcr.io/radius-project/radius/bicep/rad-bicep/linux-x64:latest -o ./ diff --git a/.github/workflows/validate-devcontainer-feature.yaml b/.github/workflows/validate-devcontainer-feature.yaml index 4ea59dc9cd..1202918a10 100644 --- a/.github/workflows/validate-devcontainer-feature.yaml +++ b/.github/workflows/validate-devcontainer-feature.yaml @@ -12,7 +12,7 @@ jobs: validate: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Validate devcontainer-feature.json files" uses: devcontainers/action@v1 diff --git a/.github/workflows/validate-installers.yaml b/.github/workflows/validate-installers.yaml index 9faeaad2ad..e652a56c58 100644 --- a/.github/workflows/validate-installers.yaml +++ b/.github/workflows/validate-installers.yaml @@ -30,7 +30,7 @@ jobs: name: Validate Installers runs-on: windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Run installer test script shell: powershell run: "deploy/test-pwsh-install.ps1" From 2f1525fcec91551ef31003a89144004c3a6b5265 Mon Sep 17 00:00:00 2001 From: Young Bu Park Date: Mon, 1 Apr 2024 11:12:37 -0700 Subject: [PATCH 13/19] Upgrade all remaining actions to the latest (#7424) # Description * Functional test workflow uses the older version of download-artifact action, resulting in the cli download failure * Dependabot found more upgradable actions - https://github.com/radius-project/radius/pull/7423. I upgraded all actions to the latest. ## Type of change - This pull request fixes a bug in Radius and has an approved issue (issue link required). - This pull request adds or changes features of Radius and has an approved issue (issue link required). - This pull request is a minor refactor, code cleanup, test improvement, or other maintenance task and doesn't change the functionality of Radius (issue link optional). Fixes: #issue_number --------- Signed-off-by: Young Bu Park --- .../download-pr-data-artifact/action.yaml | 4 ++-- .github/actions/setup-rad-cli/action.yaml | 8 +++---- .github/workflows/close-stale-prs.yml | 2 +- .github/workflows/devops-boards.yaml | 2 +- .github/workflows/functional-test.yaml | 24 +++++++++---------- .github/workflows/long-running-azure.yaml | 8 +++---- .github/workflows/publish-bicep.yaml | 2 +- .github/workflows/publish-docs.yaml | 2 +- .../workflows/purge-aws-test-resources.yaml | 2 +- .github/workflows/radius-bot.yaml | 2 +- .github/workflows/release.yaml | 4 ++-- .github/workflows/retry-functional-test.yaml | 12 +++++----- .github/workflows/triage-bot.yaml | 4 ++-- 13 files changed, 38 insertions(+), 38 deletions(-) diff --git a/.github/actions/download-pr-data-artifact/action.yaml b/.github/actions/download-pr-data-artifact/action.yaml index 2aac372ddb..04b0258adb 100644 --- a/.github/actions/download-pr-data-artifact/action.yaml +++ b/.github/actions/download-pr-data-artifact/action.yaml @@ -10,7 +10,7 @@ runs: using: "composite" steps: - name: Download artifact - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: script: | let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ @@ -34,7 +34,7 @@ runs: run: unzip pr_number.zip - name: Set PR number id: set-pr-number - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: script: | let fs = require('fs'); diff --git a/.github/actions/setup-rad-cli/action.yaml b/.github/actions/setup-rad-cli/action.yaml index 4bfb72cbb7..bc6e20a957 100644 --- a/.github/actions/setup-rad-cli/action.yaml +++ b/.github/actions/setup-rad-cli/action.yaml @@ -4,7 +4,7 @@ runs: using: "composite" steps: - name: Set up Go ${{ env.GOVER }} - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: go-version: ${{ env.GOVER }} - name: Get Go Cache path @@ -13,7 +13,7 @@ runs: run: | echo "go-build=$(go env GOCACHE)" >> $GITHUB_OUTPUT echo "go-mod=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: | ${{ steps.go-cache-paths.outputs.go-build }} @@ -22,12 +22,12 @@ runs: restore-keys: | ${{ runner.os }}-go- - name: Setup kubectl - uses: azure/setup-kubectl@v2.0 + uses: azure/setup-kubectl@v4 - name: Parse release version and set environment variables shell: bash run: python ./.github/scripts/get_release_version.py - name: Download release artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: rad_cli_linux_amd64 path: dist diff --git a/.github/workflows/close-stale-prs.yml b/.github/workflows/close-stale-prs.yml index 04eec4cf6e..7a4b17e8a0 100644 --- a/.github/workflows/close-stale-prs.yml +++ b/.github/workflows/close-stale-prs.yml @@ -16,7 +16,7 @@ jobs: pull-requests: write steps: - - uses: actions/stale@v5 + - uses: actions/stale@v9 with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-pr-message: 'This pull request has been automatically marked as stale because it has been inactive for 90 days. Remove stale label or comment or this PR will be closed in 7 days.' diff --git a/.github/workflows/devops-boards.yaml b/.github/workflows/devops-boards.yaml index 7e5490999a..d1d053cc1b 100644 --- a/.github/workflows/devops-boards.yaml +++ b/.github/workflows/devops-boards.yaml @@ -13,7 +13,7 @@ jobs: alert: runs-on: ubuntu-latest steps: - - uses: danhellem/github-actions-issue-to-work-item@v2.1 + - uses: danhellem/github-actions-issue-to-work-item@v2.2 env: ado_token: "${{ secrets.ADO_AOCTO_BOT_TOKEN }}" github_token: "${{ secrets.GH_RAD_CI_BOT_PAT }}" diff --git a/.github/workflows/functional-test.yaml b/.github/workflows/functional-test.yaml index 56bc75ffdf..5109ecd604 100644 --- a/.github/workflows/functional-test.yaml +++ b/.github/workflows/functional-test.yaml @@ -100,7 +100,7 @@ jobs: DE_TAG: ${{ steps.gen-id.outputs.DE_TAG }} steps: - name: Get GitHub app token - uses: tibdex/github-app-token@v1 + uses: tibdex/github-app-token@v2 id: get_installation_token with: app_id: ${{ env.FUNCTIONAL_TEST_APP_ID }} @@ -124,7 +124,7 @@ jobs: id: get-pr-number - name: 'Set PR context (workflow_run)' if: github.event_name == 'workflow_run' - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | @@ -137,7 +137,7 @@ jobs: `PR_NUMBER=${{ steps.get-pr-number.outputs.pr_number }}\n`); - name: Set DE image and tag (repository_dispatch from de-functional-test) if: github.event_name == 'repository_dispatch' - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: github-token: ${{ secrets.GH_RAD_CI_BOT_PAT }} script: | @@ -222,7 +222,7 @@ jobs: ## Test Status - name: Login to GitHub Container Registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} @@ -339,7 +339,7 @@ jobs: DE_TAG: ${{ needs.build.outputs.DE_TAG }} steps: - name: Get GitHub app token - uses: tibdex/github-app-token@v1 + uses: tibdex/github-app-token@v2 id: get_installation_token with: app_id: ${{ env.FUNCTIONAL_TEST_APP_ID }} @@ -366,7 +366,7 @@ jobs: ref: refs/heads/edge path: samples - name: Set up Go ${{ env.GOVER }} - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: go-version: ${{ env.GOVER }} - name: Get Go Cache path @@ -383,7 +383,7 @@ jobs: restore-keys: | ${{ runner.os }}-go- - name: Download rad CLI - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: ${{ env.RAD_CLI_ARTIFACT_NAME }} path: bin @@ -413,7 +413,7 @@ jobs: while [ $(az group exists --name $RESOURCE_GROUP) = false ]; do sleep 2; done env: RESOURCE_GROUP: ${{ env.AZURE_TEST_RESOURCE_GROUP }} - - uses: azure/setup-helm@v3 + - uses: azure/setup-helm@v4 with: version: ${{ env.HELM_VER }} - name: Create KinD cluster @@ -470,7 +470,7 @@ jobs: helm repo add azure-workload-identity https://azure.github.io/azure-workload-identity/charts helm install workload-identity-webhook azure-workload-identity/workload-identity-webhook --namespace radius-default --create-namespace --version ${{ env.AZURE_WORKLOAD_IDENTITY_WEBHOOK_VER }} --set azureTenantID=${{ secrets.AZURE_SP_TESTS_TENANTID }} - name: Login to GitHub Container Registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} @@ -571,7 +571,7 @@ jobs: BICEP_RECIPE_REGISTRY: ${{ env.BICEP_RECIPE_REGISTRY }} BICEP_RECIPE_TAG_VERSION: ${{ env.BICEP_RECIPE_TAG_VERSION }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - uses: azure/setup-kubectl@v3 + - uses: azure/setup-kubectl@v4 if: always() with: version: ${{ env.KUBECTL_VER }} @@ -651,7 +651,7 @@ jobs: CHECKOUT_REF: ${{ needs.build.outputs.CHECKOUT_REF }} steps: - name: Get GitHub app token - uses: tibdex/github-app-token@v1 + uses: tibdex/github-app-token@v2 id: get_installation_token with: app_id: ${{ env.FUNCTIONAL_TEST_APP_ID }} @@ -695,7 +695,7 @@ jobs: if: failure() && github.event_name == 'schedule' && github.repository == 'radius-project/radius' steps: - name: Create failure issue for failing scheduled run - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: github-token: ${{ secrets.GH_RAD_CI_BOT_PAT }} script: | diff --git a/.github/workflows/long-running-azure.yaml b/.github/workflows/long-running-azure.yaml index 2a9639ba9a..d2508de1f5 100644 --- a/.github/workflows/long-running-azure.yaml +++ b/.github/workflows/long-running-azure.yaml @@ -214,7 +214,7 @@ jobs: tenant-id: ${{ secrets.AZURE_SP_TESTS_TENANTID }} subscription-id: ${{ secrets.AZURE_SUBSCRIPTIONID_TESTS }} - name: Login to GitHub Container Registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} @@ -322,7 +322,7 @@ jobs: go-version: ${{ env.GOVER }} - name: Download rad CLI if: env.SKIP_BUILD != 'true' - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: ${{ env.RAD_CLI_ARTIFACT_NAME }} path: bin @@ -345,7 +345,7 @@ jobs: tenant-id: ${{ secrets.AZURE_SP_TESTS_TENANTID }} subscription-id: ${{ secrets.AZURE_SUBSCRIPTIONID_TESTS }} - name: Login to GitHub Container Registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} @@ -503,7 +503,7 @@ jobs: if: failure() && github.repository == 'radius-project/radius' && github.event_name == 'schedule' steps: - name: Create failure issue for failing long running test run - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: github-token: ${{ secrets.GH_RAD_CI_BOT_PAT }} script: | diff --git a/.github/workflows/publish-bicep.yaml b/.github/workflows/publish-bicep.yaml index 8c424686e1..5b2971508c 100644 --- a/.github/workflows/publish-bicep.yaml +++ b/.github/workflows/publish-bicep.yaml @@ -57,7 +57,7 @@ jobs: cp -R hack/bicep-types-radius/generated/* workflow-temp/bicep/src/Bicep.Types.Radius/generated - name: Create Pull Request in radius-project/bicep repo - uses: peter-evans/create-pull-request@v4 + uses: peter-evans/create-pull-request@v6 with: path: workflow-temp/bicep token: ${{ secrets.GH_RAD_CI_BOT_PAT }} diff --git a/.github/workflows/publish-docs.yaml b/.github/workflows/publish-docs.yaml index 604f359c23..bf9bfc45a5 100644 --- a/.github/workflows/publish-docs.yaml +++ b/.github/workflows/publish-docs.yaml @@ -104,7 +104,7 @@ jobs: git status --porcelain -unormal -- *.md - name: Create pull request if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.open_pull_request == 'true') - uses: peter-evans/create-pull-request@v5 + uses: peter-evans/create-pull-request@v6 with: token: ${{ secrets.GH_RAD_CI_BOT_PAT }} path: docs diff --git a/.github/workflows/purge-aws-test-resources.yaml b/.github/workflows/purge-aws-test-resources.yaml index 160a0f7636..8ebc612d25 100644 --- a/.github/workflows/purge-aws-test-resources.yaml +++ b/.github/workflows/purge-aws-test-resources.yaml @@ -32,7 +32,7 @@ jobs: if: github.repository == 'radius-project/radius' steps: - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 + uses: aws-actions/configure-aws-credentials@v4 with: aws-access-key-id: ${{ secrets.FUNCTEST_AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.FUNCTEST_AWS_SECRET_ACCESS_KEY }} diff --git a/.github/workflows/radius-bot.yaml b/.github/workflows/radius-bot.yaml index 994f0ced5c..6a93863367 100644 --- a/.github/workflows/radius-bot.yaml +++ b/.github/workflows/radius-bot.yaml @@ -16,7 +16,7 @@ jobs: .github/scripts/radius-bot.js sparse-checkout-cone-mode: false - name: Comment analyzer - uses: actions/github-script@v6 + uses: actions/github-script@v7 env: TEAM_SLUG: 'approvers-radius' with: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 6602d64405..a655f04dc0 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -46,7 +46,7 @@ jobs: uses: actions/checkout@v4 - name: Get supported versions from versions.yaml id: get-supported-versions - uses: mikefarah/yq@v4.34.2 + uses: mikefarah/yq@v4.43.1 with: # Get a comma-separated list of supported versions cmd: yq '.supported[].version' versions.yaml | tr '\n' ',' | sed 's/,$//' @@ -165,7 +165,7 @@ jobs: git config --global user.email "radiuscoreteam@service.microsoft.com" - name: Get supported versions from versions.yaml id: get-supported-versions - uses: mikefarah/yq@v4.34.2 + uses: mikefarah/yq@v4.43.1 with: # Get a comma-separated list of supported versions cmd: yq '.supported[].version' ./radius/versions.yaml | tr '\n' ',' | sed 's/,$//' diff --git a/.github/workflows/retry-functional-test.yaml b/.github/workflows/retry-functional-test.yaml index 26e25f4df0..03087a0344 100644 --- a/.github/workflows/retry-functional-test.yaml +++ b/.github/workflows/retry-functional-test.yaml @@ -90,7 +90,7 @@ jobs: DE_TAG: ${{ steps.gen-id.outputs.DE_TAG }} steps: - name: Get GitHub app token - uses: tibdex/github-app-token@v1 + uses: tibdex/github-app-token@v2 id: get_installation_token with: app_id: ${{ env.FUNCTIONAL_TEST_APP_ID }} @@ -169,7 +169,7 @@ jobs: ## Test Status - name: Login to GitHub Container Registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} @@ -285,7 +285,7 @@ jobs: DE_TAG: ${{ needs.build.outputs.DE_TAG }} steps: - name: Get GitHub app token - uses: tibdex/github-app-token@v1 + uses: tibdex/github-app-token@v2 id: get_installation_token with: app_id: ${{ env.FUNCTIONAL_TEST_APP_ID }} @@ -320,7 +320,7 @@ jobs: restore-keys: | ${{ runner.os }}-go- - name: Download rad CLI - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: ${{ env.RAD_CLI_ARTIFACT_NAME }} path: bin @@ -407,7 +407,7 @@ jobs: helm repo add azure-workload-identity https://azure.github.io/azure-workload-identity/charts helm install workload-identity-webhook azure-workload-identity/workload-identity-webhook --namespace radius-default --create-namespace --version ${{ env.AZURE_WORKLOAD_IDENTITY_WEBHOOK_VER }} --set azureTenantID=${{ secrets.AZURE_SP_TESTS_TENANTID }} - name: Login to GitHub Container Registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} @@ -508,7 +508,7 @@ jobs: BICEP_RECIPE_REGISTRY: ${{ env.BICEP_RECIPE_REGISTRY }} BICEP_RECIPE_TAG_VERSION: ${{ env.BICEP_RECIPE_TAG_VERSION }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - uses: azure/setup-kubectl@v3 + - uses: azure/setup-kubectl@v4 if: always() with: version: ${{ env.KUBECTL_VER }} diff --git a/.github/workflows/triage-bot.yaml b/.github/workflows/triage-bot.yaml index dbc919b89d..4062a63c1f 100644 --- a/.github/workflows/triage-bot.yaml +++ b/.github/workflows/triage-bot.yaml @@ -29,12 +29,12 @@ jobs: env: RADIUS_TRIAGE_BOT_APP_ID: 417813 steps: - - uses: tibdex/github-app-token@v1 + - uses: tibdex/github-app-token@v2 id: get_installation_token with: app_id: ${{ env.RADIUS_TRIAGE_BOT_APP_ID }} private_key: ${{ secrets.RADIUS_TRIAGE_BOT_PRIVATE_KEY }} - - uses: dessant/label-actions@v3 + - uses: dessant/label-actions@v4 with: github-token: ${{ steps.get_installation_token.outputs.token }} config-path: '.github/triage-bot/triage-bot-config.yaml' From 9f8ed7fe4f168a1943cf357d222f2550b0a05629 Mon Sep 17 00:00:00 2001 From: Young Bu Park Date: Mon, 1 Apr 2024 11:35:24 -0700 Subject: [PATCH 14/19] Upgrade actions to fix upload conflict (#7426) # Description Upgrade actions to fix upload conflict ## Type of change - This pull request fixes a bug in Radius and has an approved issue (issue link required). - This pull request adds or changes features of Radius and has an approved issue (issue link required). - This pull request is a minor refactor, code cleanup, test improvement, or other maintenance task and doesn't change the functionality of Radius (issue link optional). Fixes: #issue_number Signed-off-by: Young Bu Park --- .github/workflows/build.yaml | 2 +- .github/workflows/functional-test.yaml | 4 ++-- .github/workflows/long-running-azure.yaml | 6 +++--- .github/workflows/retry-functional-test.yaml | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 2d542adf25..7a087044a6 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -193,7 +193,7 @@ jobs: > The coverage result does not include the functional test coverage. - name: Save coverage (only main push) - uses: actions/cache/save@v3 + uses: actions/cache/save@v4 if: matrix.target_arch == 'amd64' && matrix.target_os == 'linux' && github.ref == 'refs/heads/main' with: path: ./dist/cache diff --git a/.github/workflows/functional-test.yaml b/.github/workflows/functional-test.yaml index 5109ecd604..b581890056 100644 --- a/.github/workflows/functional-test.yaml +++ b/.github/workflows/functional-test.yaml @@ -374,7 +374,7 @@ jobs: run: | echo "go-build=$(go env GOCACHE)" >> $GITHUB_OUTPUT echo "go-mod=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: | ${{ steps.go-cache-paths.outputs.go-build }} @@ -609,7 +609,7 @@ jobs: uses: actions/upload-artifact@v4 if: always() with: - name: recipes-pod-logs + name: ${{ matrix.name }}_recipes-pod-logs path: recipes/pod-logs if-no-files-found: error - uses: marocchino/sticky-pull-request-comment@v2 diff --git a/.github/workflows/long-running-azure.yaml b/.github/workflows/long-running-azure.yaml index d2508de1f5..24088da4d8 100644 --- a/.github/workflows/long-running-azure.yaml +++ b/.github/workflows/long-running-azure.yaml @@ -107,7 +107,7 @@ jobs: RAD_CLI_ARTIFACT_NAME: ${{ steps.gen-id.outputs.RAD_CLI_ARTIFACT_NAME }} steps: - name: Restore the latest cached binaries - uses: actions/cache/restore@v3 + uses: actions/cache/restore@v4 with: path: ./dist/cache key: radius-test-latest- @@ -261,7 +261,7 @@ jobs: echo "PR_NUMBER=${{ steps.gen-id.outputs.PR_NUMBER }}" >> ./dist/cache/.buildenv echo "BICEP_RECIPE_TAG_VERSION=${{ steps.gen-id.outputs.REL_VERSION }}" >> ./dist/cache/.buildenv - name: Store the latest binaries into cache - uses: actions/cache/save@v3 + uses: actions/cache/save@v4 if: steps.skip-build.outputs.SKIP_BUILD != 'true' && success() with: path: ./dist/cache @@ -328,7 +328,7 @@ jobs: path: bin - name: Restore the latest cached binaries if: env.SKIP_BUILD == 'true' - uses: actions/cache/restore@v3 + uses: actions/cache/restore@v4 with: path: ./dist/cache key: radius-test-latest- diff --git a/.github/workflows/retry-functional-test.yaml b/.github/workflows/retry-functional-test.yaml index 03087a0344..551bb3fd10 100644 --- a/.github/workflows/retry-functional-test.yaml +++ b/.github/workflows/retry-functional-test.yaml @@ -546,7 +546,7 @@ jobs: uses: actions/upload-artifact@v4 if: always() with: - name: recipes-pod-logs + name: ${{ matrix.name }}_recipes-pod-logs path: recipes/pod-logs if-no-files-found: error - uses: marocchino/sticky-pull-request-comment@v2 From 36050b00ad53b5f3dee8f16d7c99a17cfcac105e Mon Sep 17 00:00:00 2001 From: Young Bu Park Date: Mon, 1 Apr 2024 11:56:31 -0700 Subject: [PATCH 15/19] Enable codecov (#7421) # Description This is to enable Codecov for coverage report. ## Type of change - This pull request fixes a bug in Radius and has an approved issue (issue link required). - This pull request adds or changes features of Radius and has an approved issue (issue link required). - This pull request is a minor refactor, code cleanup, test improvement, or other maintenance task and doesn't change the functionality of Radius (issue link optional). Fixes: #issue_number --------- Signed-off-by: Young Bu Park --- .github/workflows/build.yaml | 84 ++++-------------------------------- codecov.yml | 22 ++++++++++ 2 files changed, 30 insertions(+), 76 deletions(-) create mode 100644 codecov.yml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 7a087044a6..5d659d6890 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -88,11 +88,6 @@ jobs: with: go-version: ${{ env.GOVER }} cache-dependency-path: go.sum - - name: Restore the previous coverage - uses: actions/cache/restore@v4 - with: - path: ./dist/cache - key: radius-coverage- - name: Parse release version and set environment variables run: python ./.github/scripts/get_release_version.py - name: Make build @@ -101,10 +96,17 @@ jobs: if: matrix.target_arch == 'amd64' && matrix.target_os == 'linux' env: GOTESTSUM_OPTS: '--junitfile ./dist/unit_test/results.xml' - GOTEST_OPTS: '-race -coverprofile ./dist/ut_coverage_orig.out' + GOTEST_OPTS: '-race -coverprofile ./dist/unit_test/ut_coverage.out' run: | + mkdir -p ./dist/unit_test go install gotest.tools/gotestsum@v${{ env.GOTESTSUMVERSION }} make test + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + file: ./dist/unit_test/ut_coverage.out + flags: unittests + fail_ci_if_error: false - name: Process Unit Test Results uses: ./.github/actions/process-test-results # Always is required here to make sure this target runs even when tests fail. @@ -128,76 +130,6 @@ jobs: with: name: rad_cli_${{ matrix.target_os}}_${{ matrix.target_arch}} path: ${{ env.RELEASE_PATH }} - - name: Generate unit-test coverage files - if: matrix.target_arch == 'amd64' && matrix.target_os == 'linux' - run: | - # Remove mock, generated files, and datamodels from original coverage output. - cat ./dist/ut_coverage_orig.out | grep -v "mock" | grep -v "zz_" | grep -v "armrpc/rpctest" | grep -v '/datamodel/[A-za-z0-9_]*.go' > $COVERAGE_FILE - # Generate reports. - $GO_TOOL_COVER -func=$COVERAGE_FILE -o ./dist/ut_coverage.txt - $GO_TOOL_COVER -html=$COVERAGE_FILE -o ./dist/ut_coverage.html - # Parse total coverage rate from report. - UT_COVERAGE=`cat ./dist/ut_coverage.txt | grep total: | grep -Eo '[0-9]+\.[0-9]+'` - echo "Test coverage : $UT_COVERAGE" - - echo "ut_coverage=$UT_COVERAGE" >> $GITHUB_ENV - - mkdir -p ./dist/cache - MAIN_COVERAGE=0 - if [ -f "./dist/cache/ut_coverage.txt" ]; then - MAIN_COVERAGE=$(cat ./dist/cache/ut_coverage.txt | grep total: | grep -Eo '[0-9]+\.[0-9]+') - fi - echo "main_coverage=$MAIN_COVERAGE" >> $GITHUB_ENV - - if (( $(echo "$UT_COVERAGE < $MAIN_COVERAGE" | bc -l) )) ; then - COLOR=red - else - COLOR=green - fi - - DIFF_RATE=$(echo "$UT_COVERAGE-$MAIN_COVERAGE" | bc -l) - echo "diff_coverage=$DIFF_RATE" >> $GITHUB_ENV - - echo "coverage_img=https://img.shields.io/badge/coverage-$UT_COVERAGE%25-$COLOR" >> $GITHUB_ENV - # copy coverage to cache - cp ./dist/ut_coverage.txt ./dist/cache/ - env: - COVERAGE_FILE: ./dist/ut_coverage.out - GO_TOOL_COVER: go tool cover - - name: Upload unit-test coverage artifact - if: matrix.target_arch == 'amd64' && matrix.target_os == 'linux' - uses: actions/upload-artifact@v4 - with: - name: unit_test_coverage - path: | - ./dist/coverage_orig.out - ./dist/ut_coverage.out - ./dist/ut_coverage.txt - ./dist/ut_coverage.html - - name: Add coverage result comment - if: matrix.target_arch == 'amd64' && matrix.target_os == 'linux' && github.event.pull_request && github.event.pull_request.head.repo.full_name == github.repository - uses: marocchino/sticky-pull-request-comment@v2 - with: - header: testcov-${{ github.run_id }} - number: ${{ github.event.pull_request.number }} - hide: true - hide_classify: OUTDATED - message: | - ![${{ env.ut_coverage }}](${{ env.coverage_img }}) - - For the detailed report, please go to `Checks tab`, click `Build and Test`, and then download `unit_test_coverage` artifact at the bottom of build page. - - * Your PR branch coverage: ${{ env.ut_coverage }} % - * main branch coverage: ${{ env.main_coverage }} % - * diff coverage: ${{ env.diff_coverage }} % - - > The coverage result does not include the functional test coverage. - - name: Save coverage (only main push) - uses: actions/cache/save@v4 - if: matrix.target_arch == 'amd64' && matrix.target_os == 'linux' && github.ref == 'refs/heads/main' - with: - path: ./dist/cache - key: radius-coverage-${{ github.sha }}-${{ github.run_number }} - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000000..b14376cfa1 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,22 @@ +codecov: + require_ci_to_pass: yes + +coverage: + precision: 2 + round: down + range: "50...100" + status: + project: + default: + target: auto + threshold: 1% + +comment: + layout: "reach,diff,flags,tree" + behavior: default + require_changes: no + +ignore: + - "**/mock_*" # ignore all mock files + - "pkg/armrpc/rpctest/*" # ignore all test helpers in rpctest + - "**/zz_*" # ignore autogenerated files from autorest From 72dfb506d95b1da6dbc4b975bb8e180b4dce175b Mon Sep 17 00:00:00 2001 From: Young Bu Park Date: Mon, 1 Apr 2024 17:57:35 -0700 Subject: [PATCH 16/19] Run codecov action only once (#7427) --- .codecov.yml | 20 ++++++++++++++++++++ .github/workflows/build.yaml | 9 ++++++--- codecov.yml | 22 ---------------------- 3 files changed, 26 insertions(+), 25 deletions(-) create mode 100644 .codecov.yml delete mode 100644 codecov.yml diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 0000000000..69e4c87f35 --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,20 @@ +codecov: + require_ci_to_pass: yes + +coverage: + precision: 2 + round: down + range: "30...100" + status: + project: + default: + informational: true + target: auto + threshold: 0% + +ignore: + - "**/mock_*.go" # ignore all mock files + - "pkg/armrpc/rpctest" # ignore all test helpers in rpctest + - "**/zz_generated*.go" # ignore autogenerated files from autorest + - "pkg/controller/api" # CRD related files + - "pkg/ucp/store/apiserverstore/api" # CRD related files \ No newline at end of file diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 5d659d6890..7877ce6491 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -102,11 +102,14 @@ jobs: go install gotest.tools/gotestsum@v${{ env.GOTESTSUMVERSION }} make test - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + if: matrix.target_arch == 'amd64' && matrix.target_os == 'linux' + uses: codecov/codecov-action@v4 with: + token: ${{ secrets.CODECOV_TOKEN }} + codecov_yml_path: ./.codecov.yml file: ./dist/unit_test/ut_coverage.out - flags: unittests - fail_ci_if_error: false + fail_ci_if_error: true + verbose: true - name: Process Unit Test Results uses: ./.github/actions/process-test-results # Always is required here to make sure this target runs even when tests fail. diff --git a/codecov.yml b/codecov.yml deleted file mode 100644 index b14376cfa1..0000000000 --- a/codecov.yml +++ /dev/null @@ -1,22 +0,0 @@ -codecov: - require_ci_to_pass: yes - -coverage: - precision: 2 - round: down - range: "50...100" - status: - project: - default: - target: auto - threshold: 1% - -comment: - layout: "reach,diff,flags,tree" - behavior: default - require_changes: no - -ignore: - - "**/mock_*" # ignore all mock files - - "pkg/armrpc/rpctest/*" # ignore all test helpers in rpctest - - "**/zz_*" # ignore autogenerated files from autorest From 1da9e8e3a1ad3846e169815e2ad8d9afcae9e53f Mon Sep 17 00:00:00 2001 From: Young Bu Park Date: Tue, 2 Apr 2024 09:47:43 -0700 Subject: [PATCH 17/19] Do not fail for codecov error (#7429) # Description Tokenless upload (forked repo pr) can be throttled like below. This is to unblock the build even if codecov is failed. ``` ==> Uploader SHASUM verified (e3ea28a069fe174eb99ac2ffb523bfb55d5d29a7cfd93ef48cde12e9b552b492 codecov) info - 2024-04-02 16:12:29,890 -- ci service found: github-actions debug - 2024-04-02 16:12:29,893 -- versioning system found: debug - 2024-04-02 16:12:29,893 -- Loading config from .codecov.yml debug - 2024-04-02 16:12:29,895 -- Starting create commit process --- {"commit_sha": "babae5be5a94d[64](https://github.com/radius-project/radius/actions/runs/8525878516/job/23353867349?pr=7390#step:7:65)fd7976b80e94905255116e920", "parent_sha": null, "pr": "7390", "branch": "vishwahiremat/recipe_show_cmd", "slug": "radius-project/radius", "token": null, "service": "github", "enterprise_url": null} info - 2024-04-02 16:12:30,144 -- The PR is happening in a forked repo. Using tokenless upload. info - 2024-04-02 16:12:30,334 -- Process Commit creating complete debug - 2024-04-02 16:12:30,334 -- Commit creating result --- {"result": "RequestResult(error=RequestError(code='HTTP Error 429', params={}, description='{\"detail\":\"Tokenless has reached GitHub rate limit. Please upload using a token: https://docs.codecov.com/docs/adding-the-codecov-token. Expected available in 1188 seconds.\"}'), warnings=[], status_code=429, text='{\"detail\":\"Tokenless has reached GitHub rate limit. Please upload using a token: https://docs.codecov.com/docs/adding-the-codecov-token. Expected available in 1188 seconds.\"}')"} error - 2024-04-02 16:12:30,334 -- Commit creating failed: {"detail":"Tokenless has reached GitHub rate limit. Please upload using a token: https://docs.codecov.com/docs/adding-the-codecov-token. Expected available in 1188 seconds."} Error: Codecov: Failed to properly create commit: The process '/home/runner/work/_actions/codecov/codecov-action/v4/dist/codecov' failed with exit code 1 ``` ## Type of change - This pull request fixes a bug in Radius and has an approved issue (issue link required). - This pull request adds or changes features of Radius and has an approved issue (issue link required). - This pull request is a minor refactor, code cleanup, test improvement, or other maintenance task and doesn't change the functionality of Radius (issue link optional). Fixes: #issue_number Signed-off-by: Young Bu Park --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 7877ce6491..fddcf1366e 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -108,7 +108,7 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} codecov_yml_path: ./.codecov.yml file: ./dist/unit_test/ut_coverage.out - fail_ci_if_error: true + fail_ci_if_error: false verbose: true - name: Process Unit Test Results uses: ./.github/actions/process-test-results From 186994dc96254c8b468af779afbb2c9943dc40ce Mon Sep 17 00:00:00 2001 From: Vishwanath Hiremath <100623239+vishwahiremat@users.noreply.github.com> Date: Wed, 3 Apr 2024 00:04:35 +0530 Subject: [PATCH 18/19] Creating an optional interface to get secret id references for driver with secrets. (#7306) # Description Refactoring module secret workflow. - Adding FindSecretIds function to get module secret references for driver with secrets. ## Type of change - Creating an optional interface to get secret id references for driver with secrets. - This pull request is a minor refactor, code cleanup, test improvement, or other maintenance task and doesn't change the functionality of Radius (issue link optional). Fixes: #issue_number --------- Signed-off-by: Vishwanath Hiremath Signed-off-by: Karishma Chawla Co-authored-by: Karishma Chawla --- .../configloader/mock_secret_loader.go | 51 +++++++ pkg/recipes/configloader/secrets.go | 8 +- pkg/recipes/configloader/types.go | 6 + pkg/recipes/driver/bicep.go | 1 - .../driver/mock_driver_with_secrets.go | 95 ++++++++++++ pkg/recipes/driver/terraform.go | 11 ++ pkg/recipes/driver/types.go | 14 ++ pkg/recipes/engine/engine.go | 23 +-- pkg/recipes/engine/engine_test.go | 143 +++++++++++++++--- pkg/recipes/errorcodes.go | 3 + 10 files changed, 319 insertions(+), 36 deletions(-) create mode 100644 pkg/recipes/configloader/mock_secret_loader.go create mode 100644 pkg/recipes/driver/mock_driver_with_secrets.go diff --git a/pkg/recipes/configloader/mock_secret_loader.go b/pkg/recipes/configloader/mock_secret_loader.go new file mode 100644 index 0000000000..1031b3fd0e --- /dev/null +++ b/pkg/recipes/configloader/mock_secret_loader.go @@ -0,0 +1,51 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: github.com/radius-project/radius/pkg/recipes/configloader (interfaces: SecretsLoader) + +// Package configloader is a generated GoMock package. +package configloader + +import ( + context "context" + reflect "reflect" + + gomock "github.com/golang/mock/gomock" + v20231001preview "github.com/radius-project/radius/pkg/corerp/api/v20231001preview" +) + +// MockSecretsLoader is a mock of SecretsLoader interface. +type MockSecretsLoader struct { + ctrl *gomock.Controller + recorder *MockSecretsLoaderMockRecorder +} + +// MockSecretsLoaderMockRecorder is the mock recorder for MockSecretsLoader. +type MockSecretsLoaderMockRecorder struct { + mock *MockSecretsLoader +} + +// NewMockSecretsLoader creates a new mock instance. +func NewMockSecretsLoader(ctrl *gomock.Controller) *MockSecretsLoader { + mock := &MockSecretsLoader{ctrl: ctrl} + mock.recorder = &MockSecretsLoaderMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockSecretsLoader) EXPECT() *MockSecretsLoaderMockRecorder { + return m.recorder +} + +// LoadSecrets mocks base method. +func (m *MockSecretsLoader) LoadSecrets(arg0 context.Context, arg1 string) (v20231001preview.SecretStoresClientListSecretsResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "LoadSecrets", arg0, arg1) + ret0, _ := ret[0].(v20231001preview.SecretStoresClientListSecretsResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// LoadSecrets indicates an expected call of LoadSecrets. +func (mr *MockSecretsLoaderMockRecorder) LoadSecrets(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LoadSecrets", reflect.TypeOf((*MockSecretsLoader)(nil).LoadSecrets), arg0, arg1) +} diff --git a/pkg/recipes/configloader/secrets.go b/pkg/recipes/configloader/secrets.go index 9c2707e070..4525a45687 100644 --- a/pkg/recipes/configloader/secrets.go +++ b/pkg/recipes/configloader/secrets.go @@ -22,17 +22,19 @@ import ( "github.com/radius-project/radius/pkg/ucp/resources" ) +var _ SecretsLoader = (*secretsLoader)(nil) + // NewSecretStoreLoader creates a new SecretsLoader instance with the given ARM Client Options. func NewSecretStoreLoader(armOptions *arm.ClientOptions) SecretsLoader { - return SecretsLoader{ArmClientOptions: armOptions} + return &secretsLoader{ArmClientOptions: armOptions} } // SecretsLoader struct provides functionality to get secret information from Application.Core/SecretStore resource. -type SecretsLoader struct { +type secretsLoader struct { ArmClientOptions *arm.ClientOptions } -func (e *SecretsLoader) LoadSecrets(ctx context.Context, secretStore string) (v20231001preview.SecretStoresClientListSecretsResponse, error) { +func (e *secretsLoader) LoadSecrets(ctx context.Context, secretStore string) (v20231001preview.SecretStoresClientListSecretsResponse, error) { secretStoreID, err := resources.ParseResource(secretStore) if err != nil { return v20231001preview.SecretStoresClientListSecretsResponse{}, err diff --git a/pkg/recipes/configloader/types.go b/pkg/recipes/configloader/types.go index 861196690d..d032693b59 100644 --- a/pkg/recipes/configloader/types.go +++ b/pkg/recipes/configloader/types.go @@ -19,6 +19,7 @@ package configloader import ( "context" + "github.com/radius-project/radius/pkg/corerp/api/v20231001preview" "github.com/radius-project/radius/pkg/recipes" ) @@ -28,3 +29,8 @@ type ConfigurationLoader interface { // LoadRecipe fetches the recipe information from the environment. LoadRecipe(ctx context.Context, recipe *recipes.ResourceMetadata) (*recipes.EnvironmentDefinition, error) } + +//go:generate mockgen -destination=./mock_secret_loader.go -package=configloader -self_package github.com/radius-project/radius/pkg/recipes/configloader github.com/radius-project/radius/pkg/recipes/configloader SecretsLoader +type SecretsLoader interface { + LoadSecrets(ctx context.Context, secretStore string) (v20231001preview.SecretStoresClientListSecretsResponse, error) +} diff --git a/pkg/recipes/driver/bicep.go b/pkg/recipes/driver/bicep.go index 85d1267a36..62fb32a0b7 100644 --- a/pkg/recipes/driver/bicep.go +++ b/pkg/recipes/driver/bicep.go @@ -45,7 +45,6 @@ import ( "github.com/radius-project/radius/pkg/ucp/ucplog" ) -//go:generate mockgen -destination=./mock_driver.go -package=driver -self_package github.com/radius-project/radius/pkg/recipes/driver github.com/radius-project/radius/pkg/recipes/driver Driver const ( deploymentPrefix = "recipe" pollFrequency = time.Second * 5 diff --git a/pkg/recipes/driver/mock_driver_with_secrets.go b/pkg/recipes/driver/mock_driver_with_secrets.go new file mode 100644 index 0000000000..253ac536f9 --- /dev/null +++ b/pkg/recipes/driver/mock_driver_with_secrets.go @@ -0,0 +1,95 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: github.com/radius-project/radius/pkg/recipes/driver (interfaces: DriverWithSecrets) + +// Package driver is a generated GoMock package. +package driver + +import ( + context "context" + reflect "reflect" + + gomock "github.com/golang/mock/gomock" + recipes "github.com/radius-project/radius/pkg/recipes" +) + +// MockDriverWithSecrets is a mock of DriverWithSecrets interface. +type MockDriverWithSecrets struct { + ctrl *gomock.Controller + recorder *MockDriverWithSecretsMockRecorder +} + +// MockDriverWithSecretsMockRecorder is the mock recorder for MockDriverWithSecrets. +type MockDriverWithSecretsMockRecorder struct { + mock *MockDriverWithSecrets +} + +// NewMockDriverWithSecrets creates a new mock instance. +func NewMockDriverWithSecrets(ctrl *gomock.Controller) *MockDriverWithSecrets { + mock := &MockDriverWithSecrets{ctrl: ctrl} + mock.recorder = &MockDriverWithSecretsMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockDriverWithSecrets) EXPECT() *MockDriverWithSecretsMockRecorder { + return m.recorder +} + +// Delete mocks base method. +func (m *MockDriverWithSecrets) Delete(arg0 context.Context, arg1 DeleteOptions) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete. +func (mr *MockDriverWithSecretsMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockDriverWithSecrets)(nil).Delete), arg0, arg1) +} + +// Execute mocks base method. +func (m *MockDriverWithSecrets) Execute(arg0 context.Context, arg1 ExecuteOptions) (*recipes.RecipeOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Execute", arg0, arg1) + ret0, _ := ret[0].(*recipes.RecipeOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Execute indicates an expected call of Execute. +func (mr *MockDriverWithSecretsMockRecorder) Execute(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Execute", reflect.TypeOf((*MockDriverWithSecrets)(nil).Execute), arg0, arg1) +} + +// FindSecretIDs mocks base method. +func (m *MockDriverWithSecrets) FindSecretIDs(arg0 context.Context, arg1 recipes.Configuration, arg2 recipes.EnvironmentDefinition) (string, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "FindSecretIDs", arg0, arg1, arg2) + ret0, _ := ret[0].(string) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// FindSecretIDs indicates an expected call of FindSecretIDs. +func (mr *MockDriverWithSecretsMockRecorder) FindSecretIDs(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindSecretIDs", reflect.TypeOf((*MockDriverWithSecrets)(nil).FindSecretIDs), arg0, arg1, arg2) +} + +// GetRecipeMetadata mocks base method. +func (m *MockDriverWithSecrets) GetRecipeMetadata(arg0 context.Context, arg1 BaseOptions) (map[string]interface{}, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetRecipeMetadata", arg0, arg1) + ret0, _ := ret[0].(map[string]interface{}) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetRecipeMetadata indicates an expected call of GetRecipeMetadata. +func (mr *MockDriverWithSecretsMockRecorder) GetRecipeMetadata(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRecipeMetadata", reflect.TypeOf((*MockDriverWithSecrets)(nil).GetRecipeMetadata), arg0, arg1) +} diff --git a/pkg/recipes/driver/terraform.go b/pkg/recipes/driver/terraform.go index c894140c1c..06546c3e9e 100644 --- a/pkg/recipes/driver/terraform.go +++ b/pkg/recipes/driver/terraform.go @@ -249,6 +249,17 @@ func (d *terraformDriver) GetRecipeMetadata(ctx context.Context, opts BaseOption return recipeData, nil } +// FindSecretIDs is used to retrieve the secret reference associated with private terraform module source. +// As of today, it only supports retrieving secret references associated with private git repositories. +func (d *terraformDriver) FindSecretIDs(ctx context.Context, envConfig recipes.Configuration, definition recipes.EnvironmentDefinition) (string, error) { + + // We can move the GetSecretStoreID() implementation here when we have containerization. + // Today we use this function in config.go to check for secretstore to add prefix to the template path. + // GetSecretStoreID is added outside of driver package because it created cyclic dependency between driver and config packages. + + return recipes.GetSecretStoreID(envConfig, definition.TemplatePath) +} + // getDeployedOutputResources is used to the get the resource IDs by parsing the terraform state for resource information and using it to create UCP qualified IDs. // Currently only Azure, AWS and Kubernetes providers are supported by output resources. func (d *terraformDriver) getDeployedOutputResources(ctx context.Context, module *tfjson.StateModule) ([]string, error) { diff --git a/pkg/recipes/driver/types.go b/pkg/recipes/driver/types.go index 0b981d6827..04fb7f241f 100644 --- a/pkg/recipes/driver/types.go +++ b/pkg/recipes/driver/types.go @@ -31,6 +31,8 @@ const ( ) // Driver is an interface to implement recipe deployment and recipe resources deletion. +// +//go:generate mockgen -destination=./mock_driver.go -package=driver -self_package github.com/radius-project/radius/pkg/recipes/driver github.com/radius-project/radius/pkg/recipes/driver Driver type Driver interface { // Execute fetches the recipe contents and deploys the recipe and returns deployed resources, secrets and values. Execute(ctx context.Context, opts ExecuteOptions) (*recipes.RecipeOutput, error) @@ -42,6 +44,18 @@ type Driver interface { GetRecipeMetadata(ctx context.Context, opts BaseOptions) (map[string]any, error) } +// DriverWithSecrets is an optional interface and used when the driver needs to load secrets for recipe deployment. +// +//go:generate mockgen -destination=./mock_driver_with_secrets.go -package=driver -self_package github.com/radius-project/radius/pkg/recipes/driver github.com/radius-project/radius/pkg/recipes/driver DriverWithSecrets +type DriverWithSecrets interface { + // Driver is an interface to implement recipe deployment and recipe resources deletion. + Driver + + // FindSecretIDs gets the secret store resource ID references associated with git private terraform repository source. + // In the future it will be extended to get secret references for provider secrets. + FindSecretIDs(ctx context.Context, config recipes.Configuration, definition recipes.EnvironmentDefinition) (string, error) +} + // BaseOptions is the base options for the driver operations. type BaseOptions struct { // Configuration is the configuration for the recipe. diff --git a/pkg/recipes/engine/engine.go b/pkg/recipes/engine/engine.go index 2655227414..c953e13abf 100644 --- a/pkg/recipes/engine/engine.go +++ b/pkg/recipes/engine/engine.go @@ -92,19 +92,20 @@ func (e *engine) executeCore(ctx context.Context, recipe recipes.ResourceMetadat return nil, nil, err } - // Retrieves the secret store id from the recipes configuration for the terraform module source of type git. - // secretStoreID returned will be an empty string for other types. - secretStore, err := recipes.GetSecretStoreID(*configuration, definition.TemplatePath) - if err != nil { - return nil, nil, err - } - - // Retrieves the secret values from the secret store ID provided. secrets := v20231001preview.SecretStoresClientListSecretsResponse{} - if secretStore != "" { - secrets, err = e.options.SecretsLoader.LoadSecrets(ctx, secretStore) + driverWithSecrets, ok := driver.(recipedriver.DriverWithSecrets) + if ok { + secretStore, err := driverWithSecrets.FindSecretIDs(ctx, *configuration, *definition) if err != nil { - return nil, nil, fmt.Errorf("failed to fetch secrets from the secret store resource id %s for Terraform recipe %s deployment: %w", secretStore, definition.TemplatePath, err) + return nil, nil, err + } + + // Retrieves the secret values from the secret store ID provided. + if secretStore != "" { + secrets, err = e.options.SecretsLoader.LoadSecrets(ctx, secretStore) + if err != nil { + return nil, nil, recipes.NewRecipeError(recipes.LoadSecretsFailed, fmt.Sprintf("failed to fetch secrets from the secret store resource id %s for Terraform recipe %s deployment: %s", secretStore, definition.TemplatePath, err.Error()), util.RecipeSetupError, recipes.GetErrorDetails(err)) + } } } diff --git a/pkg/recipes/engine/engine_test.go b/pkg/recipes/engine/engine_test.go index 705bb3aa1d..0e520a791a 100644 --- a/pkg/recipes/engine/engine_test.go +++ b/pkg/recipes/engine/engine_test.go @@ -22,6 +22,7 @@ import ( "testing" "github.com/golang/mock/gomock" + "github.com/radius-project/radius/pkg/corerp/api/v20231001preview" "github.com/radius-project/radius/pkg/corerp/datamodel" "github.com/radius-project/radius/pkg/recipes" "github.com/radius-project/radius/pkg/recipes/configloader" @@ -32,21 +33,24 @@ import ( "github.com/stretchr/testify/require" ) -func setup(t *testing.T) (engine, configloader.MockConfigurationLoader, recipedriver.MockDriver) { +func setup(t *testing.T) (engine, configloader.MockConfigurationLoader, recipedriver.MockDriver, recipedriver.MockDriverWithSecrets, configloader.MockSecretsLoader) { ctrl := gomock.NewController(t) - configLoader := configloader.NewMockConfigurationLoader(ctrl) + cfgLoader := configloader.NewMockConfigurationLoader(ctrl) + secretLoader := configloader.NewMockSecretsLoader(ctrl) mDriver := recipedriver.NewMockDriver(ctrl) + mDriverWithSecrets := recipedriver.NewMockDriverWithSecrets(ctrl) options := Options{ - ConfigurationLoader: configLoader, + ConfigurationLoader: cfgLoader, + SecretsLoader: secretLoader, Drivers: map[string]recipedriver.Driver{ recipes.TemplateKindBicep: mDriver, - recipes.TemplateKindTerraform: mDriver, + recipes.TemplateKindTerraform: mDriverWithSecrets, }, } engine := engine{ options: options, } - return engine, *configLoader, *mDriver + return engine, *cfgLoader, *mDriver, *mDriverWithSecrets, *secretLoader } func Test_Engine_Execute_Success(t *testing.T) { @@ -90,7 +94,7 @@ func Test_Engine_Execute_Success(t *testing.T) { ResourceType: "Applications.Datastores/mongoDatabases", } ctx := testcontext.New(t) - engine, configLoader, driver := setup(t) + engine, configLoader, driver, _, _ := setup(t) configLoader.EXPECT(). LoadConfiguration(ctx, recipeMetadata). @@ -152,7 +156,7 @@ func Test_Engine_Execute_SimulatedEnv_Success(t *testing.T) { } ctx := testcontext.New(t) - engine, configLoader, _ := setup(t) + engine, configLoader, _, _, _ := setup(t) configLoader.EXPECT(). LoadConfiguration(ctx, recipeMetadata). @@ -202,7 +206,7 @@ func Test_Engine_Execute_Failure(t *testing.T) { ResourceType: "Applications.Datastores/mongoDatabases", } ctx := testcontext.New(t) - engine, configLoader, driver := setup(t) + engine, configLoader, driver, _, _ := setup(t) configLoader.EXPECT(). LoadConfiguration(ctx, recipeMetadata). @@ -277,7 +281,7 @@ func Test_Engine_Terraform_Success(t *testing.T) { ResourceType: "Applications.Datastores/mongoDatabases", } ctx := testcontext.New(t) - engine, configLoader, driver := setup(t) + engine, configLoader, _, driverWithSecrets, _ := setup(t) configLoader.EXPECT(). LoadConfiguration(ctx, recipeMetadata). @@ -287,7 +291,11 @@ func Test_Engine_Terraform_Success(t *testing.T) { LoadRecipe(ctx, &recipeMetadata). Times(1). Return(recipeDefinition, nil) - driver.EXPECT(). + driverWithSecrets.EXPECT(). + FindSecretIDs(ctx, *envConfig, *recipeDefinition). + Times(1). + Return("", nil) + driverWithSecrets.EXPECT(). Execute(ctx, recipedriver.ExecuteOptions{ BaseOptions: recipedriver.BaseOptions{ Configuration: *envConfig, @@ -311,7 +319,7 @@ func Test_Engine_Terraform_Success(t *testing.T) { func Test_Engine_InvalidDriver(t *testing.T) { ctx := testcontext.New(t) - engine, configLoader, _ := setup(t) + engine, configLoader, _, _, _ := setup(t) envConfig := &recipes.Configuration{ Runtime: recipes.RuntimeConfiguration{ @@ -366,7 +374,7 @@ func Test_Engine_InvalidDriver(t *testing.T) { func Test_Engine_Lookup_Error(t *testing.T) { ctx := testcontext.New(t) - engine, configLoader, _ := setup(t) + engine, configLoader, _, _, _ := setup(t) envConfig := &recipes.Configuration{ Runtime: recipes.RuntimeConfiguration{ @@ -415,7 +423,7 @@ func Test_Engine_Lookup_Error(t *testing.T) { func Test_Engine_Load_Error(t *testing.T) { ctx := testcontext.New(t) - engine, configLoader, _ := setup(t) + engine, configLoader, _, _, _ := setup(t) recipeMetadata := recipes.ResourceMetadata{ Name: "mongo-azure", @@ -461,7 +469,7 @@ func Test_Engine_Delete_Success(t *testing.T) { } ctx := testcontext.New(t) - engine, configLoader, driver := setup(t) + engine, configLoader, driver, _, _ := setup(t) configLoader.EXPECT(). LoadRecipe(ctx, &recipeMetadata). @@ -512,7 +520,7 @@ func Test_Engine_Delete_SimulatedEnv_Success(t *testing.T) { } ctx := testcontext.New(t) - engine, configLoader, _ := setup(t) + engine, configLoader, _, _, _ := setup(t) configLoader.EXPECT(). LoadConfiguration(ctx, recipeMetadata). @@ -545,7 +553,7 @@ func Test_Engine_Delete_Error(t *testing.T) { } ctx := testcontext.New(t) - engine, configLoader, driver := setup(t) + engine, configLoader, driver, _, _ := setup(t) configLoader.EXPECT(). LoadRecipe(ctx, &recipeMetadata). @@ -584,7 +592,7 @@ func Test_Delete_InvalidDriver(t *testing.T) { recipeDefinition.Driver = "invalid" ctx := testcontext.New(t) - engine, configLoader, _ := setup(t) + engine, configLoader, _, _, _ := setup(t) envConfig := &recipes.Configuration{ Runtime: recipes.RuntimeConfiguration{ @@ -620,7 +628,7 @@ func Test_Delete_InvalidDriver(t *testing.T) { func Test_Delete_Lookup_Error(t *testing.T) { ctx := testcontext.New(t) - engine, configLoader, _ := setup(t) + engine, configLoader, _, _, _ := setup(t) recipeMetadata, _, outputResources := getRecipeInputs() envConfig := &recipes.Configuration{ @@ -658,7 +666,7 @@ func Test_Engine_GetRecipeMetadata_Success(t *testing.T) { _, recipeDefinition, _ := getRecipeInputs() ctx := testcontext.New(t) - engine, _, driver := setup(t) + engine, _, driver, _, _ := setup(t) outputParams := map[string]any{"parameters": recipeDefinition.Parameters} driver.EXPECT().GetRecipeMetadata(ctx, recipedriver.BaseOptions{ @@ -675,7 +683,7 @@ func Test_GetRecipeMetadata_Driver_Error(t *testing.T) { _, recipeDefinition, _ := getRecipeInputs() ctx := testcontext.New(t) - engine, _, driver := setup(t) + engine, _, driver, _, _ := setup(t) driver.EXPECT().GetRecipeMetadata(ctx, recipedriver.BaseOptions{ Recipe: recipes.ResourceMetadata{}, @@ -692,7 +700,7 @@ func Test_GetRecipeMetadata_Driver_InvalidDriver(t *testing.T) { recipeDefinition.Driver = "invalid" ctx := testcontext.New(t) - engine, _, _ := setup(t) + engine, _, _, _, _ := setup(t) _, err := engine.GetRecipeMetadata(ctx, recipeDefinition) require.Error(t, err) @@ -723,3 +731,96 @@ func getRecipeInputs() (recipes.ResourceMetadata, recipes.EnvironmentDefinition, } return recipeMetadata, recipeDefinition, outputResources } + +func Test_Engine_Execute_With_Secrets_Success(t *testing.T) { + recipeMetadata := recipes.ResourceMetadata{ + Name: "mongo-azure", + ApplicationID: "/planes/radius/local/resourcegroups/test-rg/providers/applications.core/applications/app1", + EnvironmentID: "/planes/radius/local/resourcegroups/test-rg/providers/applications.core/environments/env1", + ResourceID: "/planes/radius/local/resourceGroups/test-rg/providers/Microsoft.Resources/deployments/recipe", + Parameters: map[string]any{ + "resourceName": "resource1", + }, + } + prevState := []string{ + "/subscriptions/test-sub/resourceGroups/test-rg/providers/System.Test/testResources/test1", + } + envConfig := &recipes.Configuration{ + Runtime: recipes.RuntimeConfiguration{ + Kubernetes: &recipes.KubernetesRuntime{ + Namespace: "default", + }, + }, + Providers: datamodel.Providers{ + Azure: datamodel.ProvidersAzure{ + Scope: "scope", + }, + }, + RecipeConfig: datamodel.RecipeConfigProperties{ + Terraform: datamodel.TerraformConfigProperties{ + Authentication: datamodel.AuthConfig{ + Git: datamodel.GitAuthConfig{ + PAT: map[string]datamodel.SecretConfig{ + "dev.azure.com": { + Secret: "/planes/radius/local/resourcegroups/default/providers/Applications.Core/secretStores/azdevopsgit", + }, + }, + }, + }, + }, + }, + } + recipeResult := &recipes.RecipeOutput{ + Resources: []string{"mongoStorageAccount", "mongoDatabase"}, + Secrets: map[string]any{ + "connectionString": "mongodb://testUser:testPassword@testAccount1.mongo.cosmos.azure.com:10255", + }, + Values: map[string]any{ + "host": "testAccount1.mongo.cosmos.azure.com", + "port": 10255, + }, + } + recipeDefinition := &recipes.EnvironmentDefinition{ + Driver: recipes.TemplateKindTerraform, + TemplatePath: "git://https://dev.azure.com/mongo-recipe/recipe", + ResourceType: "Applications.Datastores/mongoDatabases", + } + ctx := testcontext.New(t) + engine, configLoader, _, driverWithSecrets, secretsLoader := setup(t) + configLoader.EXPECT(). + LoadConfiguration(ctx, recipeMetadata). + Times(1). + Return(envConfig, nil) + configLoader.EXPECT(). + LoadRecipe(ctx, &recipeMetadata). + Times(1). + Return(recipeDefinition, nil) + driverWithSecrets.EXPECT(). + FindSecretIDs(ctx, *envConfig, *recipeDefinition). + Times(1). + Return("/planes/radius/local/resourcegroups/default/providers/Applications.Core/secretStores/azdevopsgit", nil) + secretsLoader.EXPECT(). + LoadSecrets(ctx, gomock.Any()). + Times(1). + Return(v20231001preview.SecretStoresClientListSecretsResponse{}, nil) + driverWithSecrets.EXPECT(). + Execute(ctx, recipedriver.ExecuteOptions{ + BaseOptions: recipedriver.BaseOptions{ + Configuration: *envConfig, + Recipe: recipeMetadata, + Definition: *recipeDefinition, + }, + PrevState: prevState, + }). + Times(1). + Return(recipeResult, nil) + + result, err := engine.Execute(ctx, ExecuteOptions{ + BaseOptions: BaseOptions{ + Recipe: recipeMetadata, + }, + PreviousState: prevState, + }) + require.NoError(t, err) + require.Equal(t, result, recipeResult) +} diff --git a/pkg/recipes/errorcodes.go b/pkg/recipes/errorcodes.go index 3b987e12e6..699b47eea9 100644 --- a/pkg/recipes/errorcodes.go +++ b/pkg/recipes/errorcodes.go @@ -46,4 +46,7 @@ const ( // Used for errors with recipe configuration RecipeConfigurationFailure = "RecipeConfigurationFailure" + + // Used for errors encountered while loading recipe secrets. + LoadSecretsFailed = "LoadSecretsFailed" ) From c8fa814775c2ed1aa605798bf733093e41cf98d2 Mon Sep 17 00:00:00 2001 From: Vishwanath Hiremath <100623239+vishwahiremat@users.noreply.github.com> Date: Wed, 3 Apr 2024 22:52:24 +0530 Subject: [PATCH 19/19] Updating the GH_TOKEN for terraform private repo testing to use github app installation token. (#7434) # Description Updating the GH_TOKEN for terraform private repo testing to use github app installation token. ## Type of change - This pull request is a minor refactor, code cleanup, test improvement, or other maintenance task and doesn't change the functionality of Radius (issue link optional). Fixes: #issue_number Signed-off-by: Vishwanath Hiremath --- .github/workflows/functional-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/functional-test.yaml b/.github/workflows/functional-test.yaml index b581890056..bcae668173 100644 --- a/.github/workflows/functional-test.yaml +++ b/.github/workflows/functional-test.yaml @@ -570,7 +570,7 @@ jobs: INTEGRATION_TEST_RESOURCE_GROUP_NAME: ${{ env.AZURE_TEST_RESOURCE_GROUP }} BICEP_RECIPE_REGISTRY: ${{ env.BICEP_RECIPE_REGISTRY }} BICEP_RECIPE_TAG_VERSION: ${{ env.BICEP_RECIPE_TAG_VERSION }} - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ steps.get_installation_token.outputs.token }} - uses: azure/setup-kubectl@v4 if: always() with: