Skip to content

Commit

Permalink
Don't request stop_autorebuild_if_disabled plugin unless there are tr…
Browse files Browse the repository at this point in the history
…iggers
  • Loading branch information
twaugh committed Nov 19, 2015
1 parent 2d613a9 commit 5116670
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions osbs/build/build_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ def adjust_for_triggers(self):
triggers = self.template['spec'].get('triggers', [])
if len(triggers) == 0:
for when, which in [("prebuild_plugins", "check_and_set_rebuild"),
("prebuild_plugins", "stop_autorebuild_if_disabled"),
("prebuild_plugins", "bump_release"),
("postbuild_plugins", "import_image"),
("exit_plugins", "koji_promote")]:
Expand Down
20 changes: 20 additions & 0 deletions tests/build/test_build_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ def test_render_prod_request_with_repo(self, architecture):

with pytest.raises(NoSuchPluginException):
get_plugin(plugins, "prebuild_plugins", "check_and_set_rebuild")
with pytest.raises(NoSuchPluginException):
get_plugin(plugins, "prebuild_plugins",
"stop_autorebuild_if_disabled")
with pytest.raises(NoSuchPluginException):
get_plugin(plugins, "prebuild_plugins", "bump_release")
assert plugin_value_get(plugins, "prebuild_plugins", "distgit_fetch_artefacts",
Expand Down Expand Up @@ -309,6 +312,9 @@ def test_render_prod_request(self):

with pytest.raises(NoSuchPluginException):
get_plugin(plugins, "prebuild_plugins", "check_and_set_rebuild")
with pytest.raises(NoSuchPluginException):
get_plugin(plugins, "prebuild_plugins",
"stop_autorebuild_if_disabled")
with pytest.raises(NoSuchPluginException):
get_plugin(plugins, "prebuild_plugins", "bump_release")
assert plugin_value_get(plugins, "prebuild_plugins", "distgit_fetch_artefacts",
Expand Down Expand Up @@ -395,6 +401,9 @@ def test_render_prod_without_koji_request(self):

with pytest.raises(NoSuchPluginException):
get_plugin(plugins, "prebuild_plugins", "check_and_set_rebuild")
with pytest.raises(NoSuchPluginException):
get_plugin(plugins, "prebuild_plugins",
"stop_autorebuild_if_disabled")
with pytest.raises(NoSuchPluginException):
get_plugin(plugins, "prebuild_plugins", "bump_release")
assert plugin_value_get(plugins, "prebuild_plugins", "distgit_fetch_artefacts",
Expand Down Expand Up @@ -476,6 +485,9 @@ def test_render_prod_with_secret_request(self):

with pytest.raises(NoSuchPluginException):
get_plugin(plugins, "prebuild_plugins", "check_and_set_rebuild")
with pytest.raises(NoSuchPluginException):
get_plugin(plugins, "prebuild_plugins",
"stop_autorebuild_if_disabled")
with pytest.raises(NoSuchPluginException):
get_plugin(plugins, "prebuild_plugins", "bump_release")
assert get_plugin(plugins, "prebuild_plugins", "koji")
Expand Down Expand Up @@ -721,6 +733,9 @@ def test_render_with_yum_repourls(self):

with pytest.raises(NoSuchPluginException):
get_plugin(plugins, "prebuild_plugins", "check_and_set_rebuild")
with pytest.raises(NoSuchPluginException):
get_plugin(plugins, "prebuild_plugins",
"stop_autorebuild_if_disabled")
with pytest.raises(NoSuchPluginException):
get_plugin(plugins, "prebuild_plugins", "bump_release")
with pytest.raises(NoSuchPluginException):
Expand Down Expand Up @@ -865,6 +880,8 @@ def test_render_prod_request_with_trigger(self, tmpdir, params):

plugins = json.loads(plugins_json)
assert get_plugin(plugins, "prebuild_plugins", "check_and_set_rebuild")
assert get_plugin(plugins, "prebuild_plugins",
"stop_autorebuild_if_disabled")
assert plugin_value_get(plugins, "prebuild_plugins",
"check_and_set_rebuild", "args",
"url") == kwargs["openshift_uri"]
Expand Down Expand Up @@ -951,6 +968,9 @@ def test_render_prod_request_trigger_missing_param(self, tmpdir, missing):
plugins = json.loads(plugins_json)
with pytest.raises(NoSuchPluginException):
get_plugin(plugins, "prebuild_plugins", "check_and_set_rebuild")
with pytest.raises(NoSuchPluginException):
get_plugin(plugins, "prebuild_plugins",
"stop_autorebuild_if_disabled")
with pytest.raises(NoSuchPluginException):
get_plugin(plugins, "prebuild_plugins", "bump_release")
with pytest.raises(NoSuchPluginException):
Expand Down

0 comments on commit 5116670

Please sign in to comment.