Skip to content

Commit

Permalink
use new operator secret, update template variable naming
Browse files Browse the repository at this point in the history
Signed-off-by: cyrilico <19289022+cyrilico@users.noreply.github.com>
  • Loading branch information
cyrilico committed May 27, 2024
1 parent de19f06 commit fb5ce7b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/scalers/dynatrace/dynatrace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ var (
secretName = fmt.Sprintf("%s-secret", testName)
triggerAuthName = fmt.Sprintf("%s-ta", testName)
dynatraceHost = os.Getenv("DYNATRACE_HOST")
dynatraceOperatorToken = os.Getenv("DYNATRACE_OPERATOR_TOKEN")
dynatraceToken = os.Getenv("DYNATRACE_METRICS_TOKEN")
kubernetesClusterName = "keda-dynatrace-cluster"
deploymentReplicas = 1
Expand All @@ -49,6 +50,7 @@ type templateData struct {
TriggerAuthName string
SecretName string
DynatraceToken string
DynatraceOperatorToken string
DeploymentReplicas string
DynatraceHost string
KubernetesClusterName string
Expand Down Expand Up @@ -84,7 +86,7 @@ metadata:
namespace: {{.TestNamespace}}
data:
apiToken: {{.DynatraceToken}}
dataIngestToken: {{.DynatraceToken}}
dataIngestToken: {{.DynatraceOperatorToken}}
`

triggerAuthenticationTemplate = `apiVersion: keda.sh/v1alpha1
Expand Down Expand Up @@ -241,9 +243,9 @@ func TestDynatraceScaler(t *testing.T) {

installDynatrace(t)

data, templates = getDynatraceTemplateData()
dynatraceConfigData, dynatraceConfigTemplates = getDynatraceTemplateData()

Check failure on line 246 in tests/scalers/dynatrace/dynatrace_test.go

View workflow job for this annotation

GitHub Actions / Static Checks

undefined: dynatraceConfigData

Check failure on line 246 in tests/scalers/dynatrace/dynatrace_test.go

View workflow job for this annotation

GitHub Actions / Static Checks

undefined: dynatraceConfigTemplates
// Create Dynatrace-specific kubernetes resources
KubectlApplyMultipleWithTemplate(t, data, templates)
KubectlApplyMultipleWithTemplate(t, dynatraceConfigData, dynatraceConfigTemplates)

Check failure on line 248 in tests/scalers/dynatrace/dynatrace_test.go

View workflow job for this annotation

GitHub Actions / Static Checks

undefined: dynatraceConfigData

Check failure on line 248 in tests/scalers/dynatrace/dynatrace_test.go

View workflow job for this annotation

GitHub Actions / Static Checks

undefined: dynatraceConfigTemplates (typecheck)

assert.True(t, WaitForDeploymentReplicaReadyCount(t, kc, deploymentName, testNamespace, minReplicaCount, 60, 1),
"replica count should be %s after a minute", minReplicaCount)
Expand Down Expand Up @@ -310,6 +312,7 @@ func getTemplateData() (templateData, []Template) {
MaxReplicaCount: fmt.Sprintf("%v", maxReplicaCount),
DeploymentReplicas: fmt.Sprintf("%v", deploymentReplicas),
DynatraceToken: base64.StdEncoding.EncodeToString([]byte(dynatraceToken)),
DynatraceOperatorToken: base64.StdEncoding.EncodeToString([]byte(dynatraceOperatorToken)),
DynatraceHost: dynatraceHost,
}, []Template{
{Name: "secretTemplate", Config: secretTemplate},
Expand Down

0 comments on commit fb5ce7b

Please sign in to comment.