Skip to content

Commit b985b86

Browse files
committed
Add check to ensure use_secret_as_volume accepts secret name as parameter
Signed-off-by: ddalvi <ddalvi@redhat.com>
1 parent fbf772e commit b985b86

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

kubernetes_platform/python/test/unit/test_secret.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,35 @@ def my_pipeline():
147147
}
148148
}
149149

150+
def test_with_secret_name_param(self):
151+
@dsl.pipeline
152+
def my_pipeline(secret_name: str = 'my-secret'):
153+
task = comp()
154+
kubernetes.use_secret_as_volume(
155+
task,
156+
secret_name=secret_name,
157+
mount_path='secretpath',
158+
)
159+
160+
pipeline_spec = my_pipeline(platform_spec=True)
161+
assert json_format.MessageToDict(pipeline_spec) == {
162+
'platforms': {
163+
'kubernetes': {
164+
'deploymentSpec': {
165+
'executors': {
166+
'exec-comp': {
167+
'secretAsVolume': [{
168+
'secretName': 'my-secret',
169+
'mountPath': 'secretpath',
170+
'optional': False
171+
}]
172+
}
173+
}
174+
}
175+
}
176+
}
177+
}
178+
150179
def test_preserves_secret_as_env(self):
151180
# checks that use_secret_as_volume respects previously set secrets as env
152181

0 commit comments

Comments
 (0)