Skip to content

Commit

Permalink
Fix conflicts.
Browse files Browse the repository at this point in the history
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
  • Loading branch information
jessfraz committed Dec 12, 2014
1 parent c509835 commit fd831b4
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 4 deletions.
67 changes: 67 additions & 0 deletions integration-cli/docker_cli_save_load_test.go
Expand Up @@ -171,6 +171,73 @@ func TestSaveXzAndLoadRepoStdout(t *testing.T) {
logDone("load - save a repo with xz compression & load it using stdout")
}

// save a repo using xz+gz compression and try to load it using stdout
func TestSaveXzGzAndLoadRepoStdout(t *testing.T) {
tempDir, err := ioutil.TempDir("", "test-save-xz-gz-load-repo-stdout")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(tempDir)

tarballPath := filepath.Join(tempDir, "foobar-save-load-test.tar.xz.gz")

runCmd := exec.Command(dockerBinary, "run", "-d", "busybox", "true")
out, _, err := runCommandWithOutput(runCmd)
if err != nil {
t.Fatalf("failed to create a container: %v %v", out, err)
}

cleanedContainerID := stripTrailingCharacters(out)

repoName := "foobar-save-load-test-xz-gz"

inspectCmd := exec.Command(dockerBinary, "inspect", cleanedContainerID)
out, _, err = runCommandWithOutput(inspectCmd)
if err != nil {
t.Fatalf("output should've been a container id: %v %v", cleanedContainerID, err)
}

commitCmd := exec.Command(dockerBinary, "commit", cleanedContainerID, repoName)
out, _, err = runCommandWithOutput(commitCmd)
if err != nil {
t.Fatalf("failed to commit container: %v %v", out, err)
}

inspectCmd = exec.Command(dockerBinary, "inspect", repoName)
before, _, err := runCommandWithOutput(inspectCmd)
if err != nil {
t.Fatalf("the repo should exist before saving it: %v %v", before, err)
}

saveCmdTemplate := `%v save %v | xz -c | gzip -c > %s`
saveCmdFinal := fmt.Sprintf(saveCmdTemplate, dockerBinary, repoName, tarballPath)
saveCmd := exec.Command("bash", "-c", saveCmdFinal)
out, _, err = runCommandWithOutput(saveCmd)
if err != nil {
t.Fatalf("failed to save repo: %v %v", out, err)
}

deleteImages(repoName)

loadCmdFinal := fmt.Sprintf(`cat %s | docker load`, tarballPath)
loadCmd := exec.Command("bash", "-c", loadCmdFinal)
out, _, err = runCommandWithOutput(loadCmd)
if err == nil {
t.Fatalf("expected error, but succeeded with no error and output: %v", out)
}

inspectCmd = exec.Command(dockerBinary, "inspect", repoName)
after, _, err := runCommandWithOutput(inspectCmd)
if err == nil {
t.Fatalf("the repo should not exist: %v", after)
}

deleteContainer(cleanedContainerID)
deleteImages(repoName)

logDone("load - save a repo with xz+gz compression & load it using stdout")
}

func TestSaveSingleTag(t *testing.T) {
repoName := "foobar-save-single-tag-test"

Expand Down
4 changes: 0 additions & 4 deletions registry/registry.go
Expand Up @@ -47,10 +47,6 @@ func newClient(jar http.CookieJar, roots *x509.CertPool, certs []tls.Certificate
tlsConfig.InsecureSkipVerify = true
}

if !secure {
tlsConfig.InsecureSkipVerify = true
}

httpTransport := &http.Transport{
DisableKeepAlives: true,
Proxy: http.ProxyFromEnvironment,
Expand Down

0 comments on commit fd831b4

Please sign in to comment.