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