docker_cli_pull_test.go 902 B

1234567891011121314151617181920212223242526
  1. package main
  2. import (
  3. "os/exec"
  4. "testing"
  5. )
  6. // FIXME: we need a test for pulling all aliases for an image (issue #8141)
  7. // pulling an image from the central registry should work
  8. func TestPullImageFromCentralRegistry(t *testing.T) {
  9. pullCmd := exec.Command(dockerBinary, "pull", "scratch")
  10. if out, _, err := runCommandWithOutput(pullCmd); err != nil {
  11. t.Fatalf("pulling the scratch image from the registry has failed: %s, %v", out, err)
  12. }
  13. logDone("pull - pull scratch")
  14. }
  15. // pulling a non-existing image from the central registry should return a non-zero exit code
  16. func TestPullNonExistingImage(t *testing.T) {
  17. pullCmd := exec.Command(dockerBinary, "pull", "fooblahblah1234")
  18. if out, _, err := runCommandWithOutput(pullCmd); err == nil {
  19. t.Fatalf("expected non-zero exit status when pulling non-existing image: %s", out)
  20. }
  21. logDone("pull - pull fooblahblah1234 (non-existing image)")
  22. }