Skip to content

Commit

Permalink
Change organization for UCP tests and separate cloud/non-cloud tests (r…
Browse files Browse the repository at this point in the history
…adius-project#7219)

# Description

- Separate cloud/non-cloud tests
- Organize the UCP tests as per
radius-project/design-notes#35. There will be
more PRs that will follow to re-org the other tests.

## Type of change

<!--

Please select **one** of the following options that describes your
change and delete the others. Clearly identifying the type of change you
are making will help us review your PR faster, and is used in authoring
release notes.

If you are making a bug fix or functionality change to Radius and do not
have an associated issue link please create one now.

-->

- This pull request adds or changes features of Radius and has an
approved issue (radius-project#6588 ).


<!--

Please update the following to link the associated issue. This is
required for some kinds of changes (see above).

-->

Fixes: Fixes part of radius-project#6588. This is a part of a multi-PR fix

---------

Signed-off-by: vinayada1 <[email protected]>
  • Loading branch information
vinayada1 authored Mar 5, 2024
1 parent 94d7914 commit 7dd7c17
Show file tree
Hide file tree
Showing 44 changed files with 207 additions and 198 deletions.
9 changes: 7 additions & 2 deletions build/test.mk
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,13 @@ test-validate-cli: ## Run cli integration tests

test-functional-all: test-functional-ucp test-functional-kubernetes test-functional-shared test-functional-cli test-functional-msgrp test-functional-daprrp test-functional-datastoresrp test-functional-samples ## Runs all functional tests

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: test-functional-ucp-noncloud test-functional-ucp-cloud ## Runs all UCP functional tests (both cloud and non-cloud)

test-functional-ucp-noncloud: ## Runs UCP functional tests that do not require cloud resources
CGO_ENABLED=1 $(GOTEST_TOOL) ./test/functional-portable/ucp/noncloud/... -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-portable/ucp/cloud/... -timeout ${TEST_TIMEOUT} -v -parallel 5 $(GOTEST_OPTS)

test-functional-kubernetes: test-functional-kubernetes-noncloud ## Runs all Kubernetes functional tests
CGO_ENABLED=1 $(GOTEST_TOOL) ./test/functional-portable/kubernetes/... -timeout ${TEST_TIMEOUT} -v -parallel 5 $(GOTEST_OPTS)
Expand Down
28 changes: 14 additions & 14 deletions test/functional-portable/cli/noncloud/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ import (
"github.com/radius-project/radius/pkg/corerp/api/v20231001preview"
"github.com/radius-project/radius/pkg/ucp/resources"
"github.com/radius-project/radius/pkg/version"
"github.com/radius-project/radius/test/functional"
"github.com/radius-project/radius/test/functional/shared"
"github.com/radius-project/radius/test/radcli"
"github.com/radius-project/radius/test/step"
"github.com/radius-project/radius/test/testcontext"
"github.com/radius-project/radius/test/testutil"
"github.com/radius-project/radius/test/validation"
"github.com/stretchr/testify/require"

Expand All @@ -63,8 +63,8 @@ func verifyRecipeCLI(ctx context.Context, t *testing.T, test shared.RPTest) {
options := shared.NewRPTestOptions(t)
cli := radcli.NewCLI(t, options.ConfigFilePath)
envName := test.Steps[0].RPResources.Resources[0].Name
registry := strings.TrimPrefix(functional.GetBicepRecipeRegistry(), "registry=")
version := strings.TrimPrefix(functional.GetBicepRecipeVersion(), "version=")
registry := strings.TrimPrefix(testutil.GetBicepRecipeRegistry(), "registry=")
version := strings.TrimPrefix(testutil.GetBicepRecipeVersion(), "version=")
resourceType := "Applications.Datastores/redisCaches"
file := "../../shared/resources/testdata/recipes/test-bicep-recipes/corerp-redis-recipe.bicep"
target := fmt.Sprintf("br:ghcr.io/radius-project/dev/test-bicep-recipes/redis-recipe:%s", generateUniqueTag())
Expand Down Expand Up @@ -124,7 +124,7 @@ func verifyRecipeCLI(ctx context.Context, t *testing.T, test shared.RPTest) {

t.Run("Validate rad recipe show - terraform recipe", func(t *testing.T) {
showRecipeName := "redistesttf"
moduleServer := strings.TrimPrefix(functional.GetTerraformRecipeModuleServerURL(), "moduleServer=")
moduleServer := strings.TrimPrefix(testutil.GetTerraformRecipeModuleServerURL(), "moduleServer=")
showRecipeTemplate := fmt.Sprintf("%s/kubernetes-redis.zip//modules", moduleServer)
showRecipeResourceType := "Applications.Datastores/redisCaches"
output, err := cli.RecipeRegister(ctx, envName, showRecipeName, "terraform", showRecipeTemplate, showRecipeResourceType, false)
Expand Down Expand Up @@ -296,7 +296,7 @@ func Test_Run_Logger(t *testing.T) {
"--application",
applicationName,
"--parameters",
functional.GetMagpieImage(),
testutil.GetMagpieImage(),
}

// 'rad run' streams logs until canceled by the user. This is why we can't 'just' run the command in
Expand Down Expand Up @@ -370,7 +370,7 @@ func Test_Run_Portforward(t *testing.T) {
"--application",
applicationName,
"--parameters",
functional.GetMagpieImage(),
testutil.GetMagpieImage(),
}

// 'rad run' streams logs until canceled by the user. This is why we can't 'just' run the command in
Expand Down Expand Up @@ -455,7 +455,7 @@ func Test_CLI(t *testing.T) {

test := shared.NewRPTest(t, name, []shared.TestStep{
{
Executor: step.NewDeployExecutor(template, functional.GetMagpieImage()),
Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage()),
RPResources: &validation.RPResourceSet{
Resources: []validation.RPResource{
{
Expand Down Expand Up @@ -495,7 +495,7 @@ func Test_CLI_JSON(t *testing.T) {

test := shared.NewRPTest(t, name, []shared.TestStep{
{
Executor: step.NewDeployExecutor(template, functional.GetMagpieImage()),
Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage()),
RPResources: &validation.RPResourceSet{
Resources: []validation.RPResource{
{
Expand Down Expand Up @@ -555,7 +555,7 @@ func Test_CLI_Delete(t *testing.T) {
t.Run("Validate rad app delete with non empty resources", func(t *testing.T) {
t.Logf("deploying %s from file %s", appName, templateWithResources)

err = cli.Deploy(ctx, templateFilePathWithResources, "", appName, functional.GetMagpieImage())
err = cli.Deploy(ctx, templateFilePathWithResources, "", appName, testutil.GetMagpieImage())
require.NoErrorf(t, err, "failed to deploy %s", appName)

validation.ValidateObjectsRunning(ctx, t, options.K8sClient, options.DynamicClient, validation.K8sObjectSet{
Expand Down Expand Up @@ -589,7 +589,7 @@ func Test_CLI_Delete(t *testing.T) {
t.Run("Validate rad app delete with resources not associated with any application", func(t *testing.T) {
t.Logf("deploying from file %s", templateWithResources)

err := cli.Deploy(ctx, templateFilePathWithResourcesUnassociated, "", appNameUnassociatedResources, functional.GetMagpieImage())
err := cli.Deploy(ctx, templateFilePathWithResourcesUnassociated, "", appNameUnassociatedResources, testutil.GetMagpieImage())
require.NoErrorf(t, err, "failed to deploy %s", appNameUnassociatedResources)

validation.ValidateObjectsRunning(ctx, t, options.K8sClient, options.DynamicClient, validation.K8sObjectSet{
Expand Down Expand Up @@ -625,15 +625,15 @@ func Test_CLI_DeploymentParameters(t *testing.T) {
template := "testdata/corerp-kubernetes-cli-parameters.bicep"
name := "kubernetes-cli-params"

registry, _ := functional.SetDefault()
parameterFilePath := functional.WriteBicepParameterFile(t, map[string]any{"registry": registry})
registry, _ := testutil.SetDefault()
parameterFilePath := testutil.WriteBicepParameterFile(t, map[string]any{"registry": registry})

// corerp-kubernetes-cli-parameters.parameters.json uses ghcr.io/radius-project/dev as a registry parameter.
// Use the specified tag only if the test uses ghcr.io/radius-project/dev registry. Otherwise, use latest tag.

test := shared.NewRPTest(t, name, []shared.TestStep{
{
Executor: step.NewDeployExecutor(template, "@"+parameterFilePath, functional.GetMagpieTag()),
Executor: step.NewDeployExecutor(template, "@"+parameterFilePath, testutil.GetMagpieTag()),
RPResources: &validation.RPResourceSet{
Resources: []validation.RPResource{
{
Expand Down Expand Up @@ -711,7 +711,7 @@ func Test_RecipeCommands(t *testing.T) {

test := shared.NewRPTest(t, name, []shared.TestStep{
{
Executor: step.NewDeployExecutor(template, functional.GetBicepRecipeRegistry(), functional.GetBicepRecipeVersion()),
Executor: step.NewDeployExecutor(template, testutil.GetBicepRecipeRegistry(), testutil.GetBicepRecipeVersion()),
RPResources: &validation.RPResourceSet{
Resources: []validation.RPResource{
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import (
"fmt"
"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/testutil"
"github.com/radius-project/radius/test/validation"
)

Expand All @@ -34,7 +34,7 @@ func Test_DaprPubSubBroker_Manual(t *testing.T) {

test := shared.NewRPTest(t, name, []shared.TestStep{
{
Executor: step.NewDeployExecutor(template, functional.GetMagpieImage(), fmt.Sprintf("namespace=%s", appNamespace)),
Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage(), fmt.Sprintf("namespace=%s", appNamespace)),
RPResources: &validation.RPResourceSet{
Resources: []validation.RPResource{
{
Expand Down Expand Up @@ -86,7 +86,7 @@ func Test_DaprPubSubBroker_Recipe(t *testing.T) {

test := shared.NewRPTest(t, name, []shared.TestStep{
{
Executor: step.NewDeployExecutor(template, functional.GetMagpieImage(), functional.GetBicepRecipeRegistry(), functional.GetBicepRecipeVersion()),
Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage(), testutil.GetBicepRecipeRegistry(), testutil.GetBicepRecipeVersion()),
RPResources: &validation.RPResourceSet{
Resources: []validation.RPResource{
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import (
"context"
"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/testutil"
"github.com/radius-project/radius/test/validation"
)

Expand All @@ -33,7 +33,7 @@ func Test_DaprSecretStore_Manual(t *testing.T) {

test := shared.NewRPTest(t, appNamespace, []shared.TestStep{
{
Executor: step.NewDeployExecutor(template, functional.GetMagpieImage()),
Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage()),
RPResources: &validation.RPResourceSet{
Resources: []validation.RPResource{
{
Expand Down Expand Up @@ -82,7 +82,7 @@ func Test_DaprSecretStore_Recipe(t *testing.T) {

test := shared.NewRPTest(t, appNamespace, []shared.TestStep{
{
Executor: step.NewDeployExecutor(template, functional.GetMagpieImage(), functional.GetBicepRecipeRegistry(), functional.GetBicepRecipeVersion()),
Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage(), testutil.GetBicepRecipeRegistry(), testutil.GetBicepRecipeVersion()),
RPResources: &validation.RPResourceSet{
Resources: []validation.RPResource{
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ 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/testutil"
"github.com/radius-project/radius/test/validation"
)

Expand All @@ -32,7 +32,7 @@ func Test_DaprServiceInvocation(t *testing.T) {

test := shared.NewRPTest(t, name, []shared.TestStep{
{
Executor: step.NewDeployExecutor(template, functional.GetMagpieImage()),
Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage()),
RPResources: &validation.RPResourceSet{
Resources: []validation.RPResource{
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import (
"fmt"
"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/testutil"
"github.com/radius-project/radius/test/validation"
)

Expand All @@ -34,7 +34,7 @@ func Test_DaprStateStore_Manual(t *testing.T) {

test := shared.NewRPTest(t, name, []shared.TestStep{
{
Executor: step.NewDeployExecutor(template, functional.GetMagpieImage(), fmt.Sprintf("namespace=%s", appNamespace)),
Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage(), fmt.Sprintf("namespace=%s", appNamespace)),
RPResources: &validation.RPResourceSet{
Resources: []validation.RPResource{
{
Expand Down Expand Up @@ -88,7 +88,7 @@ func Test_DaprStateStore_Recipe(t *testing.T) {

test := shared.NewRPTest(t, name, []shared.TestStep{
{
Executor: step.NewDeployExecutor(template, functional.GetMagpieImage(), functional.GetBicepRecipeRegistry(), functional.GetBicepRecipeVersion()),
Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage(), testutil.GetBicepRecipeRegistry(), testutil.GetBicepRecipeVersion()),
RPResources: &validation.RPResourceSet{
Resources: []validation.RPResource{
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ 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/testutil"
"github.com/radius-project/radius/test/validation"
)

Expand Down Expand Up @@ -51,7 +51,7 @@ func Test_MicrosoftSQL_Manual(t *testing.T) {

test := shared.NewRPTest(t, name, []shared.TestStep{
{
Executor: step.NewDeployExecutor(template, functional.GetMagpieImage(), mssqlresourceid, adminUsername, adminPassword, sqlDatabse, sqlServer),
Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage(), mssqlresourceid, adminUsername, adminPassword, sqlDatabse, sqlServer),
RPResources: &validation.RPResourceSet{
Resources: []validation.RPResource{
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ 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/testutil"
"github.com/radius-project/radius/test/validation"
)

Expand All @@ -33,7 +33,7 @@ func Test_MongoDB_Manual(t *testing.T) {

test := shared.NewRPTest(t, name, []shared.TestStep{
{
Executor: step.NewDeployExecutor(template, functional.GetMagpieImage()),
Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage()),
RPResources: &validation.RPResourceSet{
Resources: []validation.RPResource{
{
Expand Down Expand Up @@ -80,7 +80,7 @@ func Test_MongoDB_Recipe(t *testing.T) {

test := shared.NewRPTest(t, name, []shared.TestStep{
{
Executor: step.NewDeployExecutor(template, functional.GetMagpieImage(), functional.GetBicepRecipeRegistry(), functional.GetBicepRecipeVersion()),
Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage(), testutil.GetBicepRecipeRegistry(), testutil.GetBicepRecipeVersion()),
RPResources: &validation.RPResourceSet{
Resources: []validation.RPResource{
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import (
"strings"
"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/testutil"
"github.com/radius-project/radius/test/validation"
"github.com/stretchr/testify/require"
)
Expand All @@ -35,7 +35,7 @@ func Test_Redis_Manual(t *testing.T) {

test := shared.NewRPTest(t, name, []shared.TestStep{
{
Executor: step.NewDeployExecutor(template, functional.GetMagpieImage()),
Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage()),
RPResources: &validation.RPResourceSet{
Resources: []validation.RPResource{
{
Expand Down Expand Up @@ -79,7 +79,7 @@ func Test_Redis_Recipe(t *testing.T) {

test := shared.NewRPTest(t, name, []shared.TestStep{
{
Executor: step.NewDeployExecutor(template, functional.GetBicepRecipeRegistry(), functional.GetBicepRecipeVersion()),
Executor: step.NewDeployExecutor(template, testutil.GetBicepRecipeRegistry(), testutil.GetBicepRecipeVersion()),
RPResources: &validation.RPResourceSet{
Resources: []validation.RPResource{
{
Expand Down Expand Up @@ -120,7 +120,7 @@ func Test_Redis_DefaultRecipe(t *testing.T) {

test := shared.NewRPTest(t, name, []shared.TestStep{
{
Executor: step.NewDeployExecutor(template, functional.GetBicepRecipeRegistry(), functional.GetBicepRecipeVersion()),
Executor: step.NewDeployExecutor(template, testutil.GetBicepRecipeRegistry(), testutil.GetBicepRecipeVersion()),
RPResources: &validation.RPResourceSet{
Resources: []validation.RPResource{
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import (
"fmt"
"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/testutil"
"github.com/radius-project/radius/test/validation"
"github.com/stretchr/testify/require"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -39,7 +39,7 @@ func Test_Deployment_SimulatedEnv_BicepRecipe(t *testing.T) {

test := shared.NewRPTest(t, appName, []shared.TestStep{
{
Executor: step.NewDeployExecutor(template, functional.GetMagpieImage(), functional.GetBicepRecipeRegistry(), functional.GetBicepRecipeVersion()),
Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage(), testutil.GetBicepRecipeRegistry(), testutil.GetBicepRecipeVersion()),
RPResources: &validation.RPResourceSet{
Resources: []validation.RPResource{
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import (
"runtime"
"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/testutil"
"github.com/radius-project/radius/test/validation"
)

Expand All @@ -37,7 +37,7 @@ func Test_SQLDatabase_Manual(t *testing.T) {

test := shared.NewRPTest(t, name, []shared.TestStep{
{
Executor: step.NewDeployExecutor(template, functional.GetMagpieImage()),
Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage()),
RPResources: &validation.RPResourceSet{
Resources: []validation.RPResource{
{
Expand Down Expand Up @@ -84,7 +84,7 @@ func Test_SQLDatabase_Recipe(t *testing.T) {
appNamespace := "dsrp-resources-sqldb-recipe-app"
test := shared.NewRPTest(t, name, []shared.TestStep{
{
Executor: step.NewDeployExecutor(template, functional.GetMagpieImage(), functional.GetBicepRecipeRegistry(), functional.GetBicepRecipeVersion()),
Executor: step.NewDeployExecutor(template, testutil.GetMagpieImage(), testutil.GetBicepRecipeRegistry(), testutil.GetBicepRecipeVersion()),
RPResources: &validation.RPResourceSet{
Resources: []validation.RPResource{
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ import (
radappiov1alpha3 "github.com/radius-project/radius/pkg/controller/api/radapp.io/v1alpha3"
"github.com/radius-project/radius/pkg/controller/reconciler"
"github.com/radius-project/radius/pkg/sdk"
"github.com/radius-project/radius/test/functional"
"github.com/radius-project/radius/test/functional/shared"
"github.com/radius-project/radius/test/radcli"
"github.com/radius-project/radius/test/testcontext"
"github.com/radius-project/radius/test/testutil"
"github.com/stretchr/testify/require"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -62,8 +62,8 @@ func Test_TutorialApplication_KubernetesManifests(t *testing.T) {
cli := radcli.NewCLI(t, "")

params := []string{
functional.GetBicepRecipeRegistry(),
functional.GetBicepRecipeVersion(),
testutil.GetBicepRecipeRegistry(),
testutil.GetBicepRecipeVersion(),

// Avoid a conflict between app namespace and env namespace.
fmt.Sprintf("name=%s", environmentName),
Expand Down
Loading

0 comments on commit 7dd7c17

Please sign in to comment.