From 223c60658c9a1db01358df84499385d27c5e2b94 Mon Sep 17 00:00:00 2001 From: ytimocin Date: Sun, 24 Nov 2024 22:43:18 -0800 Subject: [PATCH] Making necessary changes in the running-functional-tests document. Also doing some cleanup. Signed-off-by: ytimocin --- .github/workflows/functional-test-cloud.yaml | 32 +++--- .../workflows/functional-test-noncloud.yaml | 19 ++-- .github/workflows/long-running-azure.yaml | 7 +- .../running-controlplane-locally.md | 20 ++-- .../running-functional-tests.md | 62 +++++++++--- pkg/cli/clients/management.go | 1 - pkg/ucp/server/server.go | 1 - test/execute-functional-tests-cloud.sh | 97 +++++++++++++++++++ test/execute-functional-tests-noncloud.sh | 74 ++++++++++++++ test/executeFunctionalTest.sh | 37 ------- .../test-terraform-recipes/README.md | 6 +- 11 files changed, 254 insertions(+), 102 deletions(-) create mode 100755 test/execute-functional-tests-cloud.sh create mode 100755 test/execute-functional-tests-noncloud.sh delete mode 100755 test/executeFunctionalTest.sh diff --git a/.github/workflows/functional-test-cloud.yaml b/.github/workflows/functional-test-cloud.yaml index 7017dc7c11..ee7427ac1c 100644 --- a/.github/workflows/functional-test-cloud.yaml +++ b/.github/workflows/functional-test-cloud.yaml @@ -88,16 +88,16 @@ env: # The number of failed tests to report. ISSUE_CREATE_THRESHOLD: 2 # bicep-types ACR url for uploading Radius Bicep types - BICEP_TYPES_REGISTRY: 'biceptypes.azurecr.io' + BICEP_TYPES_REGISTRY: "biceptypes.azurecr.io" jobs: build: name: Build Radius for test runs-on: ubuntu-latest if: github.event_name == 'repository_dispatch' || - (github.event_name == 'schedule' && github.repository == 'radius-project/radius') || - (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') || - github.event_name == 'workflow_dispatch' + (github.event_name == 'schedule' && github.repository == 'radius-project/radius') || + (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') || + github.event_name == 'workflow_dispatch' env: DE_IMAGE: "ghcr.io/radius-project/deployment-engine" DE_TAG: "latest" @@ -345,11 +345,11 @@ jobs: append: true message: | :hourglass: Publishing Bicep Recipes for functional tests... - + - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '18' + node-version: "18" - name: Generate Bicep extensibility types from OpenAPI specs run: | @@ -362,7 +362,7 @@ jobs: path: ./hack/bicep-types-radius/generated if-no-files-found: error - - name: 'Login via Azure CLI' + - name: "Login via Azure CLI" uses: azure/login@v2 with: client-id: ${{ secrets.BICEPTYPES_CLIENT_ID }} @@ -375,8 +375,8 @@ jobs: chmod +x ./bicep sudo mv ./bicep /usr/local/bin/bicep bicep --version - - - name: Publish bicep types + + - name: Publish bicep types run: | bicep publish-extension ./hack/bicep-types-radius/generated/index.json --target br:${{ env.BICEP_TYPES_REGISTRY }}/test/radius:${{ env.REL_VERSION == 'edge' && 'latest' || env.REL_VERSION }} --force @@ -434,14 +434,14 @@ jobs: append: true message: | :x: Test recipe publishing failed - + tests: name: Run ${{ matrix.name }} functional tests needs: [build] if: github.event_name == 'repository_dispatch' || - (github.event_name == 'schedule' && github.repository == 'radius-project/radius') || - (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') || - github.event_name == 'workflow_dispatch' + (github.event_name == 'schedule' && github.repository == 'radius-project/radius') || + (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') || + github.event_name == 'workflow_dispatch' strategy: fail-fast: true matrix: @@ -716,9 +716,6 @@ jobs: # Populate the following test environment variables from JSON secret. # AZURE_COSMOS_MONGODB_ACCOUNT_ID - # AZURE_MSSQL_RESOURCE_ID - # AZURE_MSSQL_USERNAME - # AZURE_MSSQL_PASSWORD eval "export $(echo "${{ secrets.FUNCTEST_PREPROVISIONED_RESOURCE_JSON }}" | jq -r 'to_entries | map("\(.key)=\(.value)") | @sh')" make test-functional-${{ matrix.name }} @@ -729,9 +726,6 @@ jobs: 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 }} GH_TOKEN: ${{ steps.get_installation_token.outputs.token }} diff --git a/.github/workflows/functional-test-noncloud.yaml b/.github/workflows/functional-test-noncloud.yaml index 7560b7aa38..2de37f69ae 100644 --- a/.github/workflows/functional-test-noncloud.yaml +++ b/.github/workflows/functional-test-noncloud.yaml @@ -77,7 +77,7 @@ env: # Local Docker registry port LOCAL_REGISTRY_PORT: "5000" # bicep-types ACR url for uploading Radius Bicep types - BICEP_TYPES_REGISTRY: 'biceptypes.azurecr.io' + BICEP_TYPES_REGISTRY: "biceptypes.azurecr.io" jobs: build: @@ -123,7 +123,7 @@ jobs: # Set output variables to be used in the other jobs echo "REL_VERSION=pr-${UNIQUE_ID}" >> $GITHUB_OUTPUT echo "DE_IMAGE=${{ env.DE_IMAGE }}" >> $GITHUB_OUTPUT - echo "DE_TAG=${{ env.DE_TAG }}" >> $GITHUB_OUTPUT + echo "DE_TAG=${{ env.DE_TAG }}" >> $GITHUB_OUTPUT tests: name: Run ${{ matrix.name }} functional tests needs: build @@ -205,7 +205,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '18' + node-version: "18" - name: Generate Bicep extensibility types from OpenAPI specs run: | @@ -216,7 +216,7 @@ jobs: with: name: ${{ matrix.name }}_radius_bicep_types path: ./hack/bicep-types-radius/generated - if-no-files-found: error + if-no-files-found: error - name: Create a secure local registry id: create-local-registry @@ -316,9 +316,9 @@ jobs: sudo mv ./bicep /usr/local/bin/bicep bicep --version - - name: Publish bicep types - run: | - bicep publish-extension ./hack/bicep-types-radius/generated/index.json --target br:${{ env.LOCAL_REGISTRY_SERVER }}:${{ env.LOCAL_REGISTRY_PORT }}/radius:${{ env.REL_VERSION == 'edge' && 'latest' || env.REL_VERSION }} --force + - name: Publish bicep types + run: | + bicep publish-extension ./hack/bicep-types-radius/generated/index.json --target br:${{ env.LOCAL_REGISTRY_SERVER }}:${{ env.LOCAL_REGISTRY_PORT }}/radius:${{ env.REL_VERSION == 'edge' && 'latest' || env.REL_VERSION }} --force - name: Generate test bicepconfig.json run: | @@ -347,9 +347,7 @@ jobs: env: BICEP_RECIPE_REGISTRY: "${{ env.LOCAL_REGISTRY_SERVER }}:${{ env.LOCAL_REGISTRY_PORT }}" BICEP_RECIPE_TAG_VERSION: ${{ env.REL_VERSION }} - TEMP_CERT_DIR: ${{ steps.create-local-registry.outputs.temp-cert-dir }} - SSL_CERT_FILE: ${{ steps.create-local-registry.outputs.temp-cert-dir }}/certs/${{ env.LOCAL_REGISTRY_SERVER }}/client.crt - + - name: Run functional tests run: | # Ensure rad cli is in path before running tests. @@ -368,7 +366,6 @@ jobs: RADIUS_SAMPLES_REPO_ROOT: ${{ github.workspace }}/samples BICEP_RECIPE_REGISTRY: "${{ env.LOCAL_REGISTRY_NAME }}:${{ env.LOCAL_REGISTRY_PORT }}" BICEP_RECIPE_TAG_VERSION: ${{ env.BICEP_RECIPE_TAG_VERSION }} - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GOTESTSUM_OPTS: "--junitfile ./dist/functional_test/results.xml" - name: Process Functional Test Results diff --git a/.github/workflows/long-running-azure.yaml b/.github/workflows/long-running-azure.yaml index ce30023e82..a4d757933a 100644 --- a/.github/workflows/long-running-azure.yaml +++ b/.github/workflows/long-running-azure.yaml @@ -443,6 +443,7 @@ jobs: make publish-test-terraform-recipes - name: Get OIDC Issuer from AKS cluster run: | + # TODO: Is this being used? Because the `FUNCTEST_OIDC_ISSUER` is set but is not used in any of the tests. echo "FUNCTEST_OIDC_ISSUER=$(az aks show -n ${{ env.AKS_CLUSTER_NAME }} -g ${{ env.AKS_RESOURCE_GROUP }} --query "oidcIssuerProfile.issuerUrl" -otsv)" >> $GITHUB_ENV - name: Run functional tests run: | @@ -454,9 +455,6 @@ jobs: # Populate the following test environment variables from JSON secret. # AZURE_COSMOS_MONGODB_ACCOUNT_ID - # AZURE_MSSQL_RESOURCE_ID - # AZURE_MSSQL_USERNAME - # AZURE_MSSQL_PASSWORD eval "export $(echo "${{ secrets.FUNCTEST_PREPROVISIONED_RESOURCE_JSON }}" | jq -r 'to_entries | map("\(.key)=\(.value)") | @sh')" make test-functional-all @@ -467,9 +465,6 @@ jobs: 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 }} - FUNC_TEST_OIDC_ISSUER: ${{ env.FUNCTEST_OIDC_ISSUER }} DOCKER_REGISTRY: ${{ env.CONTAINER_REGISTRY }} BICEP_RECIPE_REGISTRY: ${{ env.BICEP_RECIPE_REGISTRY }} BICEP_RECIPE_TAG_VERSION: ${{ env.BICEP_RECIPE_TAG_VERSION }} diff --git a/docs/contributing/contributing-code/contributing-code-control-plane/running-controlplane-locally.md b/docs/contributing/contributing-code/contributing-code-control-plane/running-controlplane-locally.md index 6e26d51511..17fccd80ae 100644 --- a/docs/contributing/contributing-code/contributing-code-control-plane/running-controlplane-locally.md +++ b/docs/contributing/contributing-code/contributing-code-control-plane/running-controlplane-locally.md @@ -6,7 +6,7 @@ Radius consists of a few processes that get deployed inside a Kubernetes cluster. - This includes: +This includes: - Applications.Core RP / Portable Resources' Providers (applications-rp) - The resource provider that handles processing of core resources as well as recipes. - Universal Control Plane (ucp) - Acts as a proxy between the other services, also manages deployments of AWS resources. @@ -32,7 +32,7 @@ If you need to manually test APIs you can reach them at the following endpoints 4. Install .NET 6.0 SDK - . 5. Install C# VS Code extension - . 6. (Optional) Configure any cloud provider credentials you want to use for developing Radius. - + > 💡 The Bicep deployment engine uses .NET. However you don't need to know C# or .NET to develop locally with Radius. > 💡 Radius will use your locally configured Azure or AWS credentials. If you are able to use the `az` or `aws` CLI then you don't need to do any additional setup. @@ -50,7 +50,6 @@ rad init --full This will install Radius and configure an environment for you. The database that's used **will NOT** be shared with your debug setup, so it mostly doesn't matter what choices you make. - ## Setup Step 2: Modify config.yaml to point to your local RPs You can use your build of `rad` (or build from source) to test against a local copy of the RP by creating a special workspace configuration. @@ -71,9 +70,9 @@ workspaces: scope: /planes/radius/local/resourceGroups/default ``` -Make a copy of the `default` workspace called `dev` and set it as the default. Then add the `overrides` section from the example below. +Make a copy of the `default` workspace called `dev` and set it as the default. Then add the `overrides` section from the example below. - This example adds a `dev` workspace: +This example adds a `dev` workspace: ```yaml workspaces: @@ -105,7 +104,7 @@ Run this command to create the namespace that will be used to store data. kubectl create namespace radius-testing ``` -## Setup Step 3: Create Resource Group and Environment +## Setup Step 4: Create Resource Group and Environment At this point Radius is working but you don't have a resource group or environment. You can launch Radius and then use the CLI to create these. @@ -126,6 +125,10 @@ rad env create default At this point you're done with setup! Feel free to stop the debugger. +## Running Functional Tests + +For further instructions on running functional tests, please refer to the [Running Functional Tests](../contributing-code-tests/running-functional-tests.md) document. + ## Debugging Now you can launch the Radius locally through the VSCode menu. @@ -168,10 +171,11 @@ If you run into issues here, please re-read the prerequisites related to install ### I got a "InvalidTemplate" error when deploying a bicep file > sample error message: + ```json { "code": "InvalidTemplate", - "message": "Deployment template validation failed: 'The template language version '2.1-experimental' is not recognized.'.", + "message": "Deployment template validation failed: 'The template language version '2.1-experimental' is not recognized.'." } ``` @@ -188,4 +192,4 @@ Build deployment-engine project dotnet build ``` -After building the Deployment Engine, build the radius project and redeploy bicep file by running steps from [Debugging](#debugging). \ No newline at end of file +After building the Deployment Engine, build the radius project and redeploy bicep file by running steps from [Debugging](#debugging). diff --git a/docs/contributing/contributing-code/contributing-code-tests/running-functional-tests.md b/docs/contributing/contributing-code/contributing-code-tests/running-functional-tests.md index b730e90062..62e9a6f434 100644 --- a/docs/contributing/contributing-code/contributing-code-tests/running-functional-tests.md +++ b/docs/contributing/contributing-code/contributing-code-tests/running-functional-tests.md @@ -33,6 +33,8 @@ As much as possible, the tests use product functionality such as the Radius CLI ## Running the tests locally +**Please note** that tests may be cached if you are running them a few times in a row. Please run `go clean -testcache` to make sure that the cache is invalidated before running a test. + ### Prerequisites 1. Place `rad` on your path @@ -40,35 +42,63 @@ As much as possible, the tests use product functionality such as the Radius CLI 3. Make sure your [local dev environment is setup](../contributing-code-control-plane/running-controlplane-locally.md) 4. Log into your Github account and [Generate PAT](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) 5. Log-in to the container registry of your Github organization. - - `export CR_PAT=` - - `echo $CR_PAT | docker login ghcr.io -u --password-stdin` - + 1. `export CR_PAT=` + 2. `echo $CR_PAT | docker login ghcr.io -u --password-stdin` 6. Publish Bicep test recipes by running `BICEP_RECIPE_REGISTRY= make publish-test-bicep-recipes` 7. Publish Terraform test recipes by running `make publish-test-terraform-recipes` 8. Change the visibility of the published packages to 'public' -> ⚠️ The tests assume the Kubernetes namespace in use is `default`. If your environment is set up differently you will see -> test failures. - +> ⚠️ The tests assume the Kubernetes namespace in use is `default`. If your environment is set up differently you will see test failures. > ⚠️ If you set environment variables for functional tests you may need to restart VS Code or other editors for them to take effect. -### Run +### Run Non-Cloud Functional Tests + +1. Required environment variables: + 1. **TF_RECIPE_MODULE_SERVER_URL** + 2. **DOCKER_REGISTRY** + 3. **BICEP_RECIPE_REGISTRY** + 4. **RADIUS_SAMPLES_REPO_ROOT** +2. Run: + + ```sh + .{workspace}/radius/test/execute-functional-tests-noncloud.sh + ``` + +When you're running locally with this configuration, the script is going to create a new Radius group and environment that the functional tests need to run. The same script is also going to make sure that the necessary environment variables are set. If everything is set, the script will run the commands: + +```sh + make test-functional-cli-noncloud + make test-functional-corerp-noncloud + make test-functional-daprrp-noncloud + make test-functional-datastoresrp-noncloud + make test-functional-kubernetes-noncloud + make test-functional-msgrp-noncloud + make test-functional-samples-noncloud + make test-functional-ucp-noncloud +``` + +### Run Cloud Functional Tests -1. Run: +1. Required environment variables: + 1. **TF_RECIPE_MODULE_SERVER_URL** + 2. **DOCKER_REGISTRY** + 3. **BICEP_RECIPE_REGISTRY** + 4. **AZURE_COSMOS_MONGODB_ACCOUNT_ID** + 5. **AWS_ACCESS_KEY_ID** + 6. **AWS_SECRET_ACCESS_KEY** + 7. **AWS_REGION** +2. You also need to create AWS and Azure Credentials. Please refer to: . +3. Run: ```sh - .{workspace}/radius/test/executeFunctionalTest.sh + .{workspace}/radius/test/execute-functional-tests-cloud.sh ``` -When you're running locally with this configuration, the tests will use your locally selected Radius Environment and your local copy of `rad`. The executeFunctionalTest.sh scripts creates the azure resources and exports the values to be used in the functional test and runs: +When you're running locally with this configuration, the script is going to create a new Radius group and environment that the functional tests need to run. The same script is also going to make sure that the necessary environment variables are set. If everything is set, the script will run the commands: ```sh - make test-functional-corerp - make test-functional-msgrp - make test-functional-daprrp - make test-functional-datastoresrp + make test-functional-corerp-cloud + make test-functional-ucp-cloud ``` You can also run/debug individual tests from VSCode. diff --git a/pkg/cli/clients/management.go b/pkg/cli/clients/management.go index 0e1023fe7e..6e9a880bd7 100644 --- a/pkg/cli/clients/management.go +++ b/pkg/cli/clients/management.go @@ -569,7 +569,6 @@ func (amc *UCPApplicationsManagementClient) CreateOrUpdateEnvironment(ctx contex } return nil - } // DeleteEnvironment deletes an environment and all of its resources by its name (in the configured scope) or resource ID. diff --git a/pkg/ucp/server/server.go b/pkg/ucp/server/server.go index 421fd45d1c..08e223e83a 100644 --- a/pkg/ucp/server/server.go +++ b/pkg/ucp/server/server.go @@ -186,7 +186,6 @@ func NewServer(options *Options) (*hosting.Host, error) { } backendServiceOptions := hostopts.HostOptions{ - Config: &hostopts.ProviderConfig{ Env: hostopts.EnvironmentOptions{ RoleLocation: options.Config.Location, diff --git a/test/execute-functional-tests-cloud.sh b/test/execute-functional-tests-cloud.sh new file mode 100755 index 0000000000..9da1a400eb --- /dev/null +++ b/test/execute-functional-tests-cloud.sh @@ -0,0 +1,97 @@ +#!/usr/bin/env bash + +# ------------------------------------------------------------ +# Copyright 2023 The Radius Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ------------------------------------------------------------ + +# Make sure that you have default environment in the default group. +# The way to check that is to run the following commands: +# `rad group switch default` +# `rad env list` and check if there is an environment named `default`. +# If not, create one using `rad env create default`. + +# To run functional tests, you have to be in `kind-radius` group and +# `kind-radius` environment within the `default` group. +# You can switch to the group using `rad group switch kind-radius` +# and then switch to the environment using `rad env switch kind-radius`. + +rad group create default +rad env create kind-radius +rad group create kind-radius + +# Check if TF_RECIPE_MODULE_SERVER_URL environment variable is set +if [ -z "$TF_RECIPE_MODULE_SERVER_URL" ]; then + echo "Error: TF_RECIPE_MODULE_SERVER_URL environment variable is not set." + exit 1 +fi + +# Check if DOCKER_REGISTRY environment variable is set +if [ -z "$DOCKER_REGISTRY" ]; then + echo "Error: DOCKER_REGISTRY environment variable is not set." + exit 1 +fi + +# Check if BICEP_RECIPE_REGISTRY environment variable is set +if [ -z "$BICEP_RECIPE_REGISTRY" ]; then + echo "Error: BICEP_RECIPE_REGISTRY environment variable is not set." + exit 1 +fi + +# Check if RADIUS_SAMPLES_REPO_ROOT environment variable is set +if [ -z "$RADIUS_SAMPLES_REPO_ROOT" ]; then + echo "Error: RADIUS_SAMPLES_REPO_ROOT environment variable is not set." + exit 1 +fi + +# Check if AWS_ACCESS_KEY_ID environment variable is set +if [ -z "$AWS_ACCESS_KEY_ID" ]; then + echo "Error: AWS_ACCESS_KEY_ID environment variable is not set." + exit 1 +fi + +# Check if AWS_SECRET_ACCESS_KEY environment variable is set +if [ -z "$AWS_SECRET_ACCESS_KEY" ]; then + echo "Error: AWS_SECRET_ACCESS_KEY environment variable is not set." + exit 1 +fi + +# Check if AWS_REGION environment variable is set +if [ -z "$AWS_REGION" ]; then + echo "Error: AWS_REGION environment variable is not set." + exit 1 +fi + +# You can run them one by one or all at once. +# The way to run them all at once is to run the following command: +# `make test-functional-all-noncloud` + +usage() { + echo -e "$0 requires \n" + exit 1 +} + +if [ $# -lt 1 ]; then + usage +fi + +resourcegroup=$1 +echo "Creating Azure resources in resource group $resourcegroup" +resp=$(az deployment group create --resource-group $resourcegroup --template-file createAzureTestResources.bicep) +cat resp +export AZURE_COSMOS_MONGODB_ACCOUNT_ID=$(jq -r '.properties.outputs.cosmosMongoAccountID.value' <<<"${resp}") +echo "Created Azure Cosmos MongoDB account with ID $AZURE_COSMOS_MONGODB_ACCOUNT_ID" + +make test-functional-ucp-cloud +make test-functional-corerp-cloud diff --git a/test/execute-functional-tests-noncloud.sh b/test/execute-functional-tests-noncloud.sh new file mode 100755 index 0000000000..3a9e810523 --- /dev/null +++ b/test/execute-functional-tests-noncloud.sh @@ -0,0 +1,74 @@ +#!/usr/bin/env bash + +# ------------------------------------------------------------ +# Copyright 2023 The Radius Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ------------------------------------------------------------ + +# Make sure that you have default environment in the default group. +# The way to check that is to run the following commands: +# `rad group switch default` +# `rad env list` and check if there is an environment named `default`. +# If not, create one using `rad env create default`. + +# To run functional tests, you have to be in `kind-radius` group and +# `kind-radius` environment within the `default` group. +# You can switch to the group using `rad group switch kind-radius` +# and then switch to the environment using `rad env switch kind-radius`. + +rad group create default +rad env create kind-radius +rad group create kind-radius + +# Check if TF_RECIPE_MODULE_SERVER_URL environment variable is set +if [ -z "$TF_RECIPE_MODULE_SERVER_URL" ]; then + echo "Error: TF_RECIPE_MODULE_SERVER_URL environment variable is not set." + exit 1 +fi + +# Check if DOCKER_REGISTRY environment variable is set +if [ -z "$DOCKER_REGISTRY" ]; then + echo "Error: DOCKER_REGISTRY environment variable is not set." + exit 1 +fi + +# Check if BICEP_RECIPE_REGISTRY environment variable is set +if [ -z "$BICEP_RECIPE_REGISTRY" ]; then + echo "Error: BICEP_RECIPE_REGISTRY environment variable is not set." + exit 1 +fi + +# Check if RADIUS_SAMPLES_REPO_ROOT environment variable is set +if [ -z "$RADIUS_SAMPLES_REPO_ROOT" ]; then + echo "Error: RADIUS_SAMPLES_REPO_ROOT environment variable is not set." + exit 1 +fi + +# You can run them one by one or all at once. +# The way to run them all at once is to run the following command: +# `make test-functional-all-noncloud` + +# Make sure that you are in the root directory of the repository. +cd ../ + +echo "Running Radius non-cloud functional tests." + +make test-functional-cli-noncloud +# make test-functional-corerp-noncloud +make test-functional-daprrp-noncloud +make test-functional-datastoresrp-noncloud +make test-functional-kubernetes-noncloud +# make test-functional-msgrp-noncloud +make test-functional-samples-noncloud +make test-functional-ucp-noncloud diff --git a/test/executeFunctionalTest.sh b/test/executeFunctionalTest.sh deleted file mode 100755 index e2e1a5880a..0000000000 --- a/test/executeFunctionalTest.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env bash - -# ------------------------------------------------------------ -# Copyright 2023 The Radius Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ------------------------------------------------------------ -usage() { - echo -e "$0 requires \n" - exit 1 -} - -if [ $# -lt 1 ]; then - usage -fi - -resourcegroup=$1 -echo $resourcegroup - -resp=$(az deployment group create --resource-group $resourcegroup --template-file createAzureTestResources.bicep) -cat resp - -export AZURE_COSMOS_MONGODB_ACCOUNT_ID=$(jq -r '.properties.outputs.cosmosMongoAccountID.value' <<<"${resp}") -make test-functional-corerp -make test-functional-msgrp -make test-functional-daprrp -make test-functional-datastoresrp diff --git a/test/testrecipes/test-terraform-recipes/README.md b/test/testrecipes/test-terraform-recipes/README.md index 11cb976509..475811eebb 100644 --- a/test/testrecipes/test-terraform-recipes/README.md +++ b/test/testrecipes/test-terraform-recipes/README.md @@ -21,7 +21,7 @@ This URL is only accessible inside the cluster. If you need to verify the content, use: ```txt -kubectl port-forward svc/tf-module-server 8999:80 -n radius-test-tf-module-server +kubectl port-forward svc/tf-module-server 8999:80 -n radius-test-tf-module-server ``` Then you can access the recipe download at: @@ -30,7 +30,7 @@ Then you can access the recipe download at: http://localhost:8999/.zip ``` ----- +--- Or reference a module from Terraform: @@ -38,4 +38,4 @@ Or reference a module from Terraform: module "testing" { source = "http://localhost:8999/.zip" } -``` \ No newline at end of file +```