1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
import getpass
import unittest
import time
from podman import PodmanClient
from podman.tests.integration import base, utils
class AdapterIntegrationTest(base.IntegrationTest):
def setUp(self):
super().setUp()
@unittest.skip('Does not work in Salsa CI')
def test_ssh_ping(self):
with PodmanClient(
base_url=f"http+ssh://{getpass.getuser()}@localhost:22{self.socket_file}"
) as client:
self.assertTrue(client.ping())
with PodmanClient(
base_url=f"ssh://{getpass.getuser()}@localhost:22{self.socket_file}"
) as client:
self.assertTrue(client.ping())
def test_unix_ping(self):
with PodmanClient(base_url=f"unix://{self.socket_file}") as client:
self.assertTrue(client.ping())
with PodmanClient(base_url=f"http+unix://{self.socket_file}") as client:
self.assertTrue(client.ping())
def test_tcp_ping(self):
podman = utils.PodmanLauncher(
"tcp:localhost:8889",
podman_path=base.IntegrationTest.podman,
log_level=self.log_level,
)
try:
podman.start(check_socket=False)
time.sleep(0.5)
with PodmanClient(base_url="tcp:localhost:8889") as client:
self.assertTrue(client.ping())
with PodmanClient(base_url="http://localhost:8889") as client:
self.assertTrue(client.ping())
finally:
podman.stop()
if __name__ == '__main__':
unittest.main()
|