docker_cli_pull_test.go 978 B

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