docker_cli_search_test.go 643 B

12345678910111213141516171819202122232425
  1. package main
  2. import (
  3. "fmt"
  4. "os/exec"
  5. "strings"
  6. "testing"
  7. )
  8. // search for repos named "registry" on the central registry
  9. func TestSearchOnCentralRegistry(t *testing.T) {
  10. searchCmd := exec.Command(dockerBinary)
  11. out, exitCode, err := runCommandWithOutput(searchCmd)
  12. errorOut(err, t, fmt.Sprintf("encountered error while searching: %v", err))
  13. if err != nil || exitCode != 0 {
  14. t.Fatal("failed to search on the central registry")
  15. }
  16. if !strings.Contains(out, "registry") {
  17. t.Fatal("couldn't find any repository named (or containing) 'registry'")
  18. }
  19. logDone("search - search for repositories named (or containing) 'registry'")
  20. }