github.com/rhatdan/docker@v0.7.7-0.20180119204836-47a0dcbcd20a/integration-cli/environment/environment.go (about) 1 package environment 2 3 import ( 4 "os" 5 6 "os/exec" 7 8 "github.com/docker/docker/internal/test/environment" 9 ) 10 11 var ( 12 // DefaultClientBinary is the name of the docker binary 13 DefaultClientBinary = os.Getenv("TEST_CLIENT_BINARY") 14 ) 15 16 func init() { 17 if DefaultClientBinary == "" { 18 DefaultClientBinary = "docker" 19 } 20 } 21 22 // Execution contains information about the current test execution and daemon 23 // under test 24 type Execution struct { 25 environment.Execution 26 dockerBinary string 27 } 28 29 // DockerBinary returns the docker binary for this testing environment 30 func (e *Execution) DockerBinary() string { 31 return e.dockerBinary 32 } 33 34 // New returns details about the testing environment 35 func New() (*Execution, error) { 36 env, err := environment.New() 37 if err != nil { 38 return nil, err 39 } 40 41 dockerBinary, err := exec.LookPath(DefaultClientBinary) 42 if err != nil { 43 return nil, err 44 } 45 46 return &Execution{ 47 Execution: *env, 48 dockerBinary: dockerBinary, 49 }, nil 50 }