From 9ba0934d1793efca83da17accb88407313775724 Mon Sep 17 00:00:00 2001 From: Marcell Sevcsik <31651557+0sewa0@users.noreply.github.com> Date: Mon, 7 Aug 2023 17:04:39 +0200 Subject: [PATCH] Make switch modes tests more reliable (#2025) --- test/scenarios/classic/switch_modes/install.go | 15 +++++++++------ .../scenarios/cloudnative/switch_modes/install.go | 14 ++++++++------ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/test/scenarios/classic/switch_modes/install.go b/test/scenarios/classic/switch_modes/install.go index 239e5745e1..c4beaeedcf 100644 --- a/test/scenarios/classic/switch_modes/install.go +++ b/test/scenarios/classic/switch_modes/install.go @@ -32,11 +32,12 @@ func Install(t *testing.T, name string) features.Feature { ClassicFullstack(&dynatracev1beta1.HostInjectSpec{}) dynakubeClassicFullStack := dynakubeBuilder.Build() - // install operator and dynakube - assess.InstallDynatrace(featureBuilder, &secretConfig, dynakubeClassicFullStack) - sampleAppClassic := sampleapps.NewSampleDeployment(t, dynakubeClassicFullStack) sampleAppClassic.WithName(sampleAppsClassicName) + featureBuilder.Assess("create sample app namespace", sampleAppClassic.InstallNamespace()) + + // install operator and dynakube + assess.InstallDynatrace(featureBuilder, &secretConfig, dynakubeClassicFullStack) featureBuilder.Assess("install sample app", sampleAppClassic.Install()) @@ -46,13 +47,15 @@ func Install(t *testing.T, name string) features.Feature { assess.DeleteDynakube(featureBuilder, dynakubeClassicFullStack) assess.AddClassicCleanUp(featureBuilder, dynakubeClassicFullStack) + sampleAppCloudNative := sampleapps.NewSampleDeployment(t, dynakubeCloudNative) + sampleAppCloudNative.WithName(sampleAppsCloudNativeName) + sampleAppCloudNative.WithAnnotations(map[string]string{dtwebhook.AnnotationFailurePolicy: "fail"}) + featureBuilder.Assess("create sample app namespace", sampleAppCloudNative.InstallNamespace()) + assess.InstallOperatorFromSource(featureBuilder, dynakubeCloudNative) assess.InstallDynakube(featureBuilder, &secretConfig, dynakubeCloudNative) // apply sample apps - sampleAppCloudNative := sampleapps.NewSampleDeployment(t, dynakubeCloudNative) - sampleAppCloudNative.WithName(sampleAppsCloudNativeName) - sampleAppCloudNative.WithAnnotations(map[string]string{dtwebhook.AnnotationFailurePolicy: "fail"}) featureBuilder.Assess("install sample app", sampleAppCloudNative.Install()) // run cloud native test here diff --git a/test/scenarios/cloudnative/switch_modes/install.go b/test/scenarios/cloudnative/switch_modes/install.go index a381b6b307..78d8998f13 100644 --- a/test/scenarios/cloudnative/switch_modes/install.go +++ b/test/scenarios/cloudnative/switch_modes/install.go @@ -30,14 +30,15 @@ func Install(t *testing.T, name string) features.Feature { ApiUrl(secretConfig.ApiUrl). CloudNative(&dynatracev1beta1.CloudNativeFullStackSpec{}) dynakubeCloudNative := cloudNativeDynakubeBuilder.Build() + sampleAppCloudNative := sampleapps.NewSampleDeployment(t, dynakubeCloudNative) + sampleAppCloudNative.WithName(sampleAppsCloudNativeName) + featureBuilder.Assess("(cloudnative) create sample app namespace", sampleAppCloudNative.InstallNamespace()) // install operator and dynakube assess.InstallDynatrace(featureBuilder, &secretConfig, dynakubeCloudNative) // apply sample apps - sampleAppCloudNative := sampleapps.NewSampleDeployment(t, dynakubeCloudNative) - sampleAppCloudNative.WithName(sampleAppsCloudNativeName) - featureBuilder.Assess("install sample app", sampleAppCloudNative.Install()) + featureBuilder.Assess("(cloudnative) install sample app", sampleAppCloudNative.Install()) // run cloud native test here cloudnative.AssessSampleInitContainers(featureBuilder, sampleAppCloudNative) @@ -45,12 +46,13 @@ func Install(t *testing.T, name string) features.Feature { // switch to classic full stack classicDynakubeBuilder := cloudNativeDynakubeBuilder.ResetOneAgent().ClassicFullstack(&dynatracev1beta1.HostInjectSpec{}) dynakubeClassicFullStack := classicDynakubeBuilder.Build() + sampleAppClassicFullStack := sampleapps.NewSampleDeployment(t, dynakubeClassicFullStack) + sampleAppClassicFullStack.WithName(sampleAppsClassicName) + featureBuilder.Assess("(classic) create sample app namespace", sampleAppClassicFullStack.InstallNamespace()) assess.UpdateDynakube(featureBuilder, dynakubeClassicFullStack) // deploy sample apps - sampleAppClassicFullStack := sampleapps.NewSampleDeployment(t, dynakubeClassicFullStack) - sampleAppClassicFullStack.WithName(sampleAppsClassicName) - featureBuilder.Assess("install sample app", sampleAppClassicFullStack.Install()) + featureBuilder.Assess("(classic) install sample app", sampleAppClassicFullStack.Install()) // tear down featureBuilder.Teardown(sampleAppCloudNative.Uninstall())