@@ -44,6 +44,38 @@ tests:
4444 path : data["flowforge.yml"]
4545 pattern : " secret: team-broker-secret"
4646
47+ - it : should render teamBroker block without api sub-block when teamBroker is enabled but api is missing
48+ template : configmap.yaml
49+ set :
50+ forge.broker.enabled : true
51+ forge.broker.teamBroker :
52+ enabled : true
53+ asserts :
54+ - matchRegex :
55+ path : data["flowforge.yml"]
56+ pattern : " teamBroker:"
57+ - notMatchRegex :
58+ path : data["flowforge.yml"]
59+ pattern : " api:"
60+ - notMatchRegex :
61+ path : data["flowforge.yml"]
62+ pattern : " TEAM_BROKER_API_SECRET"
63+
64+ - it : should render teamBroker block without api sub-block when teamBroker is enabled but api is empty
65+ template : configmap.yaml
66+ set :
67+ forge.broker.enabled : true
68+ forge.broker.teamBroker :
69+ enabled : true
70+ api : {}
71+ asserts :
72+ - matchRegex :
73+ path : data["flowforge.yml"]
74+ pattern : " teamBroker:"
75+ - notMatchRegex :
76+ path : data["flowforge.yml"]
77+ pattern : " api:"
78+
4779 # Deployment tests
4880 - it : should not include TEAM_BROKER_API_SECRET env var by default
4981 template : deployment.yaml
@@ -80,6 +112,25 @@ tests:
80112 key : teamBrokerApiSecret
81113 optional : true
82114
115+ - it : should not include TEAM_BROKER_API_SECRET env var when teamBroker is enabled but api is missing
116+ template : deployment.yaml
117+ set :
118+ forge.broker.teamBroker :
119+ enabled : true
120+ asserts :
121+ - notExists :
122+ path : spec.template.spec.initContainers[0].env[?(@.name == "TEAM_BROKER_API_SECRET")]
123+
124+ - it : should not include TEAM_BROKER_API_SECRET env var when teamBroker is enabled but api is empty
125+ template : deployment.yaml
126+ set :
127+ forge.broker.teamBroker :
128+ enabled : true
129+ api : {}
130+ asserts :
131+ - notExists :
132+ path : spec.template.spec.initContainers[0].env[?(@.name == "TEAM_BROKER_API_SECRET")]
133+
83134 # Secrets tests
84135 - it : should not include teamBrokerApiSecret in secrets by default
85136 template : secrets.yaml
@@ -126,14 +177,16 @@ tests:
126177 - failedTemplate :
127178 errorMessage : " A valid .Values.forge.broker.teamBroker.api.secret is required!"
128179
129- - it : should fail when teamBroker is enabled but api block is missing
180+ - it : should not include teamBrokerApiSecret when teamBroker is enabled but api block is missing
130181 template : secrets.yaml
131182 set :
132183 forge.broker.teamBroker :
133184 enabled : true
134185 asserts :
135- - failedTemplate :
136- errorMessage : " A valid .Values.forge.broker.teamBroker.api.key is required!"
186+ - isKind :
187+ of : Secret
188+ - notExists :
189+ path : data.teamBrokerApiSecret
137190
138191 # Coexistence with other secrets
139192 - it : should include teamBrokerApiSecret alongside other tokens when multiple features are enabled
0 commit comments