Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aabouzaid committed Nov 17, 2024
1 parent d818dd3 commit d7777b3
Show file tree
Hide file tree
Showing 60 changed files with 266 additions and 895 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (s *constraintTemplateTest) TestExistingSecretConstraintDoesNotDisplayError
SetValues: map[string]string{
"global.identity.auth.issuerBackendUrl": "http://keycloak:80/auth/realms/camunda-platform",
"global.testDeprecationFlags.existingSecretsMustBeSet": "error",
"global.identity.auth.core.existingSecret.name": "zeebe-secret",
"global.identity.auth.core.existingSecret.name": "zeebe-secret",
},
KubectlOptions: k8s.NewKubectlOptions("", "", s.namespace),
}
Expand All @@ -81,23 +81,7 @@ func (s *constraintTemplateTest) TestExistingSecretConstraintDoesNotDisplayError
// then
s.Require().NotContains(err.Error(), "global.identity.auth.core.existingSecret")
}
func (s *constraintTemplateTest) TestExistingSecretConstraintDoesNotDisplayErrorForComponentThatsDisabled() {
// given
options := &helm.Options{
SetValues: map[string]string{
"global.identity.auth.issuerBackendUrl": "http://keycloak:80/auth/realms/camunda-platform",
"global.testDeprecationFlags.existingSecretsMustBeSet": "error",
"operate.enabled": "false",
},
KubectlOptions: k8s.NewKubectlOptions("", "", s.namespace),
}

// when
_, err := helm.RenderTemplateE(s.T(), options, s.chartPath, s.release, s.templates)

// then
s.Require().NotContains(err.Error(), "global.identity.auth.operate.existingSecret")
}
func (s *constraintTemplateTest) TestExistingSecretConstraintInWarningModeDoesNotPreventInstall() {
// given
options := &helm.Options{
Expand All @@ -114,19 +98,3 @@ func (s *constraintTemplateTest) TestExistingSecretConstraintInWarningModeDoesNo
// then
s.Require().Nil(err)
}

func (s *ConstraintsTemplateTest) TestContextPathAndRestPathForZeebeGatewayConstraintBothValuesShouldBeTheSame() {
options := &helm.Options{
SetValues: map[string]string{
"zeebeGateway.ingress.rest.enabled": "true",
"zeebeGateway.ingress.rest.path": "/zeebe",
"zeebeGateway.contextPath": "/zeebeRest",
},
KubectlOptions: k8s.NewKubectlOptions("", "", s.namespace),
}

_, err := helm.RenderTemplateE(s.T(), options, s.chartPath, s.release, s.templates)

s.Require().ErrorContains(err, "[camunda][error]")

}
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,12 @@ func (s *deploymentTemplateTest) TestContainerSetImageNameGlobal() {
// given
options := &helm.Options{
SetValues: map[string]string{
"global.image.registry": "global.custom.registry.io",
"global.image.tag": "8.x.x",
"connectors.image.tag": "",
"identity.image.tag": "",
"operate.image.tag": "",
"optimize.image.tag": "",
"tasklist.image.tag": "",
"zeebe.image.tag": "",
"zeebeGateway.image.tag": "",
"global.image.registry": "global.custom.registry.io",
"global.image.tag": "8.x.x",
"connectors.image.tag": "",
"identity.image.tag": "",
"optimize.image.tag": "",
"core.image.tag": "",
},
KubectlOptions: k8s.NewKubectlOptions("", "", s.namespace),
}
Expand All @@ -157,8 +154,6 @@ func (s *deploymentTemplateTest) TestContainerSetImageNameGlobal() {
// then
s.Require().Contains(output, "image: global.custom.registry.io/camunda/connectors-bundle:8.x.x")
s.Require().Contains(output, "image: global.custom.registry.io/camunda/identity:8.x.x")
s.Require().Contains(output, "image: global.custom.registry.io/camunda/operate:8.x.x")
s.Require().Contains(output, "image: global.custom.registry.io/camunda/optimize:8.x.x")
s.Require().Contains(output, "image: global.custom.registry.io/camunda/tasklist:8.x.x")
s.Require().Contains(output, "image: global.custom.registry.io/camunda/zeebe:8.x.x")
s.Require().Contains(output, "image: global.custom.registry.io/camunda/camunda:8.x.x")
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
# Source: camunda-platform/templates/service-monitor/zeebe-service-monitor.yaml
# Source: camunda-platform/templates/service-monitor/core-service-monitor.yaml
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: camunda-platform-test-zeebe
name: camunda-platform-test-core
labels:
app: camunda-platform
app.kubernetes.io/name: camunda-platform
Expand All @@ -15,7 +15,7 @@ spec:
selector:
matchLabels:
app: camunda-platform
app.kubernetes.io/component: zeebe-broker
app.kubernetes.io/component: core
endpoints:
- honorLabels: true
path: /actuator/prometheus
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
# Source: camunda-platform/templates/camunda/secret-zeebe.yaml
# Source: camunda-platform/templates/camunda/secret-core.yaml
apiVersion: v1
kind: Secret
metadata:
name: camunda-platform-test-zeebe-identity-secret
name: camunda-platform-test-core-identity-secret
labels:
app: camunda-platform
app.kubernetes.io/name: identity
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ func TestGoldenDefaultsTemplateSecrets(t *testing.T) {
templateNames := []string{
"secret-connectors",
"secret-console",
"secret-operate",
"secret-optimize",
"secret-tasklist",
"secret-zeebe",
"secret-core",
}

for _, name := range templateNames {
Expand Down
26 changes: 7 additions & 19 deletions charts/camunda-platform-alpha/test/unit/camunda/ingress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestIngressTemplate(t *testing.T) {
chartPath: chartPath,
release: "camunda-platform-test",
namespace: "camunda-platform-" + strings.ToLower(random.UniqueId()),
templates: []string{"templates/camunda/ingress.yaml"},
templates: []string{"templates/camunda/ingress-http.yaml"},
})
}

Expand Down Expand Up @@ -157,13 +157,11 @@ func (s *ingressTemplateTest) TestIngressWithContextPath() {
SetValues: map[string]string{
"global.ingress.enabled": "true",
"identity.contextPath": "/identity",
"operate.contextPath": "/operate",
"optimize.contextPath": "/optimize",
"tasklist.contextPath": "/tasklist",
"webModeler.enabled": "true",
"webModeler.restapi.mail.fromAddress": "[email protected]",
"webModeler.contextPath": "/modeler",
"zeebeGateway.contextPath": "/zeebe",
"core.contextPath": "/core",
},
KubectlOptions: k8s.NewKubectlOptions("", "", s.namespace),
ExtraArgs: map[string][]string{"install": {"--debug"}},
Expand All @@ -176,12 +174,10 @@ func (s *ingressTemplateTest) TestIngressWithContextPath() {
s.Require().Contains(output, "kind: Ingress")
s.Require().Contains(output, "path: /auth")
s.Require().Contains(output, "path: /identity")
s.Require().Contains(output, "path: /operate")
s.Require().Contains(output, "path: /optimize")
s.Require().Contains(output, "path: /tasklist")
s.Require().Contains(output, "path: /modeler")
s.Require().Contains(output, "path: /modeler-ws")
s.Require().Contains(output, "path: /zeebe")
s.Require().Contains(output, "path: /core")
}

func (s *ingressTemplateTest) TestIngressComponentWithNoContextPath() {
Expand All @@ -190,12 +186,11 @@ func (s *ingressTemplateTest) TestIngressComponentWithNoContextPath() {
SetValues: map[string]string{
"global.ingress.enabled": "true",
"identity.contextPath": "",
"operate.contextPath": "",
"optimize.contextPath": "",
"tasklist.contextPath": "",
"webModeler.enabled": "true",
"webModeler.restapi.mail.fromAddress": "[email protected]",
"webModeler.contextPath": "",
"core.contextPath": "",
},
KubectlOptions: k8s.NewKubectlOptions("", "", s.namespace),
ExtraArgs: map[string][]string{"install": {"--debug"}},
Expand All @@ -206,25 +201,20 @@ func (s *ingressTemplateTest) TestIngressComponentWithNoContextPath() {

// then
s.Require().NotContains(output, "name: camunda-platform-test-identity")
s.Require().NotContains(output, "name: camunda-platform-test-operate")
s.Require().NotContains(output, "name: camunda-platform-test-optimize")
s.Require().NotContains(output, "name: camunda-platform-test-tasklist")
s.Require().NotContains(output, "name: camunda-platform-test-web-modeler-webapp")
s.Require().NotContains(output, "name: camunda-platform-test-web-modeler-websockets")
s.Require().NotContains(output, "name: camunda-platform-test-zeebe-gateway")
s.Require().NotContains(output, "name: camunda-platform-test-core")
}

func (s *ingressTemplateTest) TestIngressComponentDisabled() {
// given
options := &helm.Options{
SetValues: map[string]string{
"global.ingress.enabled": "true",
"operate.identity": "false",
"operate.enabled": "false",
"optimize.enabled": "false",
"tasklist.enabled": "false",
"webModeler.enabled": "false",
"zeebe.enabled": "false",
"core.enabled": "false",
},
KubectlOptions: k8s.NewKubectlOptions("", "", s.namespace),
ExtraArgs: map[string][]string{"install": {"--debug"}},
Expand All @@ -235,10 +225,8 @@ func (s *ingressTemplateTest) TestIngressComponentDisabled() {

// then
s.Require().NotContains(output, "name: camunda-platform-test-identity")
s.Require().NotContains(output, "name: camunda-platform-test-operate")
s.Require().NotContains(output, "name: camunda-platform-test-optimize")
s.Require().NotContains(output, "name: camunda-platform-test-tasklist")
s.Require().NotContains(output, "name: camunda-platform-test-web-modeler-webapp")
s.Require().NotContains(output, "name: camunda-platform-test-web-modeler-websockets")
s.Require().NotContains(output, "name: camunda-platform-test-zeebe-gateway")
s.Require().NotContains(output, "name: camunda-platform-test-core")
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,15 @@ func (s *secretTest) TestContainerGenerateSecret() {
s.templates = []string{
"templates/camunda/secret-connectors.yaml",
"templates/camunda/secret-console.yaml",
"templates/camunda/secret-operate.yaml",
"templates/camunda/secret-optimize.yaml",
"templates/camunda/secret-tasklist.yaml",
"templates/camunda/secret-zeebe.yaml",
"templates/camunda/secret-core.yaml",
}

s.secretName = []string{
"connectors-secret",
"console-secret",
"operate-secret",
"optimize-secret",
"tasklist-secret",
"zeebe-secret",
"core-secret",
}

s.Require().GreaterOrEqual(6, len(s.templates))
Expand Down
Loading

0 comments on commit d7777b3

Please sign in to comment.