summaryrefslogtreecommitdiff
path: root/integration-cli/docker_cli_pull_test.go
blob: 13b443f3d668e21a44784096603696ee6a57ede8 (plain)
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
package main

import (
	"fmt"
	"os/exec"
	"testing"
)

// pulling an image from the central registry should work
func TestPullImageFromCentralRegistry(t *testing.T) {
	pullCmd := exec.Command(dockerBinary, "pull", "busybox")
	out, exitCode, err := runCommandWithOutput(pullCmd)
	errorOut(err, t, fmt.Sprintf("%s %s", out, err))

	if err != nil || exitCode != 0 {
		t.Fatal("pulling the busybox image from the registry has failed")
	}
	logDone("pull - pull busybox")
}

// pulling a non-existing image from the central registry should return a non-zero exit code
func TestPullNonExistingImage(t *testing.T) {
	pullCmd := exec.Command(dockerBinary, "pull", "fooblahblah1234")
	_, exitCode, err := runCommandWithOutput(pullCmd)

	if err == nil || exitCode == 0 {
		t.Fatal("expected non-zero exit status when pulling non-existing image")
	}
	logDone("pull - pull fooblahblah1234 (non-existing image)")
}