Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add refresh-mode value 'ignore-running' (#4749) #4800

Merged
merged 1 commit into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading