Skip to content

Commit

Permalink
feat: add refresh-mode value 'ignore-running' (#4749)
Browse files Browse the repository at this point in the history
Snapd 2.57 allows a new value for `refresh-mode` named `ignore-running`.
See canonical/snapd@33acdb6

Signed-off-by: Callahan Kovacs <callahan.kovacs@canonical.com>
  • Loading branch information
mr-cal authored Apr 29, 2024
1 parent d9001c7 commit a76f85a
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 @@ -372,7 +372,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 @@ -938,7 +938,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 a76f85a

Please sign in to comment.