Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDK - Testing - Fix metadata comparison instability #2145

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions sdk/python/tests/compiler/compiler_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import kfp
import kfp.compiler as compiler
import kfp.dsl as dsl
import json
import os
import shutil
import subprocess
Expand Down Expand Up @@ -203,6 +204,10 @@ def test_basic_workflow_without_decorator(self):
with open(os.path.join(test_data_dir, 'basic_no_decorator.yaml'), 'r') as f:
golden = yaml.safe_load(f)

for workflow in golden, compiled_workflow:
annotations = workflow['metadata']['annotations']
del annotations['pipelines.kubeflow.org/pipeline_spec']

self.assertEqual(golden, compiled_workflow)
finally:
shutil.rmtree(tmpdir)
Expand All @@ -226,6 +231,10 @@ def test_composing_workflow(self):
golden = yaml.safe_load(f)
compiled = self._get_yaml_from_zip(compose_package_path)

for workflow in golden, compiled:
annotations = workflow['metadata']['annotations']
del annotations['pipelines.kubeflow.org/pipeline_spec']

self.maxDiff = None
# Comment next line for generating golden yaml.
self.assertEqual(golden, compiled)
Expand Down Expand Up @@ -253,6 +262,10 @@ def test_package_compile(self):
golden = yaml.safe_load(f)
compiled = self._get_yaml_from_zip(target_zip)

for workflow in golden, compiled:
annotations = workflow['metadata']['annotations']
del annotations['pipelines.kubeflow.org/pipeline_spec']

self.maxDiff = None
self.assertEqual(golden, compiled)
finally:
Expand All @@ -271,6 +284,10 @@ def _test_py_compile_zip(self, file_base_name):
golden = yaml.safe_load(f)
compiled = self._get_yaml_from_zip(target_zip)

for workflow in golden, compiled:
annotations = workflow['metadata']['annotations']
del annotations['pipelines.kubeflow.org/pipeline_spec']

self.maxDiff = None
self.assertEqual(golden, compiled)
finally:
Expand All @@ -287,6 +304,11 @@ def _test_py_compile_targz(self, file_base_name):
with open(os.path.join(test_data_dir, file_base_name + '.yaml'), 'r') as f:
golden = yaml.safe_load(f)
compiled = self._get_yaml_from_tar(target_tar)

for workflow in golden, compiled:
annotations = workflow['metadata']['annotations']
del annotations['pipelines.kubeflow.org/pipeline_spec']

self.maxDiff = None
self.assertEqual(golden, compiled)
finally:
Expand All @@ -305,6 +327,10 @@ def _test_py_compile_yaml(self, file_base_name):

with open(os.path.join(test_data_dir, target_yaml), 'r') as f:
compiled = yaml.safe_load(f)

for workflow in golden, compiled:
annotations = workflow['metadata']['annotations']
del annotations['pipelines.kubeflow.org/pipeline_spec']

self.maxDiff = None
self.assertEqual(golden, compiled)
Expand Down