github.com/jaegerpicker/docker@v0.7.7-0.20150325003727-22dba32b4dab/integration-cli/docker_cli_version_test.go (about) 1 package main 2 3 import ( 4 "os/exec" 5 "strings" 6 "testing" 7 ) 8 9 // ensure docker version works 10 func TestVersionEnsureSucceeds(t *testing.T) { 11 versionCmd := exec.Command(dockerBinary, "version") 12 out, _, err := runCommandWithOutput(versionCmd) 13 if err != nil { 14 t.Fatalf("failed to execute docker version: %s, %v", out, err) 15 } 16 17 stringsToCheck := []string{ 18 "Client version:", 19 "Client API version:", 20 "Go version (client):", 21 "Git commit (client):", 22 "OS/Arch (client):", 23 "Server version:", 24 "Server API version:", 25 "Go version (server):", 26 "Git commit (server):", 27 "OS/Arch (server):", 28 } 29 30 for _, linePrefix := range stringsToCheck { 31 if !strings.Contains(out, linePrefix) { 32 t.Errorf("couldn't find string %v in output", linePrefix) 33 } 34 } 35 36 logDone("version - verify that it works and that the output is properly formatted") 37 }