Skip to content

Commit

Permalink
Add check to ensure use_secret_as_volume accepts secret name as param…
Browse files Browse the repository at this point in the history
…eter

Signed-off-by: ddalvi <[email protected]>
  • Loading branch information
DharmitD committed Aug 1, 2024
1 parent fbf772e commit e3b156b
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions kubernetes_platform/python/test/unit/test_secret.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,34 @@ def my_pipeline():
}
}

def test_with_secret_name_param(self):
@dsl.pipeline
def my_pipeline(secret_name: str = 'my-secret'):
task = comp()
kubernetes.use_secret_as_volume(
task,
secret_name=secret_name,
mount_path='secretpath',
)

assert json_format.MessageToDict(my_pipeline.platform_spec) == {
'platforms': {
'kubernetes': {
'deploymentSpec': {
'executors': {
'exec-comp': {
'secretAsVolume': [{
'secretName': 'secret_name',
'mountPath': 'secretpath',
'optional': False
}]
}
}
}
}
}
}

def test_preserves_secret_as_env(self):
# checks that use_secret_as_volume respects previously set secrets as env

Expand Down

0 comments on commit e3b156b

Please sign in to comment.