summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli/test_container.py
diff options
context:
space:
mode:
authormergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-09-09 17:01:04 +0300
committerGitHub <noreply@github.com>2024-09-09 17:01:04 +0300
commit92504cee34006f2198393a51efd93bea46346ec2 (patch)
treef2ee7d0f4e06ff822830af1e5c8eb8ee220ee702 /smoketest/scripts/cli/test_container.py
parentb2afa78d6f006e753be1fa07a640d14fe94a0b8f (diff)
downloadvyos-1x-92504cee34006f2198393a51efd93bea46346ec2.tar.gz
vyos-1x-92504cee34006f2198393a51efd93bea46346ec2.zip
container: T6702: re-add missing UNIX API socket (#4039)
During podman upgrade and a build from the original source the UNIX socket definition for systemd got lost in translation. This commit re-adds the UNIX socket which is started on boot to interact with Podman. Example: curl --unix-socket /run/podman/podman.sock -H 'content-type: application/json' \ -sf http://localhost/containers/json (cherry picked from commit f67e217f2716937115a3bdf6d316b172bbec75e5) Co-authored-by: Christian Breunig <christian@breunig.cc>
Diffstat (limited to 'smoketest/scripts/cli/test_container.py')
-rwxr-xr-xsmoketest/scripts/cli/test_container.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/test_container.py b/smoketest/scripts/cli/test_container.py
index 3dd97a175..5e33eba40 100755
--- a/smoketest/scripts/cli/test_container.py
+++ b/smoketest/scripts/cli/test_container.py
@@ -230,5 +230,23 @@ class TestContainer(VyOSUnitTestSHIM.TestCase):
tmp = cmd(f'sudo podman exec -it {cont_name} id -g')
self.assertEqual(tmp, gid)
+ def test_api_socket(self):
+ base_name = 'api-test'
+ container_list = range(1, 5)
+
+ for ii in container_list:
+ name = f'{base_name}-{ii}'
+ self.cli_set(base_path + ['name', name, 'image', cont_image])
+ self.cli_set(base_path + ['name', name, 'allow-host-networks'])
+
+ self.cli_commit()
+
+ # Query API about running containers
+ tmp = cmd("sudo curl --unix-socket /run/podman/podman.sock -H 'content-type: application/json' -sf http://localhost/containers/json")
+ tmp = json.loads(tmp)
+
+ # We expect the same amount of containers from the API that we started above
+ self.assertEqual(len(container_list), len(tmp))
+
if __name__ == '__main__':
unittest.main(verbosity=2)