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

Modify branch name when symlink suggester updates azure configs #331

Merged
merged 1 commit into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
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
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