Skip to content

Commit

Permalink
Apend azure to branch name when suggester update azure symlinks
Browse files Browse the repository at this point in the history
Checks if the json symlink file contains azure and pull request branch name includes azure suffix.
  • Loading branch information
xjules committed Feb 7, 2023
1 parent 718937d commit 24d946b
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
2 changes: 2 additions & 0 deletions komodo/symlink/suggester/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ def suggest_symlink_configuration(
return None

target_branch = f"{args.release}/{args.mode}"
if "azure" in args.symlink_conf_path:
target_branch += "/azure"

from_sha = repo.get_branch(args.git_ref).commit.sha

Expand Down
44 changes: 44 additions & 0 deletions tests/test_suggester.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,50 @@ def test_suggest_symlink_configuration():
)


def test_suggest_symlink_configuration_azure():
"""
Testing whether when updating azure symlink file the branch gets a name
release/stable/azure
"""
config = """{"links": {
"2050.02-py58": "2050.02.00-py58",
"stable-py58": "2050.02-py58"
}}"""
repo = _mock_repo(config)

args = Namespace(
git_ref="master",
release="2050.02.01-py58",
mode="stable",
symlink_conf_path="foo_azure.json",
joburl="http://job",
jobname="job",
)
suggest_symlink_configuration(args, repo)

repo.get_contents.assert_called_once_with("foo_azure.json", ref="master")
repo.get_branch.assert_called_once_with("master")
repo.create_git_ref.assert_called_once_with(
ref="refs/heads/2050.02.01-py58/stable/azure", sha=ANY
)
repo.update_file.assert_called_once_with(
"foo_azure.json",
"Update stable symlinks for 2050.02.01-py58",
"""{
"links": {
"2050.02-py58": "2050.02.01-py58",
"stable-py58": "2050.02-py58"
}
}
""",
ANY,
branch="2050.02.01-py58/stable/azure",
)
repo.create_pull.assert_called_once_with(
title=ANY, body=ANY, head="2050.02.01-py58/stable/azure", base="master"
)


def test_noop_suggestion():
config = """{"links": {
"2050.02-py58": "2050.02.00-py58",
Expand Down

0 comments on commit 24d946b

Please sign in to comment.