rename auto-init main to default_branch and reject invalid ruleset shapes
This commit is contained in:
@@ -230,3 +230,66 @@ run "unknown_ruleset_rejected" {
|
||||
|
||||
expect_failures = [var.repository]
|
||||
}
|
||||
|
||||
run "non_main_default_branch_renamed" {
|
||||
command = plan
|
||||
|
||||
variables {
|
||||
repository = {
|
||||
legacy = { name = "legacy", default_branch = "master", maintainers = ["carol"] }
|
||||
}
|
||||
}
|
||||
|
||||
assert {
|
||||
condition = (
|
||||
github_branch_default.this["legacy"].branch == "master" &&
|
||||
github_branch_default.this["legacy"].rename &&
|
||||
github_branch_default.this["legacy"].wait_for_rename
|
||||
)
|
||||
error_message = "default_branch must rename the auto-init main and wait for it to propagate"
|
||||
}
|
||||
|
||||
assert {
|
||||
condition = github_repository_file.codeowners["legacy"].branch == "master"
|
||||
error_message = "CODEOWNERS must be committed to the renamed default branch"
|
||||
}
|
||||
}
|
||||
|
||||
run "tag_ruleset_pull_request_rejected" {
|
||||
command = plan
|
||||
|
||||
variables {
|
||||
ruleset = {
|
||||
tagpr = { name = "tagpr", target = "tag", rules = { pull_request = {} } }
|
||||
}
|
||||
repository = {}
|
||||
}
|
||||
|
||||
expect_failures = [var.ruleset]
|
||||
}
|
||||
|
||||
run "tag_ruleset_status_checks_rejected" {
|
||||
command = plan
|
||||
|
||||
variables {
|
||||
ruleset = {
|
||||
tagci = { name = "tagci", target = "tag", rules = { required_status_checks = { contexts = ["ci"] } } }
|
||||
}
|
||||
repository = {}
|
||||
}
|
||||
|
||||
expect_failures = [var.ruleset]
|
||||
}
|
||||
|
||||
run "empty_status_check_contexts_rejected" {
|
||||
command = plan
|
||||
|
||||
variables {
|
||||
ruleset = {
|
||||
noci = { name = "noci", rules = { required_status_checks = { contexts = [] } } }
|
||||
}
|
||||
repository = {}
|
||||
}
|
||||
|
||||
expect_failures = [var.ruleset]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user