Esempio n. 1
0
    def test_push_container_fails(self):
        (flexmock(retries).should_receive("run_cmd").and_raise(
            subprocess.CalledProcessError(1, 'some command')))

        podman_remote = PodmanRemote("connection-name")

        err_msg = r"Push failed \(rc=1\). Check the logs for more details."

        with pytest.raises(PushError, match=err_msg):
            podman_remote.push_container(X86_UNIQUE_IMAGE)
    def test_push_container(self, authfile, insecure):
        expect_cmd = [
            "/usr/bin/podman",
            "--remote",
            "--connection=connection-name",
            "push",
            "--format=v2s2",
            str(X86_UNIQUE_IMAGE),
        ]
        if authfile:
            expect_cmd.insert(-1, f"--authfile={authfile}")
        if insecure:
            expect_cmd.insert(-1, "--tls-verify=false")

        flexmock(retries).should_receive("run_cmd").with_args(expect_cmd).once()

        podman_remote = PodmanRemote("connection-name", registries_authfile=authfile)
        podman_remote.push_container(X86_UNIQUE_IMAGE, insecure=insecure)