|
1 | 1 | import dataclasses
|
2 | 2 | import json
|
3 | 3 | import logging
|
| 4 | +import subprocess |
| 5 | +import sys |
4 | 6 | from datetime import timedelta
|
5 | 7 | from typing import NoReturn
|
6 | 8 |
|
@@ -392,14 +394,29 @@ def test_check_inventory_database_exists(ws, installation_ctx):
|
392 | 394 | installation_ctx.workspace_installer.configure()
|
393 | 395 |
|
394 | 396 |
|
395 |
| -def test_compare_remote_local_install_versions(installation_ctx) -> None: |
396 |
| - installation_ctx.workspace_installation.run() |
| 397 | +def is_on_release_branch(checkout_root: str) -> bool: |
| 398 | + """Check if running on a release branch""" |
| 399 | + release_branches = {"prepare/"} |
| 400 | + try: |
| 401 | + current_branch = subprocess.check_output( |
| 402 | + ["git", "rev-parse", "--abbrev-ref", "HEAD"], cwd=checkout_root, encoding=sys.getdefaultencoding() |
| 403 | + ) |
| 404 | + return any(current_branch.startswith(release_branch) for release_branch in release_branches) |
| 405 | + except subprocess.CalledProcessError: |
| 406 | + return False |
397 | 407 |
|
398 |
| - @retried(on=[NotFound], timeout=timedelta(minutes=2)) |
399 |
| - def wait_for_installation_to_finish(): |
400 |
| - installation_ctx.installation.load(WorkspaceConfig) |
401 | 408 |
|
402 |
| - wait_for_installation_to_finish() |
| 409 | +def test_compare_remote_local_install_versions(installation_ctx) -> None: |
| 410 | + """This test is known to fail on a branch with a major or minor version bump. |
| 411 | +
|
| 412 | + The databricks.labs.ucx.__about__.__version__ is bumped on the release branch BEFORE the git tag is created. (The |
| 413 | + git tag is created during release AFTER merging the release branch.) Therefore, this test is expected to fail on a |
| 414 | + release branch that introduces a major or minor version bump, because the local `__version__` has been updated in |
| 415 | + anticipation of the tag that will shortly be created. |
| 416 | + """ |
| 417 | + if is_on_release_branch(installation_ctx.product_info.checkout_root()): |
| 418 | + pytest.skip("Version compare is never equal on a release branch.") |
| 419 | + installation_ctx.workspace_installation.run() |
403 | 420 |
|
404 | 421 | error_message = "UCX workspace remote and local install versions are same and no override is requested. Exiting..."
|
405 | 422 | with pytest.raises(RuntimeWarning, match=error_message):
|
|
0 commit comments