Skip to content
Open
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
11 changes: 11 additions & 0 deletions tfx/orchestration/kubeflow/v2/kubeflow_v2_dag_runner_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from tfx.orchestration import pipeline as tfx_pipeline
from tfx.orchestration.kubeflow.v2 import kubeflow_v2_dag_runner
from tfx.orchestration.kubeflow.v2 import test_utils
from tfx.utils import version_utils
from tfx.utils import telemetry_utils
from tfx.utils import test_case_utils
import yaml
Expand Down Expand Up @@ -66,6 +67,16 @@ def _compare_against_testdata(
)
expected_json['pipelineSpec']['sdkVersion'] = 'tfx-{}'.format(
version.__version__)
# Update expected test data image tags to match the TFX version under test.
executors = expected_json['pipelineSpec']['deploymentSpec']['executors']
statistics_gen_container = executors['StatisticsGen_executor']['container']
if (statistics_gen_container['image'] ==
'gcr.io/tfx-oss-public/tfx:latest'):
expected_json['pipelineSpec']['deploymentSpec'][
'executors']['StatisticsGen_executor'][
'container']['image'] = (
f'gcr.io/tfx-oss-public/tfx:{version_utils.get_image_version()}'
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider the following cases,

  1. If the branch being tested is master, then, version_utils.get_image_version() will give latest. Effectively no change.
  2. If the branch being tested is a release branch, r1.17.0 then, version_utils.get_image_version() will give 1.17.2. This will update latest to 1.17.2 which will pass the test. Currently without this PR this test fails on release branches.

)
if 'labels' in expected_json:
expected_json['labels']['tfx_version'] = telemetry_utils._normalize_label(
version.__version__)
Expand Down
Loading