blob: f102821dae9fa8c3a52ace71fc9ed6f27d17cb60 [file] [log] [blame]
# Copyright 2019 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from recipe_engine import recipe_test_api
DEFAULT_COMMIT_QUEUE_CFGS = {
"default": """
submit_options: {
max_burst: 4
burst_delay: {
seconds: 480
}
}
config_groups: {
gerrit: {
url: "https://fuchsia-review.googlesource.com"
projects: {
name: "cobalt"
ref_regexp: "refs/heads/.+"
}
}
verifiers: {
gerrit_cq_ability: {
committer_list: "project-fuchsia-committers"
dry_run_access_list: "project-fuchsia-tryjob-access"
}
tryjob: {
builders: {
name: "fuchsia/try/cobalt-x64-linux"
location_regexp: ".*"
location_regexp_exclude: ".+/[+]/.*\\.md"
}
}
}
}
config_groups: {
gerrit: {
url: "https://fuchsia-review.googlesource.com"
projects: {
name: "docs"
ref_regexp: "refs/heads/.+"
}
}
verifiers: {
gerrit_cq_ability: {
committer_list: "project-fuchsia-committers"
dry_run_access_list: "project-fuchsia-tryjob-access"
}
tryjob: {
builders: {
name: "fuchsia/try/doc-checker"
experiment_percentage: 100
location_regexp: ".*"
location_regexp_exclude: ".+/[+]/.*\\.md"
}
builders: {
name: "fuchsia/try/secret-tryjob"
location_regexp: ".*"
location_regexp_exclude: ".+/[+]/.*\\.md"
result_visibility: COMMENT_LEVEL_RESTRICTED
}
}
}
}
config_groups: {
gerrit: {
url: "https://fuchsia-review.googlesource.com"
projects: {
name: "experiences"
ref_regexp: "refs/heads/.+"
}
}
verifiers: {
gerrit_cq_ability: {
committer_list: "project-fuchsia-committers"
dry_run_access_list: "project-fuchsia-tryjob-access"
}
tree_status: {
url: "https://fuchsia-stem-status.appspot.com"
}
tryjob: {
builders: {
name: "fuchsia/try/core.arm64-debug"
location_regexp: ".*"
location_regexp_exclude: ".+/[+]/.*\\.md"
location_regexp_exclude: ".+/[+].*/docs/.+"
}
builders: {
name: "fuchsia/try/core.x64-debug"
location_regexp: ".*"
location_regexp_exclude: ".+/[+]/.*\\.md"
location_regexp_exclude: ".+/[+].*/docs/.+"
}
}
}
}
""",
"recipes-only": """
submit_options: {
max_burst: 4
burst_delay: {
seconds: 480
}
}
config_groups: {
gerrit: {
url: "https://fuchsia-review.googlesource.com"
projects: {
name: "cobalt"
ref_regexp: "refs/heads/.+"
}
}
verifiers: {
gerrit_cq_ability: {
committer_list: "project-fuchsia-committers"
dry_run_access_list: "project-fuchsia-tryjob-access"
}
tryjob: {
builders: {
name: "fuchsia/try/recipes"
location_regexp: ".*"
location_regexp_exclude: ".+/[+]/.*\\.md"
}
}
}
}
""",
"only-fuchsia-debug": """
submit_options: {
max_burst: 4
burst_delay: {
seconds: 480
}
}
config_groups: {
gerrit: {
url: "https://fuchsia-review.googlesource.com"
projects: {
name: "experiences"
ref_regexp: "refs/heads/.+"
}
}
verifiers: {
gerrit_cq_ability: {
committer_list: "project-fuchsia-committers"
dry_run_access_list: "project-fuchsia-tryjob-access"
}
tree_status: {
url: "https://fuchsia-stem-status.appspot.com"
}
tryjob: {
builders: {
name: "fuchsia/try/core.arm64-debug"
location_regexp: ".*"
location_regexp_exclude: ".+/[+]/.*\\.md"
location_regexp_exclude: ".+/[+].*/docs/.+"
}
builders: {
name: "fuchsia/try/core.x64-debug"
location_regexp: ".*"
location_regexp_exclude: ".+/[+]/.*\\.md"
location_regexp_exclude: ".+/[+].*/docs/.+"
}
}
}
}
""",
"includable_only": """
submit_options: {
max_burst: 4
burst_delay: {
seconds: 480
}
}
config_groups: {
gerrit: {
url: "https:xx//fuchsia-review.googlesource.com"
projects: {
name: "experiences"
ref_regexp: "refs/heads/.+"
}
}
verifiers: {
gerrit_cq_ability: {
committer_list: "project-fuchsia-committers"
dry_run_access_list: "project-fuchsia-tryjob-access"
}
tree_status: {
url: "https://fuchsia-stem-status.appspot.com"
}
tryjob: {
builders: {
name: "fuchsia/try/core.arm64-debug"
includable_only: true
}
}
}
}
""",
"mode_allowlist": """
config_groups: {
verifiers: {
tryjob: {
builders: {
name: "fuchsia/tricium/tricium"
mode_allowlist: "ANALYZER_RUN"
}
}
}
}
""",
"empty": """
submit_options: {
max_burst: 4
burst_delay: {
seconds: 480
}
}
config_groups: {
gerrit: {
url: "https://fuchsia-review.googlesource.com"
projects: {
name: "experiences"
ref_regexp: "refs/heads/.+"
}
}
verifiers: {
gerrit_cq_ability: {
committer_list: "project-fuchsia-committers"
dry_run_access_list: "project-fuchsia-tryjob-access"
}
tree_status: {
url: "https://fuchsia-stem-status.appspot.com"
}
}
}
""",
}
class CommitQueueTestApi(recipe_test_api.RecipeTestApi):
def test_data(self, project, data="default", config_name="commit-queue.cfg"):
if data in DEFAULT_COMMIT_QUEUE_CFGS:
data = DEFAULT_COMMIT_QUEUE_CFGS[data]
return self.m.luci_config.mock_config(project, config_name, data)