github.com/squaremo/docker@v1.3.2-0.20150516120342-42cfc9554972/integration-cli/docker_cli_version_test.go (about)

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