Skip to content

Commit

Permalink
feat: add refresh-mode value 'ignore-running' (#4749) (#4800)
Browse files Browse the repository at this point in the history
Signed-off-by: Callahan Kovacs <callahan.kovacs@canonical.com>
  • Loading branch information
mr-cal authored May 9, 2024
1 parent 48483c4 commit f6451b6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion schema/snapcraft.json
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,8 @@
"description": "controls if the app should be restarted at all",
"enum": [
"endure",
"restart"
"restart",
"ignore-running"
]
},
"stop-mode": {
Expand Down
2 changes: 1 addition & 1 deletion snapcraft/models/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ class App(models.CraftBaseModel):
daemon: Optional[Literal["simple", "forking", "oneshot", "notify", "dbus"]]
after: UniqueStrList = cast(UniqueStrList, [])
before: UniqueStrList = cast(UniqueStrList, [])
refresh_mode: Optional[Literal["endure", "restart"]]
refresh_mode: Optional[Literal["endure", "restart", "ignore-running"]]
stop_mode: Optional[
Literal[
"sigterm",
Expand Down
2 changes: 1 addition & 1 deletion tests/legacy/unit/project/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ def test_valid_restart_conditions(data, condition):
Validator(data).validate()


_REFRESH_MODES = ["endure", "restart"]
_REFRESH_MODES = ["endure", "restart", "ignore-running"]


@pytest.mark.parametrize("mode", _REFRESH_MODES)
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/models/test_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,9 @@ def test_app_duplicate_before(self, app_yaml_data):
with pytest.raises(errors.ProjectValidationError, match=error):
Project.unmarshal(data)

@pytest.mark.parametrize("refresh_mode", ["endure", "restart", "_invalid"])
@pytest.mark.parametrize(
"refresh_mode", ["endure", "restart", "ignore-running", "_invalid"]
)
def test_app_refresh_mode(self, refresh_mode, app_yaml_data):
data = app_yaml_data(refresh_mode=refresh_mode)

Expand Down

0 comments on commit f6451b6

Please sign in to comment.