Esempio n. 1
0
    def test_setup_for_fails(self):
        (flexmock(subprocess).should_receive("check_output").and_raise(
            subprocess.CalledProcessError(1, ["podman", "..."],
                                          output=b'something went wrong')))

        err_msg = "Failed to set up podman-remote connection: something went wrong"

        with pytest.raises(BuildTaskError, match=err_msg):
            PodmanRemote.setup_for(X86_LOCKED_RESOURCE)
Esempio n. 2
0
    def test_setup_for(self):
        resource = X86_LOCKED_RESOURCE
        expect_cmd = [
            "/usr/bin/podman",
            "system",
            "connection",
            "add",
            "--identity=/workspace/ws-remote-host-auth/remote-host-auth",
            "--socket-path=/run/user/2022/podman/podman.sock",
            PIPELINE_RUN_NAME,
            "ssh://[email protected]",
        ]
        (flexmock(subprocess).should_receive("check_output").with_args(
            expect_cmd, stderr=subprocess.STDOUT).once())

        podman_remote = PodmanRemote.setup_for(resource)
        assert podman_remote._connection_name == PIPELINE_RUN_NAME