2014-02-25 11:17:48 -05:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os/exec"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
2014-09-23 18:58:05 -04:00
|
|
|
// FIXME: we need a test for pulling all aliases for an image (issue #8141)
|
|
|
|
|
2014-02-25 11:17:48 -05:00
|
|
|
// pulling an image from the central registry should work
|
|
|
|
func TestPullImageFromCentralRegistry(t *testing.T) {
|
2014-09-22 11:38:12 -04:00
|
|
|
pullCmd := exec.Command(dockerBinary, "pull", "scratch")
|
2014-10-14 17:09:40 -04:00
|
|
|
if out, _, err := runCommandWithOutput(pullCmd); err != nil {
|
2014-11-05 11:26:22 -05:00
|
|
|
t.Fatalf("pulling the scratch image from the registry has failed: %s, %v", out, err)
|
2014-02-25 11:17:48 -05:00
|
|
|
}
|
2014-09-23 18:58:05 -04:00
|
|
|
logDone("pull - pull scratch")
|
2014-02-25 11:17:48 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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")
|
2014-10-14 17:09:40 -04:00
|
|
|
if out, _, err := runCommandWithOutput(pullCmd); err == nil {
|
2014-11-05 11:26:22 -05:00
|
|
|
t.Fatalf("expected non-zero exit status when pulling non-existing image: %s", out)
|
2014-02-25 11:17:48 -05:00
|
|
|
}
|
|
|
|
logDone("pull - pull fooblahblah1234 (non-existing image)")
|
|
|
|
}
|