diff options
| author | Michal Nasiadka <mnasiadka@gmail.com> | 2023-04-27 11:41:55 +0200 |
|---|---|---|
| committer | Michal Nasiadka <mnasiadka@gmail.com> | 2023-11-14 15:17:50 +0000 |
| commit | cea076f3795010f3b870371d2ebd5d906ec81202 (patch) | |
| tree | ffefee7b4c7d77d73e6bb3efc935a96de05280b2 /tests | |
| parent | e545515e501ff970db147ced3b48a3a5241f2baf (diff) | |
| download | kolla-ansible-cea076f3795010f3b870371d2ebd5d906ec81202.tar.gz kolla-ansible-cea076f3795010f3b870371d2ebd5d906ec81202.zip | |
Introduce oneshot docker_restart_policy
docker_restart_policy: no causes systemd units to not get created
and we use it in CI to disable restarts on services.
Introducing oneshot policy to not create systemd unit for oneshot
containers (those that are running bootstrap tasks, like db
bootstrap and don't need a systemd unit), but still create systemd
units for long lived containers but with Restart=No.
Change-Id: I9e0d656f19143ec2fcad7d6d345b2c9387551604
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/kolla_docker_tests/test_docker_worker.py | 6 | ||||
| -rw-r--r-- | tests/kolla_docker_tests/test_podman_worker.py | 4 | ||||
| -rw-r--r-- | tests/test_kolla_docker.py | 1 |
3 files changed, 6 insertions, 5 deletions
diff --git a/tests/kolla_docker_tests/test_docker_worker.py b/tests/kolla_docker_tests/test_docker_worker.py index 08125e359..550882e88 100644 --- a/tests/kolla_docker_tests/test_docker_worker.py +++ b/tests/kolla_docker_tests/test_docker_worker.py @@ -478,7 +478,7 @@ class TestContainer(base.BaseTestCase): def test_start_container_no_systemd(self): self.fake_data['params'].update({'name': 'my_container', - 'restart_policy': 'no', + 'restart_policy': 'oneshot', 'auth_username': 'fake_user', 'auth_password': 'fake_psw', 'auth_registry': 'myrepo/myapp', @@ -537,7 +537,7 @@ class TestContainer(base.BaseTestCase): def test_stop_container_no_systemd(self): self.dw = get_DockerWorker({'name': 'my_container', 'action': 'stop_container', - 'restart_policy': 'no'}) + 'restart_policy': 'oneshot'}) self.dw.dc.containers.return_value = self.fake_data['containers'] self.dw.systemd.check_unit_file.return_value = False self.dw.stop_container() @@ -624,7 +624,7 @@ class TestContainer(base.BaseTestCase): def test_restart_container_no_systemd(self): self.dw = get_DockerWorker({'name': 'my_container', 'action': 'stop_container', - 'restart_policy': 'no'}) + 'restart_policy': 'oneshot'}) self.dw.dc.containers.return_value = self.fake_data['containers'] self.fake_data['container_inspect'].update( self.fake_data['containers'][0]) diff --git a/tests/kolla_docker_tests/test_podman_worker.py b/tests/kolla_docker_tests/test_podman_worker.py index 5258f05eb..7f8ca6b80 100644 --- a/tests/kolla_docker_tests/test_podman_worker.py +++ b/tests/kolla_docker_tests/test_podman_worker.py @@ -373,7 +373,7 @@ class TestContainer(base.BaseTestCase): def test_start_container_no_systemd(self): self.fake_data['params'].update({'name': 'my_container', - 'restart_policy': 'no', + 'restart_policy': 'oneshot', 'auth_username': 'fake_user', 'auth_password': 'fake_psw', 'auth_registry': 'myrepo/myapp', @@ -437,7 +437,7 @@ class TestContainer(base.BaseTestCase): def test_stop_container_no_systemd(self): self.pw = get_PodmanWorker({'name': 'my_container', 'action': 'stop_container', - 'restart_policy': 'no'}) + 'restart_policy': 'oneshot'}) full_cont_list = get_containers(self.fake_data['containers']) container = full_cont_list[0] self.pw.pc.containers.list.return_value = full_cont_list diff --git a/tests/test_kolla_docker.py b/tests/test_kolla_docker.py index f7a2d2251..2d398d5cb 100644 --- a/tests/test_kolla_docker.py +++ b/tests/test_kolla_docker.py @@ -83,6 +83,7 @@ class ModuleArgsTest(base.BaseTestCase): restart_policy=dict( required=False, type='str', choices=['no', 'on-failure', + 'oneshot', 'always', 'unless-stopped']), restart_retries=dict(required=False, type='int'), |
