Skip to content

Commit

Permalink
Making necessary changes in the running-functional-tests document. Al…
Browse files Browse the repository at this point in the history
…so doing some cleanup.

Signed-off-by: ytimocin <[email protected]>
  • Loading branch information
ytimocin committed Dec 3, 2024
1 parent 1f241e3 commit 223c606
Show file tree
Hide file tree
Showing 11 changed files with 254 additions and 102 deletions.
32 changes: 13 additions & 19 deletions .github/workflows/functional-test-cloud.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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: |
Expand All @@ -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 }}
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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 }}
Expand All @@ -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 }}
Expand Down
19 changes: 8 additions & 11 deletions .github/workflows/functional-test-noncloud.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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: |
Expand All @@ -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
Expand Down Expand Up @@ -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: |
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/long-running-azure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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
Expand 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 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 - <https://dotnet.microsoft.com/en-us/download/dotnet/6.0>.
5. Install C# VS Code extension - <https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp>.
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.
Expand All @@ -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.
Expand All @@ -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:
Expand Down Expand Up @@ -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.

Expand All @@ -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.
Expand Down Expand Up @@ -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.'."
}
```

Expand All @@ -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).
After building the Deployment Engine, build the radius project and redeploy bicep file by running steps from [Debugging](#debugging).
Original file line number Diff line number Diff line change
Expand Up @@ -33,42 +33,72 @@ 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
2. Make sure `rad-bicep` is downloaded (`rad bicep download`)
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=<your_pat>`

`echo $CR_PAT | docker login ghcr.io -u <your_username> --password-stdin`

1. `export CR_PAT=<your_pat>`
2. `echo $CR_PAT | docker login ghcr.io -u <your_username> --password-stdin`
6. Publish Bicep test recipes by running `BICEP_RECIPE_REGISTRY=<registry-name> 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: <https://docs.radapp.io/reference/cli/rad_credential_register/>.
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.
Expand Down
1 change: 0 additions & 1 deletion pkg/cli/clients/management.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion pkg/ucp/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ func NewServer(options *Options) (*hosting.Host, error) {
}

backendServiceOptions := hostopts.HostOptions{

Config: &hostopts.ProviderConfig{
Env: hostopts.EnvironmentOptions{
RoleLocation: options.Config.Location,
Expand Down
Loading

0 comments on commit 223c606

Please sign in to comment.