Skip to content

Commit e3b156b

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 e3b156b

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

kubernetes_platform/python/test/unit/test_secret.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,34 @@ 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+
assert json_format.MessageToDict(my_pipeline.platform_spec) == {
161+
'platforms': {
162+
'kubernetes': {
163+
'deploymentSpec': {
164+
'executors': {
165+
'exec-comp': {
166+
'secretAsVolume': [{
167+
'secretName': 'secret_name',
168+
'mountPath': 'secretpath',
169+
'optional': False
170+
}]
171+
}
172+
}
173+
}
174+
}
175+
}
176+
}
177+
150178
def test_preserves_secret_as_env(self):
151179
# checks that use_secret_as_volume respects previously set secrets as env
152180

0 commit comments

Comments
 (0)