Skip to content

Commit

Permalink
chore(sdk): add test for key error bug resolved in kubeflow#10067
Browse files Browse the repository at this point in the history
  • Loading branch information
connor-mccarthy committed Oct 19, 2023
1 parent e8fb699 commit 4248105
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions sdk/python/kfp/compiler/compiler_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5279,5 +5279,31 @@ def roll_die_pipeline() -> str:
return dsl.OneOf(t3, t4.output)


class TestPipelineSpecAttributeUniqueError(unittest.TestCase):

def test_compiles(self):
# in a previous version of the KFP SDK there was an error when:
# - a component has a dsl.OutputPath parameter
# - the pipeline has an existing component by a different name
# - the user calls component.pipeline_spec inside their pipeline definition
# this was resolved coincidentally in
# https://github.com/kubeflow/pipelines/pull/10067, so test that it
# doesn't come back

@dsl.container_component
def existing_comp():
return dsl.ContainerSpec(
image='alpine', command=['echo'], args=['foo'])

@dsl.container_component
def issue_comp(v: dsl.OutputPath(str)):
return dsl.ContainerSpec(image='alpine', command=['echo'], args=[v])

@dsl.pipeline
def my_pipeline():
existing_comp()
issue_comp.pipeline_spec


if __name__ == '__main__':
unittest.main()

0 comments on commit 4248105

Please sign in to comment.