Skip to content

Commit 214d743

Browse files
authored
test: execute declared Helm unit test assertions (#6768)
1 parent 06bfcf9 commit 214d743

39 files changed

Lines changed: 1499 additions & 1560 deletions

charts/camunda-platform-8.10/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ require (
1010
github.com/stretchr/testify v1.11.1
1111
gopkg.in/yaml.v3 v3.0.1
1212
k8s.io/api v0.36.2
13+
k8s.io/client-go v0.36.2
1314
)
1415

1516
require k8s.io/apimachinery v0.36.2
@@ -117,7 +118,6 @@ require (
117118
gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect
118119
gopkg.in/inf.v0 v0.9.1 // indirect
119120
gopkg.in/yaml.v2 v2.4.0 // indirect
120-
k8s.io/client-go v0.36.2 // indirect
121121
k8s.io/klog/v2 v2.140.0 // indirect
122122
k8s.io/kube-openapi v0.0.0-20260317180543-43fb72c5454a // indirect
123123
k8s.io/streaming v0.36.2 // indirect

charts/camunda-platform-8.10/test/unit/common/configmap_warnings_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,7 @@ func (s *ConfigMapWarningsTemplateTest) TestDifferentValuesInputs() {
7373
},
7474
{
7575
Name: "TestWarningsConfigMapAbsentWhenNoWarnings",
76-
// global.elasticsearch.enabled=false avoids the legacy-option deprecation warning
77-
// (the test helper otherwise defaults it to true); the new secondaryStorage key
78-
// satisfies the storage-type constraint.
7976
Values: map[string]string{
80-
"global.elasticsearch.enabled": "false",
8177
"orchestration.data.secondaryStorage.type": "elasticsearch",
8278
},
8379
Verifier: func(t *testing.T, output string, err error) {

charts/camunda-platform-8.10/test/unit/common/constraints_test.go

Lines changed: 18 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,8 @@ func (s *ConstraintTemplateTest) TestSecondaryStorageConstraint() {
105105
{
106106
Name: "TestSecondaryStorageConstraintFailsWhenOrchestrationEnabledAndNoStorageConfigured",
107107
Values: map[string]string{
108-
"orchestration.enabled": "true",
109-
"global.elasticsearch.enabled": "false",
110-
"global.opensearch.enabled": "false",
108+
"orchestration.enabled": "true",
109+
"orchestration.data.secondaryStorage.type": "",
111110
},
112111
Verifier: func(t *testing.T, output string, err error) {
113112
s.Require().ErrorContains(err, "Please configure an expected secondary storage type under `orchestration.data.secondaryStorage.type`")
@@ -116,42 +115,38 @@ func (s *ConstraintTemplateTest) TestSecondaryStorageConstraint() {
116115
{
117116
Name: "TestSecondaryStorageConstraintDoesNotFireWhenOrchestrationDisabled",
118117
Values: map[string]string{
119-
"orchestration.enabled": "false",
120-
"global.elasticsearch.enabled": "false",
121-
"global.opensearch.enabled": "false",
118+
"orchestration.enabled": "false",
119+
"orchestration.data.secondaryStorage.type": "",
122120
},
123121
Verifier: func(t *testing.T, output string, err error) {
124122
s.Require().Nil(err)
125123
},
126124
},
127125
{
128-
Name: "TestSecondaryStorageConstraintDoesNotFireWhenElasticsearchEnabled",
126+
Name: "TestSecondaryStorageConstraintDoesNotFireForElasticsearch",
129127
Values: map[string]string{
130-
"orchestration.enabled": "true",
131-
"global.elasticsearch.enabled": "true",
128+
"orchestration.enabled": "true",
129+
"orchestration.data.secondaryStorage.type": "elasticsearch",
132130
},
133131
Verifier: func(t *testing.T, output string, err error) {
134132
s.Require().Nil(err)
135133
},
136134
},
137135
{
138-
Name: "TestSecondaryStorageConstraintDoesNotFireWhenOpensearchEnabled",
136+
Name: "TestSecondaryStorageConstraintDoesNotFireForOpenSearch",
139137
Values: map[string]string{
140-
"orchestration.enabled": "true",
141-
"global.elasticsearch.enabled": "false",
142-
"global.opensearch.enabled": "true",
138+
"orchestration.enabled": "true",
139+
"orchestration.data.secondaryStorage.type": "opensearch",
143140
},
144141
Verifier: func(t *testing.T, output string, err error) {
145142
s.Require().Nil(err)
146143
},
147144
},
148145
{
149-
Name: "TestSecondaryStorageConstraintDoesNotFireWhenStorageTypeExplicitlySet",
146+
Name: "TestSecondaryStorageConstraintDoesNotFireForRDBMS",
150147
Values: map[string]string{
151148
"orchestration.enabled": "true",
152-
"orchestration.data.secondaryStorage.type": "elasticsearch",
153-
"global.elasticsearch.enabled": "false",
154-
"global.opensearch.enabled": "false",
149+
"orchestration.data.secondaryStorage.type": "rdbms",
155150
},
156151
Verifier: func(t *testing.T, output string, err error) {
157152
s.Require().Nil(err)
@@ -289,7 +284,7 @@ func (s *ConstraintTemplateTest) TestHelmVersionConstraint() {
289284
// `helm template` (the framework these tests use), so warning-content
290285
// assertions live only in manual `helm install --dry-run` / production
291286
// install verification — same constraint that applies to the existing
292-
// global.elasticsearch.tls.secret and Bitnami subchart deprecation
287+
// datastore TLS secret and Bitnami subchart deprecation
293288
// warnings.
294289
func (s *ConstraintTemplateTest) TestLegacyJksTruststoreFieldsRenderWithoutCrash() {
295290
testCases := []testhelpers.TestCase{
@@ -331,72 +326,6 @@ func (s *ConstraintTemplateTest) TestLegacyJksTruststoreFieldsRenderWithoutCrash
331326
s.Require().Nil(err)
332327
},
333328
},
334-
{
335-
// Minimal config: only existingSecret set, existingSecretKey defaults to "".
336-
// Pins the round-2 P1 fix: deprecation gate must fire on existingSecret-only,
337-
// not require both fields (which the old hasSecretConfig-based gate did).
338-
Name: "TestGlobalElasticsearchTlsJksSecretRendersOk_ExistingSecretOnly",
339-
Values: map[string]string{
340-
"orchestration.data.secondaryStorage.type": "elasticsearch",
341-
"global.elasticsearch.tls.jks.secret.existingSecret": "my-jks-pw-secret",
342-
},
343-
Verifier: func(t *testing.T, output string, err error) {
344-
s.Require().Nil(err)
345-
},
346-
},
347-
{
348-
Name: "TestGlobalOpensearchTlsJksSecretRendersOk_ExistingSecretOnly",
349-
Values: map[string]string{
350-
"orchestration.data.secondaryStorage.type": "opensearch",
351-
"global.opensearch.tls.jks.secret.existingSecret": "my-jks-pw-secret",
352-
},
353-
Verifier: func(t *testing.T, output string, err error) {
354-
s.Require().Nil(err)
355-
},
356-
},
357-
{
358-
// Exercises the inlineSecret branch of the gate
359-
// (or .secret.existingSecret .secret.inlineSecret).
360-
// Both branches must fire the warning independently.
361-
Name: "TestGlobalElasticsearchTlsJksSecretRendersOk_InlineSecret",
362-
Values: map[string]string{
363-
"orchestration.data.secondaryStorage.type": "elasticsearch",
364-
"global.elasticsearch.tls.jks.secret.inlineSecret": "changeit",
365-
},
366-
Verifier: func(t *testing.T, output string, err error) {
367-
s.Require().Nil(err)
368-
},
369-
},
370-
{
371-
Name: "TestGlobalOpensearchTlsJksSecretRendersOk_InlineSecret",
372-
Values: map[string]string{
373-
"orchestration.data.secondaryStorage.type": "opensearch",
374-
"global.opensearch.tls.jks.secret.inlineSecret": "changeit",
375-
},
376-
Verifier: func(t *testing.T, output string, err error) {
377-
s.Require().Nil(err)
378-
},
379-
},
380-
{
381-
Name: "TestGlobalElasticsearchTlsSecretRendersOk",
382-
Values: map[string]string{
383-
"orchestration.data.secondaryStorage.type": "elasticsearch",
384-
"global.elasticsearch.tls.secret.existingSecret": "my-legacy-jks",
385-
},
386-
Verifier: func(t *testing.T, output string, err error) {
387-
s.Require().Nil(err)
388-
},
389-
},
390-
{
391-
Name: "TestGlobalOpensearchTlsSecretRendersOk",
392-
Values: map[string]string{
393-
"orchestration.data.secondaryStorage.type": "opensearch",
394-
"global.opensearch.tls.secret.existingSecret": "my-legacy-jks",
395-
},
396-
Verifier: func(t *testing.T, output string, err error) {
397-
s.Require().Nil(err)
398-
},
399-
},
400329
{
401330
Name: "TestCaBundleAndLegacyJksCoexistRenderOk_Elasticsearch",
402331
Values: map[string]string{
@@ -459,17 +388,14 @@ func (s *ConstraintTemplateTest) TestBitnamiSubchartDeprecationWarnings() {
459388
testCases := []testhelpers.TestCase{
460389
{
461390
Name: "TestBitnamiDeprecationWarningDoesNotPreventInstallWithElasticsearch",
462-
Values: map[string]string{
463-
// elasticsearch.enabled and global.elasticsearch.enabled default to true via test helper
464-
},
391+
Values: map[string]string{},
465392
Verifier: func(t *testing.T, output string, err error) {
466393
s.Require().Nil(err)
467394
},
468395
},
469396
{
470397
Name: "TestRenderSucceedsWithAllBitnamiSubchartsDisabled",
471398
Values: map[string]string{
472-
"global.elasticsearch.enabled": "false",
473399
"orchestration.data.secondaryStorage.type": "rdbms",
474400
},
475401
Verifier: func(t *testing.T, output string, err error) {
@@ -517,10 +443,6 @@ func (s *ConstraintTemplateTest) TestCamundaHubConsolidationDeprecationWarningsR
517443
testhelpers.RunTestCasesE(s.T(), s.chartPath, s.release, s.namespace, s.templates, testCases)
518444
}
519445

520-
// TestWebModelerExternalDatabaseUserRemovedGate verifies the
521-
// webModeler.restapi.externalDatabase.user removal check (camundaPlatform.keyRemoved,
522-
// which calls fail and IS surfaced by helm template) fires on both enablement
523-
// paths: the legacy webModeler.enabled key and the new camundaHub.enabled key.
524446
func (s *ConstraintTemplateTest) TestWebModelerExternalDatabaseUserRemovedGate() {
525447
testCases := []testhelpers.TestCase{
526448
{
@@ -532,9 +454,8 @@ func (s *ConstraintTemplateTest) TestWebModelerExternalDatabaseUserRemovedGate()
532454
"webModeler.restapi.mail.fromAddress": "noreply@example.com",
533455
"webModeler.restapi.externalDatabase.user": "modeler-user",
534456
},
535-
Verifier: func(t *testing.T, output string, err error) {
536-
s.Require().ErrorContains(err, "webModeler.restapi.externalDatabase.user")
537-
s.Require().ErrorContains(err, "has been removed")
457+
Expected: map[string]string{
458+
"ERROR": `The Helm values file key "webModeler.restapi.externalDatabase.user" has been removed.`,
538459
},
539460
},
540461
{
@@ -546,9 +467,8 @@ func (s *ConstraintTemplateTest) TestWebModelerExternalDatabaseUserRemovedGate()
546467
"webModeler.restapi.mail.fromAddress": "noreply@example.com",
547468
"webModeler.restapi.externalDatabase.user": "modeler-user",
548469
},
549-
Verifier: func(t *testing.T, output string, err error) {
550-
s.Require().ErrorContains(err, "webModeler.restapi.externalDatabase.user")
551-
s.Require().ErrorContains(err, "has been removed")
470+
Expected: map[string]string{
471+
"ERROR": `The Helm values file key "webModeler.restapi.externalDatabase.user" has been removed.`,
552472
},
553473
},
554474
}

charts/camunda-platform-8.10/test/unit/common/helpers_normalize_secret_test.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -52,48 +52,48 @@ func (s *normalizeSecretConfigTest) TestSecretHelperFunctionsWithOpenSearch() {
5252
{
5353
Name: "opensearch new style secret creates env vars",
5454
Values: map[string]string{
55-
"orchestration.enabled": "true",
56-
"global.opensearch.enabled": "true",
57-
"global.opensearch.auth.secret.existingSecret": "my-opensearch-secret",
58-
"global.opensearch.auth.secret.existingSecretKey": "my-key",
55+
"orchestration.enabled": "true",
56+
"orchestration.data.secondaryStorage.type": "opensearch",
57+
"orchestration.data.secondaryStorage.opensearch.auth.secret.existingSecret": "my-opensearch-secret",
58+
"orchestration.data.secondaryStorage.opensearch.auth.secret.existingSecretKey": "my-key",
5959
},
6060
Expected: map[string]string{
61-
"spec.template.spec.containers[0].env[?(@.name=='CAMUNDA_OPERATE_ZEEBE_OPENSEARCH_PASSWORD')].valueFrom.secretKeyRef.name": "my-opensearch-secret",
62-
"spec.template.spec.containers[0].env[?(@.name=='CAMUNDA_OPERATE_ZEEBE_OPENSEARCH_PASSWORD')].valueFrom.secretKeyRef.key": "my-key",
61+
"spec.template.spec.containers[0].env[?(@.name=='VALUES_OPENSEARCH_PASSWORD')].valueFrom.secretKeyRef.name": "my-opensearch-secret",
62+
"spec.template.spec.containers[0].env[?(@.name=='VALUES_OPENSEARCH_PASSWORD')].valueFrom.secretKeyRef.key": "my-key",
6363
},
6464
},
6565
{
6666
Name: "opensearch inline secret creates env vars with direct values",
6767
Values: map[string]string{
68-
"orchestration.enabled": "true",
69-
"global.opensearch.enabled": "true",
70-
"global.opensearch.auth.secret.inlineSecret": "my-password",
68+
"orchestration.enabled": "true",
69+
"orchestration.data.secondaryStorage.type": "opensearch",
70+
"orchestration.data.secondaryStorage.opensearch.auth.secret.inlineSecret": "my-password",
7171
},
7272
Expected: map[string]string{
73-
"spec.template.spec.containers[0].env[?(@.name=='CAMUNDA_OPERATE_ZEEBE_OPENSEARCH_PASSWORD')].value": "my-password",
73+
"spec.template.spec.containers[0].env[?(@.name=='VALUES_OPENSEARCH_PASSWORD')].value": "my-password",
7474
},
7575
},
7676
{
7777
Name: "no opensearch config means no env vars",
7878
Values: map[string]string{
79-
"orchestration.enabled": "true",
80-
"global.opensearch.enabled": "true",
79+
"orchestration.enabled": "true",
80+
"orchestration.data.secondaryStorage.type": "opensearch",
8181
},
8282
Verifier: func(t *testing.T, output string, err error) {
83-
// Should not create any opensearch password env vars
84-
require.NotContains(t, output, "CAMUNDA_OPERATE_ZEEBE_OPENSEARCH_PASSWORD")
83+
require.NoError(t, err)
84+
require.NotContains(t, output, "VALUES_OPENSEARCH_PASSWORD")
8585
},
8686
},
8787
{
8888
Name: "opensearch disabled means no env vars",
8989
Values: map[string]string{
90-
"orchestration.enabled": "true",
91-
"global.opensearch.enabled": "false",
92-
"global.opensearch.auth.secret.inlineSecret": "password",
90+
"orchestration.enabled": "true",
91+
"orchestration.data.secondaryStorage.type": "elasticsearch",
92+
"orchestration.data.secondaryStorage.opensearch.auth.secret.inlineSecret": "password",
9393
},
9494
Verifier: func(t *testing.T, output string, err error) {
95-
// Should not create any opensearch password env vars when opensearch is disabled
96-
require.NotContains(t, output, "CAMUNDA_OPERATE_ZEEBE_OPENSEARCH_PASSWORD")
95+
require.NoError(t, err)
96+
require.NotContains(t, output, "VALUES_OPENSEARCH_PASSWORD")
9797
},
9898
},
9999
}

charts/camunda-platform-8.10/test/unit/common/no_secondary_storage_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ func (s *NoSecondaryStorageTemplateTest) TestNoSecondaryStorageGlobalValue() {
5454
HelmOptionsExtraArgs: map[string][]string{"install": {"--debug"}},
5555
Values: map[string]string{
5656
"global.noSecondaryStorage": "true",
57-
"global.elasticsearch.enabled": "false",
58-
"global.opensearch.enabled": "false",
5957
"orchestration.security.authentication.method": "oidc",
6058
},
6159
Verifier: func(t *testing.T, output string, err error) {

0 commit comments

Comments
 (0)