From fc72b0ff2fbe412543db39d4fa309cc01b0564e1 Mon Sep 17 00:00:00 2001
From: vinayada1 <28875764+vinayada1@users.noreply.github.com>
Date: Thu, 26 Oct 2023 13:43:25 -0700
Subject: [PATCH 1/2] Separate cloud/non-cloud tests
Signed-off-by: vinayada1 <28875764+vinayada1@users.noreply.github.com>
---
.github/workflows/functional-test-cloud.yaml | 578 ++++++++++++++++++
.github/workflows/functional-test.yaml | 74 +--
build/test.mk | 9 +
test/functional-cloud/README.md | 3 +
.../resources/microsoftsql_test.go | 0
.../datastoresrp/resources/mongodb_test.go | 184 ++++++
.../datastoresrp/resources/redis_test.go | 0
...datastoresrp-resources-microsoft-sql.bicep | 0
...srp-resources-mongodb-recipe-context.bicep | 0
...-resources-mongodb-recipe-parameters.bicep | 0
...atastoresrp-resources-mongodb-recipe.bicep | 0
...resrp-resources-redis-default-recipe.bicep | 0
.../datastoresrp-resources-redis-manual.bicep | 0
.../datastoresrp-resources-redis-recipe.bicep | 0
.../shared/mechanics/aws_mechanics_test.go | 0
...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 | 0
.../shared/resources/aws_s3_bucket_test.go | 0
.../resources/azure_connections_test.go | 0
.../shared/resources/extender_test.go | 105 ++++
.../resources/persistent_volume_test.go | 0
.../shared/resources/recipe_terraform_test.go | 134 ++++
.../shared/resources/storage_test.go | 0
.../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 | 31 +
...erp-resources-extender-aws-s3-recipe.bicep | 0
...erp-resources-terraform-azurestorage.bicep | 0
...rerp-resources-volume-azure-keyvault.bicep | 0
.../parameters/test-tls-cert.parameters.json | 12 +
.../recipes/test-bicep-recipes/README.md | 11 +
.../extenders-aws-s3-recipe.bicep | 0
.../recipes/test-terraform-recipes/README.md | 41 ++
.../azure-storage/main.tf | 0
.../azure-storage/output.tf | 0
.../azure-storage/variables.tf | 0
.../ucp/aws_credential_test.go | 11 +-
.../ucp/aws_test.go | 5 +-
.../ucp/azure_credential_test.go | 11 +-
.../datastoresrp/resources/mongodb_test.go | 158 -----
.../shared/resources/extender_test.go | 79 ---
.../shared/resources/recipe_terraform_test.go | 50 --
46 files changed, 1131 insertions(+), 365 deletions(-)
create mode 100644 .github/workflows/functional-test-cloud.yaml
create mode 100644 test/functional-cloud/README.md
rename test/{functional => functional-cloud}/datastoresrp/resources/microsoftsql_test.go (100%)
create mode 100644 test/functional-cloud/datastoresrp/resources/mongodb_test.go
rename test/{functional => functional-cloud}/datastoresrp/resources/redis_test.go (100%)
rename test/{functional => functional-cloud}/datastoresrp/resources/testdata/datastoresrp-resources-microsoft-sql.bicep (100%)
rename test/{functional => functional-cloud}/datastoresrp/resources/testdata/datastoresrp-resources-mongodb-recipe-context.bicep (100%)
rename test/{functional => functional-cloud}/datastoresrp/resources/testdata/datastoresrp-resources-mongodb-recipe-parameters.bicep (100%)
rename test/{functional => functional-cloud}/datastoresrp/resources/testdata/datastoresrp-resources-mongodb-recipe.bicep (100%)
rename test/{functional => functional-cloud}/datastoresrp/resources/testdata/datastoresrp-resources-redis-default-recipe.bicep (100%)
rename test/{functional => functional-cloud}/datastoresrp/resources/testdata/datastoresrp-resources-redis-manual.bicep (100%)
rename test/{functional => functional-cloud}/datastoresrp/resources/testdata/datastoresrp-resources-redis-recipe.bicep (100%)
rename test/{functional => functional-cloud}/shared/mechanics/aws_mechanics_test.go (100%)
rename test/{functional => functional-cloud}/shared/mechanics/testdata/aws-mechanics-redeploy-withcreateandwritepropertyupdate.step1.bicep (100%)
rename test/{functional => functional-cloud}/shared/mechanics/testdata/aws-mechanics-redeploy-withcreateandwritepropertyupdate.step2.bicep (100%)
rename test/{functional => functional-cloud}/shared/mechanics/testdata/aws-mechanics-redeploy-withupdatedresource.step1.bicep (100%)
rename test/{functional => functional-cloud}/shared/mechanics/testdata/aws-mechanics-redeploy-withupdatedresource.step2.bicep (100%)
rename test/{functional => functional-cloud}/shared/resources/aws_multi_identifier_resource_test.go (100%)
rename test/{functional => functional-cloud}/shared/resources/aws_s3_bucket_test.go (100%)
rename test/{functional => functional-cloud}/shared/resources/azure_connections_test.go (100%)
create mode 100644 test/functional-cloud/shared/resources/extender_test.go
rename test/{functional => functional-cloud}/shared/resources/persistent_volume_test.go (100%)
create mode 100644 test/functional-cloud/shared/resources/recipe_terraform_test.go
rename test/{functional => functional-cloud}/shared/resources/storage_test.go (100%)
rename test/{functional => functional-cloud}/shared/resources/testdata/aws-multi-identifier.bicep (100%)
rename test/{functional => functional-cloud}/shared/resources/testdata/aws-s3-bucket-existing.bicep (100%)
rename test/{functional => functional-cloud}/shared/resources/testdata/aws-s3-bucket.bicep (100%)
create mode 100644 test/functional-cloud/shared/resources/testdata/corerp-azure-connection-database-service.bicep
rename test/{functional => functional-cloud}/shared/resources/testdata/corerp-resources-extender-aws-s3-recipe.bicep (100%)
rename test/{functional => functional-cloud}/shared/resources/testdata/corerp-resources-terraform-azurestorage.bicep (100%)
rename test/{functional => functional-cloud}/shared/resources/testdata/corerp-resources-volume-azure-keyvault.bicep (100%)
create mode 100644 test/functional-cloud/shared/resources/testdata/parameters/test-tls-cert.parameters.json
create mode 100644 test/functional-cloud/shared/resources/testdata/recipes/test-bicep-recipes/README.md
rename test/{functional => functional-cloud}/shared/resources/testdata/recipes/test-bicep-recipes/extenders-aws-s3-recipe.bicep (100%)
create mode 100644 test/functional-cloud/shared/resources/testdata/recipes/test-terraform-recipes/README.md
rename test/{functional => functional-cloud}/shared/resources/testdata/recipes/test-terraform-recipes/azure-storage/main.tf (100%)
rename test/{functional => functional-cloud}/shared/resources/testdata/recipes/test-terraform-recipes/azure-storage/output.tf (100%)
rename test/{functional => functional-cloud}/shared/resources/testdata/recipes/test-terraform-recipes/azure-storage/variables.tf (100%)
rename test/{functional => functional-cloud}/ucp/aws_credential_test.go (92%)
rename test/{functional => functional-cloud}/ucp/aws_test.go (95%)
rename test/{functional => functional-cloud}/ucp/azure_credential_test.go (93%)
diff --git a/.github/workflows/functional-test-cloud.yaml b/.github/workflows/functional-test-cloud.yaml
new file mode 100644
index 0000000000..d870b443b9
--- /dev/null
+++ b/.github/workflows/functional-test-cloud.yaml
@@ -0,0 +1,578 @@
+# ------------------------------------------------------------
+# 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: Functional tests
+on:
+ schedule:
+ # Run every 4 hours on weekdays.
+ - cron: "30 0,4,8,12,16,20 * * 1-5"
+ # Run every 12 hours on weekends.
+ - cron: "30 0,12 * * 0,6"
+ # Dispatch on external events
+ repository_dispatch:
+ types: [functional-tests, de-functional-test]
+
+env:
+ # Go version
+ GOVER: '^1.21'
+ 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.11.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"
+
+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: Set up checkout target (scheduled)
+ if: github.event_name == 'schedule'
+ run: |
+ echo "CHECKOUT_REPO=${{ github.repository }}" >> $GITHUB_ENV
+ echo "CHECKOUT_REF=refs/heads/main" >> $GITHUB_ENV
+ - name: Set up checkout target (pull_request)
+ if: github.event_name == 'pull_request'
+ run: |
+ echo "CHECKOUT_REPO=${{ github.repository }}" >> $GITHUB_ENV
+ echo "CHECKOUT_REF=${{ github.ref }}" >> $GITHUB_ENV
+ echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> $GITHUB_ENV
+ - name: Set up checkout target (repository_dispatch from /ok-to-test)
+ if: github.event_name == 'repository_dispatch'
+ uses: actions/github-script@v6
+ with:
+ github-token: ${{ secrets.GH_RAD_CI_BOT_PAT }}
+ script: |
+ const testPayload = context.payload.client_payload;
+ if (testPayload && testPayload.command === `ok-to-test`) {
+ var fs = require('fs');
+ // Set environment variables
+ fs.appendFileSync(process.env.GITHUB_ENV,
+ `CHECKOUT_REPO=${testPayload.pull_head_repo}\n`+
+ `CHECKOUT_REF=${testPayload.pull_head_ref}\n`+
+ `PR_NUMBER=${testPayload.issue.number}`
+ );
+ }
+ - name: Set DE image and tag (repository_dispatch from de-functional-test)
+ if: github.event_name == 'repository_dispatch'
+ uses: actions/github-script@v6
+ with:
+ github-token: ${{ secrets.GH_RAD_CI_BOT_PAT }}
+ script: |
+ const clientPayload = context.payload.client_payload;
+ if (clientPayload && clientPayload.event_type === `de-functional-test`) {
+ var fs = require('fs');
+ // Set environment variables
+ fs.appendFileSync(process.env.GITHUB_ENV,
+ `DE_IMAGE=${clientPayload.de_image}\n`+
+ `DE_TAG=${clientPayload.de_tag}\n`+
+ `CHECKOUT_REPO=${{ github.repository }}\n`+
+ `CHECKOUT_REF=refs/heads/main`
+ );
+ }
+ - 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:
+ 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:
+ 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:
+ 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:
+ 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:
+ 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:
+ 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:
+ header: teststatus-${{ github.run_id }}
+ number: ${{ env.PR_NUMBER }}
+ append: true
+ message: |
+ :x: Test recipe publishing failed
+ tests:
+ name: Run ${{ matrix.name }} functional tests that require cloud resources
+ needs: build
+ strategy:
+ fail-fast: true
+ matrix:
+ os: [ubuntu-latest]
+ name: [ucp,shared]
+ 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: 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
+ token: ${{ secrets.GH_RAD_CI_BOT_PAT }}
+ 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@v1
+ with:
+ creds: '{"clientId":"${{ secrets.INTEGRATION_TEST_SP_APP_ID }}","clientSecret":"${{ secrets.INTEGRATION_TEST_SP_PASSWORD }}","subscriptionId":"${{ secrets.INTEGRATION_TEST_SUBSCRIPTION_ID }}","tenantId":"${{ secrets.INTEGRATION_TEST_TENANT_ID }}"}'
+ - uses: marocchino/sticky-pull-request-comment@v2
+ continue-on-error: true
+ with:
+ 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.INTEGRATION_TEST_SUBSCRIPTION_ID }} \
+ --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 }}
+ - uses: marocchino/sticky-pull-request-comment@v2
+ if: success() && env.PR_NUMBER != ''
+ continue-on-error: true
+ with:
+ 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:
+ 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
+ - name: Delete azure resource group - ${{ env.AZURE_TEST_RESOURCE_GROUP }}
+ if: always()
+ run: |
+ # if deletion fails, purge workflow will purge the resource group and its resources later.
+ az group delete \
+ --subscription ${{ secrets.INTEGRATION_TEST_SUBSCRIPTION_ID }} \
+ --name ${{ env.AZURE_TEST_RESOURCE_GROUP }} \
+ --yes --verbose
+ report-failure:
+ name: Report test failure
+ needs: [build, tests]
+ runs-on: ubuntu-latest
+ if: failure() && github.event_name == 'schedule'
+ steps:
+ - name: Create failure issue for failing scheduled run
+ uses: actions/github-script@v6
+ with:
+ github-token: ${{ secrets.GH_RAD_CI_BOT_PAT }}
+ script: |
+ github.rest.issues.create({
+ ...context.repo,
+ title: `Scheduled functional test failed - Run ID: ${context.runId}`,
+ labels: ['bug', 'test-failure'],
+ body: `## Bug information \n\nThis bug is generated automatically if the scheduled functional test fails. The Radius functional test operates on a schedule of every 4 hours during weekdays and every 12 hours over the weekend. It's important to understand that the test may fail due to workflow infrastructure issues, like network problems, rather than the flakiness of the test itself. For the further investigation, please visit [here](${process.env.ACTION_LINK}).`
+ })
diff --git a/.github/workflows/functional-test.yaml b/.github/workflows/functional-test.yaml
index 915020e564..df0a5d0f83 100644
--- a/.github/workflows/functional-test.yaml
+++ b/.github/workflows/functional-test.yaml
@@ -14,16 +14,13 @@
# limitations under the License.
# ------------------------------------------------------------
-name: Functional tests
+name: Functional tests with no cloud resources
on:
- schedule:
- # Run every 4 hours on weekdays.
- - cron: "30 0,4,8,12,16,20 * * 1-5"
- # Run every 12 hours on weekends.
- - cron: "30 0,12 * * 0,6"
- # Dispatch on external events
- repository_dispatch:
- types: [functional-tests, de-functional-test]
+ pull_request:
+ branches:
+ - main
+ - features/*
+ - release/*
env:
# Go version
@@ -51,16 +48,10 @@ env:
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
@@ -148,7 +139,6 @@ jobs:
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
@@ -277,7 +267,7 @@ jobs:
message: |
:x: Test recipe publishing failed
tests:
- name: Run ${{ matrix.name }} functional tests
+ name: Run ${{ matrix.name }} functional tests that do not require cloud resources
needs: build
strategy:
fail-fast: true
@@ -295,7 +285,6 @@ jobs:
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 }}
@@ -336,10 +325,6 @@ jobs:
with:
name: ${{ env.RAD_CLI_ARTIFACT_NAME }}
path: bin
- - name: Login to Azure
- uses: azure/login@v1
- with:
- creds: '{"clientId":"${{ secrets.INTEGRATION_TEST_SP_APP_ID }}","clientSecret":"${{ secrets.INTEGRATION_TEST_SP_PASSWORD }}","subscriptionId":"${{ secrets.INTEGRATION_TEST_SUBSCRIPTION_ID }}","tenantId":"${{ secrets.INTEGRATION_TEST_TENANT_ID }}"}'
- uses: marocchino/sticky-pull-request-comment@v2
continue-on-error: true
with:
@@ -348,17 +333,6 @@ jobs:
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.INTEGRATION_TEST_SUBSCRIPTION_ID }} \
- --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 }}
@@ -407,14 +381,6 @@ jobs:
run: |
wget -q https://raw.githubusercontent.com/dapr/cli/master/install/install.sh -O - | /bin/bash -s ${{ env.DAPR_VER }}
dapr init -k --wait --timeout 600 --runtime-version ${{ env.DAPR_VER }}
- - name: Install Azure Keyvault CSI driver chart
- run: |
- helm repo add csi-secrets-store-provider-azure https://azure.github.io/secrets-store-csi-driver-provider-azure/charts
- helm install csi csi-secrets-store-provider-azure/csi-secrets-store-provider-azure --version ${{ env.AZURE_KEYVAULT_CSI_DRIVER_VER }}
- - name: Install azure workload identity webhook chart
- run: |
- 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.INTEGRATION_TEST_TENANT_ID }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
@@ -458,18 +424,6 @@ jobs:
# The functional test is designed to use default namespace. So you must create the environment for default namespace.
rad env create kind-radius --namespace default
rad env switch kind-radius
-
- echo "*** Configuring Azure provider ***"
- rad env update kind-radius --azure-subscription-id ${{ secrets.INTEGRATION_TEST_SUBSCRIPTION_ID }} \
- --azure-resource-group ${{ env.AZURE_TEST_RESOURCE_GROUP }}
- rad credential register azure --client-id ${{ secrets.INTEGRATION_TEST_SP_APP_ID }} \
- --client-secret ${{ secrets.INTEGRATION_TEST_SP_PASSWORD }} \
- --tenant-id ${{ secrets.INTEGRATION_TEST_TENANT_ID }}
-
- echo "*** Configuring AWS provider ***"
- rad env update kind-radius --aws-region ${{ env.AWS_REGION }} --aws-account-id ${{ secrets.FUNCTEST_AWS_ACCOUNT_ID }}
- rad credential register aws \
- --access-key-id ${{ secrets.FUNCTEST_AWS_ACCESS_KEY_ID }} --secret-access-key ${{ secrets.FUNCTEST_AWS_SECRET_ACCESS_KEY }}
- uses: marocchino/sticky-pull-request-comment@v2
if: failure() && env.PR_NUMBER != ''
continue-on-error: true
@@ -482,7 +436,7 @@ jobs:
- name: Publish Terraform test recipes
run: |
make publish-test-terraform-recipes
- - name: Run functional tests
+ - name: Run functional tests that do not require cloud resources
run: |
# Ensure rad cli is in path before running tests.
export PATH=$GITHUB_WORKSPACE/bin:$PATH
@@ -506,12 +460,8 @@ jobs:
DOCKER_REGISTRY: ${{ env.CONTAINER_REGISTRY }}
TEST_TIMEOUT: ${{ env.FUNCTIONALTEST_TIMEOUT }}
RADIUS_CONTAINER_LOG_PATH: ${{ github.workspace }}/${{ env.RADIUS_CONTAINER_LOG_BASE }}
- AWS_ACCESS_KEY_ID: ${{ secrets.FUNCTEST_AWS_ACCESS_KEY_ID }}
- AWS_SECRET_ACCESS_KEY: ${{ secrets.FUNCTEST_AWS_SECRET_ACCESS_KEY }}
- AWS_REGION: ${{ env.AWS_REGION }}
RADIUS_SAMPLES_REPO_ROOT: ${{ github.workspace }}/samples
# Test_MongoDB_Recipe_Parameters is using the following environment variable.
- 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 }}
- uses: azure/setup-kubectl@v3
@@ -551,14 +501,6 @@ jobs:
append: true
message: |
:x: ${{ matrix.name }} functional test failed. Please check [the logs](${{ env.ACTION_LINK }}) for more details
- - name: Delete azure resource group - ${{ env.AZURE_TEST_RESOURCE_GROUP }}
- if: always()
- run: |
- # if deletion fails, purge workflow will purge the resource group and its resources later.
- az group delete \
- --subscription ${{ secrets.INTEGRATION_TEST_SUBSCRIPTION_ID }} \
- --name ${{ env.AZURE_TEST_RESOURCE_GROUP }} \
- --yes --verbose
report-failure:
name: Report test failure
needs: [build, tests]
diff --git a/build/test.mk b/build/test.mk
index 53b23697e9..ff7e4e0bf2 100644
--- a/build/test.mk
+++ b/build/test.mk
@@ -66,6 +66,9 @@ test-functional-kubernetes: ## Runs Kubernetes functional tests
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-cloud: ## Runs shared functional tests that require cloud resources
+ CGO_ENABLED=1 $(GOTEST_TOOL) ./test/functional-cloud/shared/... -timeout ${TEST_TIMEOUT} -v -parallel 10 $(GOTEST_OPTS)
+
test-functional-msgrp: ## Runs Messaging RP functional tests
CGO_ENABLED=1 $(GOTEST_TOOL) ./test/functional/messagingrp/... -timeout ${TEST_TIMEOUT} -v -parallel 2 $(GOTEST_OPTS)
@@ -75,12 +78,18 @@ test-functional-daprrp: ## Runs Dapr RP functional tests
test-functional-datastoresrp: ## Runs Datastores RP functional tests
CGO_ENABLED=1 $(GOTEST_TOOL) ./test/functional/datastoresrp/... -timeout ${TEST_TIMEOUT} -v -parallel 3 $(GOTEST_OPTS)
+test-functional-datastoresrp-cloud: ## Runs Datastores RP functional tests that require cloud resources
+ CGO_ENABLED=1 $(GOTEST_TOOL) ./test/functional-cloud/datastoresrp/... -timeout ${TEST_TIMEOUT} -v -parallel 3 $(GOTEST_OPTS)
+
test-functional-samples: ## Runs Samples functional tests
CGO_ENABLED=1 $(GOTEST_TOOL) ./test/functional/samples/... -timeout ${TEST_TIMEOUT} -v -parallel 5 $(GOTEST_OPTS)
test-functional-ucp: ## Runs UCP functional tests
CGO_ENABLED=1 $(GOTEST_TOOL) ./test/functional/ucp/... -timeout ${TEST_TIMEOUT} -v -parallel 5 $(GOTEST_OPTS)
+test-functional-ucp-cloud: ## Runs UCP functional tests that require cloud resources
+ CGO_ENABLED=1 $(GOTEST_TOOL) ./test/functional-cloud/ucp/... -timeout ${TEST_TIMEOUT} -v -parallel 5 $(GOTEST_OPTS)
+
test-validate-bicep: ## Validates that all .bicep files compile cleanly
BICEP_PATH="${HOME}/.rad/bin/rad-bicep" ./build/validate-bicep.sh
diff --git a/test/functional-cloud/README.md b/test/functional-cloud/README.md
new file mode 100644
index 0000000000..dfc9c96b3e
--- /dev/null
+++ b/test/functional-cloud/README.md
@@ -0,0 +1,3 @@
+* [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/datastoresrp/resources/microsoftsql_test.go b/test/functional-cloud/datastoresrp/resources/microsoftsql_test.go
similarity index 100%
rename from test/functional/datastoresrp/resources/microsoftsql_test.go
rename to test/functional-cloud/datastoresrp/resources/microsoftsql_test.go
diff --git a/test/functional-cloud/datastoresrp/resources/mongodb_test.go b/test/functional-cloud/datastoresrp/resources/mongodb_test.go
new file mode 100644
index 0000000000..0d78868e81
--- /dev/null
+++ b/test/functional-cloud/datastoresrp/resources/mongodb_test.go
@@ -0,0 +1,184 @@
+/*
+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 (
+ "os"
+ "testing"
+
+ "github.com/radius-project/radius/test/functional"
+ "github.com/radius-project/radius/test/functional/shared"
+ "github.com/radius-project/radius/test/step"
+ "github.com/radius-project/radius/test/validation"
+)
+
+// Test_MongoDB_Recipe validates:
+// the creation of a mongoDB from a recipe that uses an Azure resource
+func Test_MongoDB_Recipe(t *testing.T) {
+ template := "testdata/datastoresrp-resources-mongodb-recipe.bicep"
+ name := "dsrp-resources-mongodb-recipe"
+ appNamespace := "dsrp-resources-mongodb-recipe-app"
+
+ test := shared.NewRPTest(t, name, []shared.TestStep{
+ {
+ Executor: step.NewDeployExecutor(template, functional.GetMagpieImage(), functional.GetBicepRecipeRegistry(), functional.GetBicepRecipeVersion()),
+ RPResources: &validation.RPResourceSet{
+ Resources: []validation.RPResource{
+ {
+ Name: "dsrp-resources-mongodb-recipe-env",
+ Type: validation.EnvironmentsResource,
+ },
+ {
+ Name: "dsrp-resources-mongodb-recipe",
+ Type: validation.ApplicationsResource,
+ App: name,
+ },
+ {
+ Name: "mongodb-app-ctnr",
+ Type: validation.ContainersResource,
+ App: name,
+ },
+ {
+ Name: "mongodb-db",
+ Type: validation.MongoDatabasesResource,
+ App: name,
+ },
+ },
+ },
+ K8sObjects: &validation.K8sObjectSet{
+ Namespaces: map[string][]validation.K8sObject{
+ appNamespace: {
+ validation.NewK8sPodForResource(name, "mongodb-app-ctnr").ValidateLabels(false),
+ },
+ },
+ },
+ },
+ })
+
+ test.Test(t)
+}
+
+// Test_MongoDB_Recipe_Parameters validates the creation of a mongoDB from recipe with parameters passed by operator while linking recipe
+// and developer while creating the mongoDatabase resource.
+// If the same parameters are set by the developer and the operator then the developer parameters are applied in to resolve conflicts.
+// Container uses the mongoDB resource to connect to the mongoDB resource
+func Test_MongoDB_RecipeParameters(t *testing.T) {
+ t.Skip("Skipping test as creating/deleting cosmosdb resource is unreliable - https://github.com/radius-project/radius/issues/5929")
+
+ template := "testdata/datastoresrp-resources-mongodb-recipe-parameters.bicep"
+ name := "dsrp-resources-mongodb-recipe-parameters"
+ appNamespace := "dsrp-resources-mongodb-recipe-param-app"
+ rg := os.Getenv("INTEGRATION_TEST_RESOURCE_GROUP_NAME")
+ // Error the test if INTEGRATION_TEST_RESOURCE_GROUP_NAME is not set
+ // for running locally set the INTEGRATION_TEST_RESOURCE_GROUP_NAME with the test resourceGroup
+ if rg == "" {
+ t.Error("This test needs the env variable INTEGRATION_TEST_RESOURCE_GROUP_NAME to be set")
+ }
+
+ test := shared.NewRPTest(t, name, []shared.TestStep{
+ {
+ Executor: step.NewDeployExecutor(template, functional.GetMagpieImage(), functional.GetBicepRecipeRegistry(), functional.GetBicepRecipeVersion()),
+ RPResources: &validation.RPResourceSet{
+ Resources: []validation.RPResource{
+ {
+ Name: "dsrp-resources-env-recipe-parameters-env",
+ Type: validation.EnvironmentsResource,
+ },
+ {
+ Name: name,
+ Type: validation.ApplicationsResource,
+ App: name,
+ },
+ {
+ Name: "mdb-param-ctnr",
+ Type: validation.ContainersResource,
+ App: name,
+ },
+ {
+ Name: "mdb-recipe-param-db",
+ Type: validation.MongoDatabasesResource,
+ App: name,
+ },
+ },
+ },
+ K8sObjects: &validation.K8sObjectSet{
+ Namespaces: map[string][]validation.K8sObject{
+ appNamespace: {
+ validation.NewK8sPodForResource(name, "mdb-param-ctnr").ValidateLabels(false),
+ },
+ },
+ },
+ },
+ })
+
+ test.Test(t)
+}
+
+// Test_MongoDB_Recipe_ContextParameter validates creation of a mongoDB from
+// a default recipe using the context parameter generated and set by DatastoresRP,
+// and container using the mongoDatabases portable resource to connect to the underlying mongoDB resource.
+func Test_MongoDB_Recipe_ContextParameter(t *testing.T) {
+ t.Skip("Skipping test as creating/deleting cosmosdb resource is unreliable - https://github.com/radius-project/radius/issues/5929")
+
+ template := "testdata/datastoresrp-resources-mongodb-recipe-context.bicep"
+ name := "dsrp-resources-mongodb-recipe-context"
+ appNamespace := "dsrp-resources-mongodb-recipe-context-app"
+ rg := os.Getenv("INTEGRATION_TEST_RESOURCE_GROUP_NAME")
+ // Error the test if INTEGRATION_TEST_RESOURCE_GROUP_NAME is not set
+ // for running locally set the INTEGRATION_TEST_RESOURCE_GROUP_NAME with the test resourceGroup
+ if rg == "" {
+ t.Error("This test needs the env variable INTEGRATION_TEST_RESOURCE_GROUP_NAME to be set")
+ }
+
+ test := shared.NewRPTest(t, name, []shared.TestStep{
+ {
+ Executor: step.NewDeployExecutor(template, functional.GetMagpieImage(), functional.GetBicepRecipeRegistry(), functional.GetBicepRecipeVersion()),
+ RPResources: &validation.RPResourceSet{
+ Resources: []validation.RPResource{
+ {
+ Name: "dsrp-resources-env-recipes-context-env",
+ Type: validation.EnvironmentsResource,
+ },
+ {
+ Name: name,
+ Type: validation.ApplicationsResource,
+ App: name,
+ },
+ {
+ Name: "mdb-ctx-ctnr",
+ Type: validation.ContainersResource,
+ App: name,
+ },
+ {
+ Name: "mdb-ctx",
+ Type: validation.MongoDatabasesResource,
+ App: name,
+ },
+ },
+ },
+ K8sObjects: &validation.K8sObjectSet{
+ Namespaces: map[string][]validation.K8sObject{
+ appNamespace: {
+ validation.NewK8sPodForResource(name, "mdb-ctx-ctnr").ValidateLabels(false),
+ },
+ },
+ },
+ },
+ })
+
+ test.Test(t)
+}
diff --git a/test/functional/datastoresrp/resources/redis_test.go b/test/functional-cloud/datastoresrp/resources/redis_test.go
similarity index 100%
rename from test/functional/datastoresrp/resources/redis_test.go
rename to test/functional-cloud/datastoresrp/resources/redis_test.go
diff --git a/test/functional/datastoresrp/resources/testdata/datastoresrp-resources-microsoft-sql.bicep b/test/functional-cloud/datastoresrp/resources/testdata/datastoresrp-resources-microsoft-sql.bicep
similarity index 100%
rename from test/functional/datastoresrp/resources/testdata/datastoresrp-resources-microsoft-sql.bicep
rename to test/functional-cloud/datastoresrp/resources/testdata/datastoresrp-resources-microsoft-sql.bicep
diff --git a/test/functional/datastoresrp/resources/testdata/datastoresrp-resources-mongodb-recipe-context.bicep b/test/functional-cloud/datastoresrp/resources/testdata/datastoresrp-resources-mongodb-recipe-context.bicep
similarity index 100%
rename from test/functional/datastoresrp/resources/testdata/datastoresrp-resources-mongodb-recipe-context.bicep
rename to test/functional-cloud/datastoresrp/resources/testdata/datastoresrp-resources-mongodb-recipe-context.bicep
diff --git a/test/functional/datastoresrp/resources/testdata/datastoresrp-resources-mongodb-recipe-parameters.bicep b/test/functional-cloud/datastoresrp/resources/testdata/datastoresrp-resources-mongodb-recipe-parameters.bicep
similarity index 100%
rename from test/functional/datastoresrp/resources/testdata/datastoresrp-resources-mongodb-recipe-parameters.bicep
rename to test/functional-cloud/datastoresrp/resources/testdata/datastoresrp-resources-mongodb-recipe-parameters.bicep
diff --git a/test/functional/datastoresrp/resources/testdata/datastoresrp-resources-mongodb-recipe.bicep b/test/functional-cloud/datastoresrp/resources/testdata/datastoresrp-resources-mongodb-recipe.bicep
similarity index 100%
rename from test/functional/datastoresrp/resources/testdata/datastoresrp-resources-mongodb-recipe.bicep
rename to test/functional-cloud/datastoresrp/resources/testdata/datastoresrp-resources-mongodb-recipe.bicep
diff --git a/test/functional/datastoresrp/resources/testdata/datastoresrp-resources-redis-default-recipe.bicep b/test/functional-cloud/datastoresrp/resources/testdata/datastoresrp-resources-redis-default-recipe.bicep
similarity index 100%
rename from test/functional/datastoresrp/resources/testdata/datastoresrp-resources-redis-default-recipe.bicep
rename to test/functional-cloud/datastoresrp/resources/testdata/datastoresrp-resources-redis-default-recipe.bicep
diff --git a/test/functional/datastoresrp/resources/testdata/datastoresrp-resources-redis-manual.bicep b/test/functional-cloud/datastoresrp/resources/testdata/datastoresrp-resources-redis-manual.bicep
similarity index 100%
rename from test/functional/datastoresrp/resources/testdata/datastoresrp-resources-redis-manual.bicep
rename to test/functional-cloud/datastoresrp/resources/testdata/datastoresrp-resources-redis-manual.bicep
diff --git a/test/functional/datastoresrp/resources/testdata/datastoresrp-resources-redis-recipe.bicep b/test/functional-cloud/datastoresrp/resources/testdata/datastoresrp-resources-redis-recipe.bicep
similarity index 100%
rename from test/functional/datastoresrp/resources/testdata/datastoresrp-resources-redis-recipe.bicep
rename to test/functional-cloud/datastoresrp/resources/testdata/datastoresrp-resources-redis-recipe.bicep
diff --git a/test/functional/shared/mechanics/aws_mechanics_test.go b/test/functional-cloud/shared/mechanics/aws_mechanics_test.go
similarity index 100%
rename from test/functional/shared/mechanics/aws_mechanics_test.go
rename to test/functional-cloud/shared/mechanics/aws_mechanics_test.go
diff --git a/test/functional/shared/mechanics/testdata/aws-mechanics-redeploy-withcreateandwritepropertyupdate.step1.bicep b/test/functional-cloud/shared/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-cloud/shared/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-cloud/shared/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-cloud/shared/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-cloud/shared/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-cloud/shared/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-cloud/shared/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-cloud/shared/mechanics/testdata/aws-mechanics-redeploy-withupdatedresource.step2.bicep
diff --git a/test/functional/shared/resources/aws_multi_identifier_resource_test.go b/test/functional-cloud/shared/resources/aws_multi_identifier_resource_test.go
similarity index 100%
rename from test/functional/shared/resources/aws_multi_identifier_resource_test.go
rename to test/functional-cloud/shared/resources/aws_multi_identifier_resource_test.go
diff --git a/test/functional/shared/resources/aws_s3_bucket_test.go b/test/functional-cloud/shared/resources/aws_s3_bucket_test.go
similarity index 100%
rename from test/functional/shared/resources/aws_s3_bucket_test.go
rename to test/functional-cloud/shared/resources/aws_s3_bucket_test.go
diff --git a/test/functional/shared/resources/azure_connections_test.go b/test/functional-cloud/shared/resources/azure_connections_test.go
similarity index 100%
rename from test/functional/shared/resources/azure_connections_test.go
rename to test/functional-cloud/shared/resources/azure_connections_test.go
diff --git a/test/functional-cloud/shared/resources/extender_test.go b/test/functional-cloud/shared/resources/extender_test.go
new file mode 100644
index 0000000000..954b0d24d8
--- /dev/null
+++ b/test/functional-cloud/shared/resources/extender_test.go
@@ -0,0 +1,105 @@
+/*
+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 (
+ "fmt"
+ "testing"
+
+ "os"
+
+ "github.com/radius-project/radius/test/functional"
+ "github.com/radius-project/radius/test/functional/shared"
+ "github.com/radius-project/radius/test/step"
+ "github.com/radius-project/radius/test/validation"
+)
+
+func Test_Extender_RecipeAWS(t *testing.T) {
+ t.Skip("Skipping until we resolve https://github.com/radius-project/radius/issues/6535")
+ awsAccountID := os.Getenv("AWS_ACCOUNT_ID")
+ awsRegion := os.Getenv("AWS_REGION")
+ // Error the test if the required environment variables are not set
+ // for running locally set the environment variables
+ if awsAccountID == "" || awsRegion == "" {
+ t.Error("This test needs the env variables AWS_ACCOUNT_ID and AWS_REGION to be set")
+ }
+
+ template := "testdata/corerp-resources-extender-aws-s3-recipe.bicep"
+ name := "corerp-resources-extenders-aws-s3-recipe"
+ appName := "corerp-resources-extenders-aws-s3-recipe-app"
+ bucketName := functional.GenerateS3BucketName()
+ bucketID := fmt.Sprintf("/planes/aws/aws/accounts/%s/regions/%s/providers/AWS.S3/Bucket/%s", awsAccountID, awsRegion, bucketName)
+ creationTimestamp := functional.GetCreationTimestamp()
+
+ test := shared.NewRPTest(t, name, []shared.TestStep{
+ {
+ Executor: step.NewDeployExecutor(
+ template,
+ "bucketName="+bucketName,
+ "creationTimestamp="+creationTimestamp,
+ functional.GetAWSAccountId(),
+ functional.GetAWSRegion(),
+ functional.GetBicepRecipeRegistry(),
+ functional.GetBicepRecipeVersion(),
+ ),
+ RPResources: &validation.RPResourceSet{
+ Resources: []validation.RPResource{
+ {
+ Name: "corerp-resources-extenders-aws-s3-recipe-env",
+ Type: validation.EnvironmentsResource,
+ },
+ {
+ Name: "corerp-resources-extenders-aws-s3-recipe-app",
+ Type: validation.ApplicationsResource,
+ },
+ {
+ Name: "corerp-resources-extenders-aws-s3-recipe",
+ Type: validation.ExtendersResource,
+ App: appName,
+ OutputResources: []validation.OutputResourceResponse{
+ {
+ ID: bucketID,
+ },
+ },
+ },
+ },
+ },
+ AWSResources: &validation.AWSResourceSet{
+ Resources: []validation.AWSResource{
+ {
+ Name: bucketName,
+ Type: validation.AWSS3BucketResourceType,
+ Identifier: bucketName,
+ Properties: map[string]any{
+ "BucketName": bucketName,
+ "Tags": []any{
+ map[string]any{
+ "Key": "RadiusCreationTimestamp",
+ "Value": creationTimestamp,
+ },
+ },
+ },
+ SkipDeletion: true, // will be deleted by the recipe
+ },
+ },
+ },
+ SkipObjectValidation: true,
+ },
+ })
+
+ test.Test(t)
+}
diff --git a/test/functional/shared/resources/persistent_volume_test.go b/test/functional-cloud/shared/resources/persistent_volume_test.go
similarity index 100%
rename from test/functional/shared/resources/persistent_volume_test.go
rename to test/functional-cloud/shared/resources/persistent_volume_test.go
diff --git a/test/functional-cloud/shared/resources/recipe_terraform_test.go b/test/functional-cloud/shared/resources/recipe_terraform_test.go
new file mode 100644
index 0000000000..5ffc0a8d21
--- /dev/null
+++ b/test/functional-cloud/shared/resources/recipe_terraform_test.go
@@ -0,0 +1,134 @@
+/*
+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"
+ 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/functional"
+ "github.com/radius-project/radius/test/functional/shared"
+ "github.com/radius-project/radius/test/step"
+ "github.com/radius-project/radius/test/validation"
+)
+
+var (
+ secretNamespace = "radius-system"
+ secretPrefix = "tfstate-default-"
+)
+
+// Test_TerraformRecipe_Redis covers the following terraform recipe scenario:
+//
+// - Create an extender resource using a Terraform recipe that deploys Redis on Kubernetes.
+// - The recipe deployment creates a Kubernetes deployment and a Kubernetes service.
+
+// 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, functional.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)
+ }
+
+ 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/storage_test.go b/test/functional-cloud/shared/resources/storage_test.go
similarity index 100%
rename from test/functional/shared/resources/storage_test.go
rename to test/functional-cloud/shared/resources/storage_test.go
diff --git a/test/functional/shared/resources/testdata/aws-multi-identifier.bicep b/test/functional-cloud/shared/resources/testdata/aws-multi-identifier.bicep
similarity index 100%
rename from test/functional/shared/resources/testdata/aws-multi-identifier.bicep
rename to test/functional-cloud/shared/resources/testdata/aws-multi-identifier.bicep
diff --git a/test/functional/shared/resources/testdata/aws-s3-bucket-existing.bicep b/test/functional-cloud/shared/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-cloud/shared/resources/testdata/aws-s3-bucket-existing.bicep
diff --git a/test/functional/shared/resources/testdata/aws-s3-bucket.bicep b/test/functional-cloud/shared/resources/testdata/aws-s3-bucket.bicep
similarity index 100%
rename from test/functional/shared/resources/testdata/aws-s3-bucket.bicep
rename to test/functional-cloud/shared/resources/testdata/aws-s3-bucket.bicep
diff --git a/test/functional-cloud/shared/resources/testdata/corerp-azure-connection-database-service.bicep b/test/functional-cloud/shared/resources/testdata/corerp-azure-connection-database-service.bicep
new file mode 100644
index 0000000000..0dde82220d
--- /dev/null
+++ b/test/functional-cloud/shared/resources/testdata/corerp-azure-connection-database-service.bicep
@@ -0,0 +1,31 @@
+import radius as radius
+
+param magpieimage string
+
+param environment string
+
+param cosmosmongodbresourceid string
+
+resource app 'Applications.Core/applications@2023-10-01-preview' = {
+ name: 'corerp-azure-connection-database-service'
+ location: 'global'
+ properties: {
+ environment: environment
+ }
+}
+
+resource store 'Applications.Core/containers@2023-10-01-preview' = {
+ name: 'db-service'
+ location: 'global'
+ properties: {
+ application: app.id
+ container: {
+ image: magpieimage
+ }
+ connections: {
+ databaseresource: {
+ source: cosmosmongodbresourceid
+ }
+ }
+ }
+}
diff --git a/test/functional/shared/resources/testdata/corerp-resources-extender-aws-s3-recipe.bicep b/test/functional-cloud/shared/resources/testdata/corerp-resources-extender-aws-s3-recipe.bicep
similarity index 100%
rename from test/functional/shared/resources/testdata/corerp-resources-extender-aws-s3-recipe.bicep
rename to test/functional-cloud/shared/resources/testdata/corerp-resources-extender-aws-s3-recipe.bicep
diff --git a/test/functional/shared/resources/testdata/corerp-resources-terraform-azurestorage.bicep b/test/functional-cloud/shared/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-cloud/shared/resources/testdata/corerp-resources-terraform-azurestorage.bicep
diff --git a/test/functional/shared/resources/testdata/corerp-resources-volume-azure-keyvault.bicep b/test/functional-cloud/shared/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-cloud/shared/resources/testdata/corerp-resources-volume-azure-keyvault.bicep
diff --git a/test/functional-cloud/shared/resources/testdata/parameters/test-tls-cert.parameters.json b/test/functional-cloud/shared/resources/testdata/parameters/test-tls-cert.parameters.json
new file mode 100644
index 0000000000..23dc99fbb2
--- /dev/null
+++ b/test/functional-cloud/shared/resources/testdata/parameters/test-tls-cert.parameters.json
@@ -0,0 +1,12 @@
+{
+ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
+ "contentVersion": "1.0.0.0",
+ "parameters": {
+ "tlscrt": {
+ "value": "-----BEGIN CER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+ }
+ }
+}
diff --git a/test/functional-cloud/shared/resources/testdata/recipes/test-bicep-recipes/README.md b/test/functional-cloud/shared/resources/testdata/recipes/test-bicep-recipes/README.md
new file mode 100644
index 0000000000..a307c1ba02
--- /dev/null
+++ b/test/functional-cloud/shared/resources/testdata/recipes/test-bicep-recipes/README.md
@@ -0,0 +1,11 @@
+# Test Recipes
+
+The recipes in this folder are published as part of the PR process to:
+
+> `ghcr.io/radius-project/dev/test/functional/shared/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.
+
+## Non-recipes bicep files
+
+Any Bicep file starting with `_` will be skipped during publishing. Use this as a convention to create shared modules that are not published as recipes. For example `_redis_kubernetes.bicep` would not be published.
\ No newline at end of file
diff --git a/test/functional/shared/resources/testdata/recipes/test-bicep-recipes/extenders-aws-s3-recipe.bicep b/test/functional-cloud/shared/resources/testdata/recipes/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/functional-cloud/shared/resources/testdata/recipes/test-bicep-recipes/extenders-aws-s3-recipe.bicep
diff --git a/test/functional-cloud/shared/resources/testdata/recipes/test-terraform-recipes/README.md b/test/functional-cloud/shared/resources/testdata/recipes/test-terraform-recipes/README.md
new file mode 100644
index 0000000000..11cb976509
--- /dev/null
+++ b/test/functional-cloud/shared/resources/testdata/recipes/test-terraform-recipes/README.md
@@ -0,0 +1,41 @@
+# Test Terraform Recipes
+
+The recipes in this folder are published as part of the PR process to a web server running inside the Kubernetes cluster.
+
+This is important because it allows us to make changes to the recipes, and test them in the same PR that contains the change.
+
+## Structure
+
+Each directory should contain a Terraform module. The module will be zipped and uploaded to the cluster. Then it will be accessible to terraform using a URL like:
+
+```txt
+http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/.zip
+```
+
+This can be used in [Terraform](https://developer.hashicorp.com/terraform/language/modules/sources#fetching-archives-over-http) as the `source` attribute of a module.
+
+This URL is only accessible inside the cluster.
+
+## Testing
+
+If you need to verify the content, use:
+
+```txt
+kubectl port-forward svc/tf-module-server 8999:80 -n radius-test-tf-module-server
+```
+
+Then you can access the recipe download at:
+
+```txt
+http://localhost:8999/.zip
+```
+
+----
+
+Or reference a module from Terraform:
+
+```hcl
+module "testing" {
+ source = "http://localhost:8999/.zip"
+}
+```
\ No newline at end of file
diff --git a/test/functional/shared/resources/testdata/recipes/test-terraform-recipes/azure-storage/main.tf b/test/functional-cloud/shared/resources/testdata/recipes/test-terraform-recipes/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/functional-cloud/shared/resources/testdata/recipes/test-terraform-recipes/azure-storage/main.tf
diff --git a/test/functional/shared/resources/testdata/recipes/test-terraform-recipes/azure-storage/output.tf b/test/functional-cloud/shared/resources/testdata/recipes/test-terraform-recipes/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/functional-cloud/shared/resources/testdata/recipes/test-terraform-recipes/azure-storage/output.tf
diff --git a/test/functional/shared/resources/testdata/recipes/test-terraform-recipes/azure-storage/variables.tf b/test/functional-cloud/shared/resources/testdata/recipes/test-terraform-recipes/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/functional-cloud/shared/resources/testdata/recipes/test-terraform-recipes/azure-storage/variables.tf
diff --git a/test/functional/ucp/aws_credential_test.go b/test/functional-cloud/ucp/aws_credential_test.go
similarity index 92%
rename from test/functional/ucp/aws_credential_test.go
rename to test/functional-cloud/ucp/aws_credential_test.go
index 35b3788beb..0e8156a1c1 100644
--- a/test/functional/ucp/aws_credential_test.go
+++ b/test/functional-cloud/ucp/aws_credential_test.go
@@ -26,11 +26,12 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
ucp "github.com/radius-project/radius/pkg/ucp/api/v20231001preview"
+ ucptest "github.com/radius-project/radius/test/functional/ucp"
"github.com/stretchr/testify/require"
)
func Test_AWS_Credential_Operations(t *testing.T) {
- test := NewUCPTest(t, "Test_AWS_Credential_Operations", func(t *testing.T, url string, roundTripper http.RoundTripper) {
+ test := ucptest.NewUCPTest(t, "Test_AWS_Credential_Operations", func(t *testing.T, url string, roundTripper http.RoundTripper) {
resourceTypePath := "/planes/aws/awstest/providers/System.AWS/credentials"
resourceURL := fmt.Sprintf("%s%s/default?api-version=%s", url, resourceTypePath, ucp.Version)
collectionURL := fmt.Sprintf("%s%s?api-version=%s", url, resourceTypePath, ucp.Version)
@@ -74,7 +75,7 @@ func runAWSCredentialTests(t *testing.T, resourceUrl string, collectionUrl strin
func createAWSTestCredential(t *testing.T, roundTripper http.RoundTripper, url string, credential ucp.AwsCredentialResource) {
body, err := json.Marshal(credential)
require.NoError(t, err)
- createRequest, err := NewUCPRequest(http.MethodPut, url, bytes.NewBuffer(body))
+ createRequest, err := ucptest.NewUCPRequest(http.MethodPut, url, bytes.NewBuffer(body))
require.NoError(t, err)
res, err := roundTripper.RoundTrip(createRequest)
@@ -85,7 +86,7 @@ func createAWSTestCredential(t *testing.T, roundTripper http.RoundTripper, url s
}
func getAWSTestCredential(t *testing.T, roundTripper http.RoundTripper, url string) (ucp.AwsCredentialResource, int) {
- getCredentialRequest, err := NewUCPRequest(http.MethodGet, url, nil)
+ getCredentialRequest, err := ucptest.NewUCPRequest(http.MethodGet, url, nil)
require.NoError(t, err)
result, err := roundTripper.RoundTrip(getCredentialRequest)
@@ -104,7 +105,7 @@ func getAWSTestCredential(t *testing.T, roundTripper http.RoundTripper, url stri
}
func deleteAWSTestCredential(t *testing.T, roundTripper http.RoundTripper, url string) (int, error) {
- deleteCredentialRequest, err := NewUCPRequest(http.MethodDelete, url, nil)
+ deleteCredentialRequest, err := ucptest.NewUCPRequest(http.MethodDelete, url, nil)
require.NoError(t, err)
res, err := roundTripper.RoundTrip(deleteCredentialRequest)
@@ -112,7 +113,7 @@ func deleteAWSTestCredential(t *testing.T, roundTripper http.RoundTripper, url s
}
func listAWSTestCredential(t *testing.T, roundTripper http.RoundTripper, url string) []ucp.AwsCredentialResource {
- listCredentialRequest, err := NewUCPRequest(http.MethodGet, url, nil)
+ listCredentialRequest, err := ucptest.NewUCPRequest(http.MethodGet, url, nil)
require.NoError(t, err)
res, err := roundTripper.RoundTrip(listCredentialRequest)
diff --git a/test/functional/ucp/aws_test.go b/test/functional-cloud/ucp/aws_test.go
similarity index 95%
rename from test/functional/ucp/aws_test.go
rename to test/functional-cloud/ucp/aws_test.go
index 854676e4b5..fd640f159e 100644
--- a/test/functional/ucp/aws_test.go
+++ b/test/functional-cloud/ucp/aws_test.go
@@ -34,6 +34,7 @@ import (
"github.com/radius-project/radius/pkg/ucp/api/v20231001preview"
"github.com/radius-project/radius/pkg/ucp/aws"
"github.com/radius-project/radius/pkg/ucp/frontend/controller/awsproxy"
+ ucptest "github.com/radius-project/radius/test/functional/ucp"
"github.com/radius-project/radius/test/validation"
"github.com/stretchr/testify/require"
)
@@ -50,7 +51,7 @@ func Test_AWS_DeleteResource(t *testing.T) {
bucketName := generateS3BucketName()
setupTestAWSResource(t, ctx, bucketName)
- test := NewUCPTest(t, "Test_AWS_DeleteResource", func(t *testing.T, url string, roundTripper http.RoundTripper) {
+ test := ucptest.NewUCPTest(t, "Test_AWS_DeleteResource", func(t *testing.T, url string, roundTripper http.RoundTripper) {
resourceID, err := validation.GetResourceIdentifier(ctx, s3BucketResourceType, bucketName)
require.NoError(t, err)
@@ -112,7 +113,7 @@ func Test_AWS_ListResources(t *testing.T) {
var bucketName = generateS3BucketName()
setupTestAWSResource(t, ctx, bucketName)
- test := NewUCPTest(t, "Test_AWS_ListResources", func(t *testing.T, url string, roundTripper http.RoundTripper) {
+ test := ucptest.NewUCPTest(t, "Test_AWS_ListResources", func(t *testing.T, url string, roundTripper http.RoundTripper) {
resourceID, err := validation.GetResourceIdentifier(ctx, s3BucketResourceType, bucketName)
require.NoError(t, err)
diff --git a/test/functional/ucp/azure_credential_test.go b/test/functional-cloud/ucp/azure_credential_test.go
similarity index 93%
rename from test/functional/ucp/azure_credential_test.go
rename to test/functional-cloud/ucp/azure_credential_test.go
index 45e127001b..341c2f14ad 100644
--- a/test/functional/ucp/azure_credential_test.go
+++ b/test/functional-cloud/ucp/azure_credential_test.go
@@ -26,11 +26,12 @@ import (
"github.com/radius-project/radius/pkg/to"
ucp "github.com/radius-project/radius/pkg/ucp/api/v20231001preview"
+ ucptest "github.com/radius-project/radius/test/functional/ucp"
"github.com/stretchr/testify/require"
)
func Test_Azure_Credential_Operations(t *testing.T) {
- test := NewUCPTest(t, "Test_Azure_Credential_Operations", func(t *testing.T, url string, roundTripper http.RoundTripper) {
+ test := ucptest.NewUCPTest(t, "Test_Azure_Credential_Operations", func(t *testing.T, url string, roundTripper http.RoundTripper) {
resourceTypePath := "/planes/azure/azuretest/providers/System.Azure/credentials"
resourceURL := fmt.Sprintf("%s%s/default?api-version=%s", url, resourceTypePath, ucp.Version)
collectionURL := fmt.Sprintf("%s%s?api-version=%s", url, resourceTypePath, ucp.Version)
@@ -72,7 +73,7 @@ func runAzureCredentialTests(t *testing.T, resourceUrl string, collectionUrl str
func createAzureTestCredential(t *testing.T, roundTripper http.RoundTripper, url string, credential ucp.AzureCredentialResource) {
body, err := json.Marshal(credential)
require.NoError(t, err)
- createRequest, err := NewUCPRequest(http.MethodPut, url, bytes.NewBuffer(body))
+ createRequest, err := ucptest.NewUCPRequest(http.MethodPut, url, bytes.NewBuffer(body))
require.NoError(t, err)
res, err := roundTripper.RoundTrip(createRequest)
@@ -83,7 +84,7 @@ func createAzureTestCredential(t *testing.T, roundTripper http.RoundTripper, url
}
func getAzureTestCredential(t *testing.T, roundTripper http.RoundTripper, url string) (ucp.AzureCredentialResource, int) {
- getCredentialRequest, err := NewUCPRequest(http.MethodGet, url, nil)
+ getCredentialRequest, err := ucptest.NewUCPRequest(http.MethodGet, url, nil)
require.NoError(t, err)
result, err := roundTripper.RoundTrip(getCredentialRequest)
@@ -102,7 +103,7 @@ func getAzureTestCredential(t *testing.T, roundTripper http.RoundTripper, url st
}
func deleteAzureTestCredential(t *testing.T, roundTripper http.RoundTripper, url string) (int, error) {
- deleteCredentialRequest, err := NewUCPRequest(http.MethodDelete, url, nil)
+ deleteCredentialRequest, err := ucptest.NewUCPRequest(http.MethodDelete, url, nil)
require.NoError(t, err)
res, err := roundTripper.RoundTrip(deleteCredentialRequest)
@@ -110,7 +111,7 @@ func deleteAzureTestCredential(t *testing.T, roundTripper http.RoundTripper, url
}
func listAzureTestCredential(t *testing.T, roundTripper http.RoundTripper, url string) []ucp.AzureCredentialResource {
- listCredentialRequest, err := NewUCPRequest(http.MethodGet, url, nil)
+ listCredentialRequest, err := ucptest.NewUCPRequest(http.MethodGet, url, nil)
require.NoError(t, err)
res, err := roundTripper.RoundTrip(listCredentialRequest)
diff --git a/test/functional/datastoresrp/resources/mongodb_test.go b/test/functional/datastoresrp/resources/mongodb_test.go
index f46369ad1e..101ca9e8ad 100644
--- a/test/functional/datastoresrp/resources/mongodb_test.go
+++ b/test/functional/datastoresrp/resources/mongodb_test.go
@@ -17,7 +17,6 @@ limitations under the License.
package resource_test
import (
- "os"
"testing"
"github.com/radius-project/radius/test/functional"
@@ -77,160 +76,3 @@ func Test_MongoDB_Manual(t *testing.T) {
test.Test(t)
}
-
-// Test_MongoDB_Recipe validates:
-// the creation of a mongoDB from a recipe that uses an Azure resource
-func Test_MongoDB_Recipe(t *testing.T) {
- template := "testdata/datastoresrp-resources-mongodb-recipe.bicep"
- name := "dsrp-resources-mongodb-recipe"
- appNamespace := "dsrp-resources-mongodb-recipe-app"
-
- test := shared.NewRPTest(t, name, []shared.TestStep{
- {
- Executor: step.NewDeployExecutor(template, functional.GetMagpieImage(), functional.GetBicepRecipeRegistry(), functional.GetBicepRecipeVersion()),
- RPResources: &validation.RPResourceSet{
- Resources: []validation.RPResource{
- {
- Name: "dsrp-resources-mongodb-recipe-env",
- Type: validation.EnvironmentsResource,
- },
- {
- Name: "dsrp-resources-mongodb-recipe",
- Type: validation.ApplicationsResource,
- App: name,
- },
- {
- Name: "mongodb-app-ctnr",
- Type: validation.ContainersResource,
- App: name,
- },
- {
- Name: "mongodb-db",
- Type: validation.MongoDatabasesResource,
- App: name,
- },
- },
- },
- K8sObjects: &validation.K8sObjectSet{
- Namespaces: map[string][]validation.K8sObject{
- appNamespace: {
- validation.NewK8sPodForResource(name, "mongodb-app-ctnr").ValidateLabels(false),
- },
- },
- },
- },
- })
-
- test.Test(t)
-}
-
-// Test_MongoDB_Recipe_Parameters validates the creation of a mongoDB from recipe with parameters passed by operator while linking recipe
-// and developer while creating the mongoDatabase resource.
-// If the same parameters are set by the developer and the operator then the developer parameters are applied in to resolve conflicts.
-// Container uses the mongoDB resource to connect to the mongoDB resource
-func Test_MongoDB_RecipeParameters(t *testing.T) {
- t.Skip("Skipping test as creating/deleting cosmosdb resource is unreliable - https://github.com/radius-project/radius/issues/5929")
-
- template := "testdata/datastoresrp-resources-mongodb-recipe-parameters.bicep"
- name := "dsrp-resources-mongodb-recipe-parameters"
- appNamespace := "dsrp-resources-mongodb-recipe-param-app"
- rg := os.Getenv("INTEGRATION_TEST_RESOURCE_GROUP_NAME")
- // Error the test if INTEGRATION_TEST_RESOURCE_GROUP_NAME is not set
- // for running locally set the INTEGRATION_TEST_RESOURCE_GROUP_NAME with the test resourceGroup
- if rg == "" {
- t.Error("This test needs the env variable INTEGRATION_TEST_RESOURCE_GROUP_NAME to be set")
- }
-
- test := shared.NewRPTest(t, name, []shared.TestStep{
- {
- Executor: step.NewDeployExecutor(template, functional.GetMagpieImage(), functional.GetBicepRecipeRegistry(), functional.GetBicepRecipeVersion()),
- RPResources: &validation.RPResourceSet{
- Resources: []validation.RPResource{
- {
- Name: "dsrp-resources-env-recipe-parameters-env",
- Type: validation.EnvironmentsResource,
- },
- {
- Name: name,
- Type: validation.ApplicationsResource,
- App: name,
- },
- {
- Name: "mdb-param-ctnr",
- Type: validation.ContainersResource,
- App: name,
- },
- {
- Name: "mdb-recipe-param-db",
- Type: validation.MongoDatabasesResource,
- App: name,
- },
- },
- },
- K8sObjects: &validation.K8sObjectSet{
- Namespaces: map[string][]validation.K8sObject{
- appNamespace: {
- validation.NewK8sPodForResource(name, "mdb-param-ctnr").ValidateLabels(false),
- },
- },
- },
- },
- })
-
- test.Test(t)
-}
-
-// Test_MongoDB_Recipe_ContextParameter validates creation of a mongoDB from
-// a default recipe using the context parameter generated and set by DatastoresRP,
-// and container using the mongoDatabases portable resource to connect to the underlying mongoDB resource.
-func Test_MongoDB_Recipe_ContextParameter(t *testing.T) {
- t.Skip("Skipping test as creating/deleting cosmosdb resource is unreliable - https://github.com/radius-project/radius/issues/5929")
-
- template := "testdata/datastoresrp-resources-mongodb-recipe-context.bicep"
- name := "dsrp-resources-mongodb-recipe-context"
- appNamespace := "dsrp-resources-mongodb-recipe-context-app"
- rg := os.Getenv("INTEGRATION_TEST_RESOURCE_GROUP_NAME")
- // Error the test if INTEGRATION_TEST_RESOURCE_GROUP_NAME is not set
- // for running locally set the INTEGRATION_TEST_RESOURCE_GROUP_NAME with the test resourceGroup
- if rg == "" {
- t.Error("This test needs the env variable INTEGRATION_TEST_RESOURCE_GROUP_NAME to be set")
- }
-
- test := shared.NewRPTest(t, name, []shared.TestStep{
- {
- Executor: step.NewDeployExecutor(template, functional.GetMagpieImage(), functional.GetBicepRecipeRegistry(), functional.GetBicepRecipeVersion()),
- RPResources: &validation.RPResourceSet{
- Resources: []validation.RPResource{
- {
- Name: "dsrp-resources-env-recipes-context-env",
- Type: validation.EnvironmentsResource,
- },
- {
- Name: name,
- Type: validation.ApplicationsResource,
- App: name,
- },
- {
- Name: "mdb-ctx-ctnr",
- Type: validation.ContainersResource,
- App: name,
- },
- {
- Name: "mdb-ctx",
- Type: validation.MongoDatabasesResource,
- App: name,
- },
- },
- },
- K8sObjects: &validation.K8sObjectSet{
- Namespaces: map[string][]validation.K8sObject{
- appNamespace: {
- validation.NewK8sPodForResource(name, "mdb-ctx-ctnr").ValidateLabels(false),
- },
- },
- },
- },
- })
-
- test.Test(t)
-}
diff --git a/test/functional/shared/resources/extender_test.go b/test/functional/shared/resources/extender_test.go
index 31b1020545..1d3229cd7b 100644
--- a/test/functional/shared/resources/extender_test.go
+++ b/test/functional/shared/resources/extender_test.go
@@ -17,11 +17,8 @@ limitations under the License.
package resource_test
import (
- "fmt"
"testing"
- "os"
-
"github.com/radius-project/radius/test/functional"
"github.com/radius-project/radius/test/functional/shared"
"github.com/radius-project/radius/test/step"
@@ -96,79 +93,3 @@ func Test_Extender_Recipe(t *testing.T) {
test.Test(t)
}
-
-func Test_Extender_RecipeAWS(t *testing.T) {
- t.Skip("Skipping until we resolve https://github.com/radius-project/radius/issues/6535")
- awsAccountID := os.Getenv("AWS_ACCOUNT_ID")
- awsRegion := os.Getenv("AWS_REGION")
- // Error the test if the required environment variables are not set
- // for running locally set the environment variables
- if awsAccountID == "" || awsRegion == "" {
- t.Error("This test needs the env variables AWS_ACCOUNT_ID and AWS_REGION to be set")
- }
-
- template := "testdata/corerp-resources-extender-aws-s3-recipe.bicep"
- name := "corerp-resources-extenders-aws-s3-recipe"
- appName := "corerp-resources-extenders-aws-s3-recipe-app"
- bucketName := functional.GenerateS3BucketName()
- bucketID := fmt.Sprintf("/planes/aws/aws/accounts/%s/regions/%s/providers/AWS.S3/Bucket/%s", awsAccountID, awsRegion, bucketName)
- creationTimestamp := functional.GetCreationTimestamp()
-
- test := shared.NewRPTest(t, name, []shared.TestStep{
- {
- Executor: step.NewDeployExecutor(
- template,
- "bucketName="+bucketName,
- "creationTimestamp="+creationTimestamp,
- functional.GetAWSAccountId(),
- functional.GetAWSRegion(),
- functional.GetBicepRecipeRegistry(),
- functional.GetBicepRecipeVersion(),
- ),
- RPResources: &validation.RPResourceSet{
- Resources: []validation.RPResource{
- {
- Name: "corerp-resources-extenders-aws-s3-recipe-env",
- Type: validation.EnvironmentsResource,
- },
- {
- Name: "corerp-resources-extenders-aws-s3-recipe-app",
- Type: validation.ApplicationsResource,
- },
- {
- Name: "corerp-resources-extenders-aws-s3-recipe",
- Type: validation.ExtendersResource,
- App: appName,
- OutputResources: []validation.OutputResourceResponse{
- {
- ID: bucketID,
- },
- },
- },
- },
- },
- AWSResources: &validation.AWSResourceSet{
- Resources: []validation.AWSResource{
- {
- Name: bucketName,
- Type: validation.AWSS3BucketResourceType,
- Identifier: bucketName,
- Properties: map[string]any{
- "BucketName": bucketName,
- "Tags": []any{
- map[string]any{
- "Key": "RadiusCreationTimestamp",
- "Value": creationTimestamp,
- },
- },
- },
- SkipDeletion: true, // will be deleted by the recipe
- },
- },
- },
- SkipObjectValidation: true,
- },
- })
-
- test.Test(t)
-}
diff --git a/test/functional/shared/resources/recipe_terraform_test.go b/test/functional/shared/resources/recipe_terraform_test.go
index 9cfac5845a..b98d3f0780 100644
--- a/test/functional/shared/resources/recipe_terraform_test.go
+++ b/test/functional/shared/resources/recipe_terraform_test.go
@@ -213,56 +213,6 @@ func Test_TerraformRecipe_Context(t *testing.T) {
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, functional.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)
- }
-
- test.Test(t)
-}
-
// Test_TerraformRecipe_ParametersAndOutputs Validates input parameters correctly set and output values/secrets are populated.
func Test_TerraformRecipe_ParametersAndOutputs(t *testing.T) {
template := "testdata/corerp-resources-terraform-recipe-terraform.bicep"
From 63f697162c3fb4ffd13b3bc9cda7f812b98cecff Mon Sep 17 00:00:00 2001
From: vinayada1 <28875764+vinayada1@users.noreply.github.com>
Date: Mon, 30 Oct 2023 16:39:34 -0700
Subject: [PATCH 2/2] fix comment
---
.../datastoresrp/resources/redis_test.go | 51 ----------------
.../datastoresrp/resources/redis_test.go | 61 +++++++++++++++++++
.../datastoresrp-resources-redis-manual.bicep | 0
3 files changed, 61 insertions(+), 51 deletions(-)
create mode 100644 test/functional/datastoresrp/resources/redis_test.go
rename test/{functional-cloud => functional}/datastoresrp/resources/testdata/datastoresrp-resources-redis-manual.bicep (100%)
diff --git a/test/functional-cloud/datastoresrp/resources/redis_test.go b/test/functional-cloud/datastoresrp/resources/redis_test.go
index 7dd32a8ca6..da6e643244 100644
--- a/test/functional-cloud/datastoresrp/resources/redis_test.go
+++ b/test/functional-cloud/datastoresrp/resources/redis_test.go
@@ -25,57 +25,6 @@ import (
"github.com/radius-project/radius/test/validation"
)
-func Test_Redis_Manual(t *testing.T) {
- template := "testdata/datastoresrp-resources-redis-manual.bicep"
- name := "dsrp-resources-redis-manual"
- appNamespace := "default-dsrp-resources-redis-manual"
-
- test := shared.NewRPTest(t, name, []shared.TestStep{
- {
- Executor: step.NewDeployExecutor(template, functional.GetMagpieImage()),
- RPResources: &validation.RPResourceSet{
- Resources: []validation.RPResource{
- {
- Name: name,
- Type: validation.ApplicationsResource,
- },
- {
- Name: "rds-app-ctnr",
- Type: validation.ContainersResource,
- App: name,
- },
- {
- Name: "rds-ctnr",
- Type: validation.ContainersResource,
- App: name,
- },
- {
- Name: "rds-rte",
- Type: validation.HttpRoutesResource,
- App: name,
- },
- {
- Name: "rds-rds",
- Type: validation.RedisCachesResource,
- App: name,
- },
- },
- },
- K8sObjects: &validation.K8sObjectSet{
- Namespaces: map[string][]validation.K8sObject{
- appNamespace: {
- validation.NewK8sPodForResource(name, "rds-app-ctnr"),
- validation.NewK8sPodForResource(name, "rds-ctnr"),
- validation.NewK8sServiceForResource(name, "rds-rte"),
- },
- },
- },
- },
- })
-
- test.Test(t)
-}
-
func Test_Redis_Recipe(t *testing.T) {
template := "testdata/datastoresrp-resources-redis-recipe.bicep"
name := "dsrp-resources-redis-recipe"
diff --git a/test/functional/datastoresrp/resources/redis_test.go b/test/functional/datastoresrp/resources/redis_test.go
new file mode 100644
index 0000000000..bbea5cb3fa
--- /dev/null
+++ b/test/functional/datastoresrp/resources/redis_test.go
@@ -0,0 +1,61 @@
+package resource_test
+
+import (
+ "testing"
+
+ "github.com/radius-project/radius/test/functional"
+ "github.com/radius-project/radius/test/functional/shared"
+ "github.com/radius-project/radius/test/step"
+ "github.com/radius-project/radius/test/validation"
+)
+
+func Test_Redis_Manual(t *testing.T) {
+ template := "testdata/datastoresrp-resources-redis-manual.bicep"
+ name := "dsrp-resources-redis-manual"
+ appNamespace := "default-dsrp-resources-redis-manual"
+
+ test := shared.NewRPTest(t, name, []shared.TestStep{
+ {
+ Executor: step.NewDeployExecutor(template, functional.GetMagpieImage()),
+ RPResources: &validation.RPResourceSet{
+ Resources: []validation.RPResource{
+ {
+ Name: name,
+ Type: validation.ApplicationsResource,
+ },
+ {
+ Name: "rds-app-ctnr",
+ Type: validation.ContainersResource,
+ App: name,
+ },
+ {
+ Name: "rds-ctnr",
+ Type: validation.ContainersResource,
+ App: name,
+ },
+ {
+ Name: "rds-rte",
+ Type: validation.HttpRoutesResource,
+ App: name,
+ },
+ {
+ Name: "rds-rds",
+ Type: validation.RedisCachesResource,
+ App: name,
+ },
+ },
+ },
+ K8sObjects: &validation.K8sObjectSet{
+ Namespaces: map[string][]validation.K8sObject{
+ appNamespace: {
+ validation.NewK8sPodForResource(name, "rds-app-ctnr"),
+ validation.NewK8sPodForResource(name, "rds-ctnr"),
+ validation.NewK8sServiceForResource(name, "rds-rte"),
+ },
+ },
+ },
+ },
+ })
+
+ test.Test(t)
+}
diff --git a/test/functional-cloud/datastoresrp/resources/testdata/datastoresrp-resources-redis-manual.bicep b/test/functional/datastoresrp/resources/testdata/datastoresrp-resources-redis-manual.bicep
similarity index 100%
rename from test/functional-cloud/datastoresrp/resources/testdata/datastoresrp-resources-redis-manual.bicep
rename to test/functional/datastoresrp/resources/testdata/datastoresrp-resources-redis-manual.bicep