Skip to content

Commit

Permalink
Make switch modes tests more reliable (#2025)
Browse files Browse the repository at this point in the history
  • Loading branch information
0sewa0 authored Aug 7, 2023
1 parent 3e69dd4 commit 9ba0934
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
15 changes: 9 additions & 6 deletions test/scenarios/classic/switch_modes/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand All @@ -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
Expand Down
14 changes: 8 additions & 6 deletions test/scenarios/cloudnative/switch_modes/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,29 @@ 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)

// 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())
Expand Down

0 comments on commit 9ba0934

Please sign in to comment.