@@ -127,9 +127,11 @@ func NewDaemon(workingDir string, ops ...Option) (*Daemon, error) {
127127
128128 userlandProxy := true
129129 if env := os .Getenv ("DOCKER_USERLANDPROXY" ); env != "" {
130- if val , err := strconv .ParseBool (env ); err != nil {
131- userlandProxy = val
130+ val , err := strconv .ParseBool (env )
131+ if err != nil {
132+ return nil , errors .Wrap (err , "failed to parse DOCKER_USERLANDPROXY" )
132133 }
134+ userlandProxy = val
133135 }
134136 d := & Daemon {
135137 id : id ,
@@ -214,10 +216,9 @@ func New(t testing.TB, ops ...Option) *Daemon {
214216 if dest == "" {
215217 dest = os .Getenv ("DEST" )
216218 }
219+ assert .Assert (t , dest != "" , "Please set the DOCKER_INTEGRATION_DAEMON_DEST or the DEST environment variable" )
217220 dest = filepath .Join (dest , t .Name ())
218221
219- assert .Check (t , dest != "" , "Please set the DOCKER_INTEGRATION_DAEMON_DEST or the DEST environment variable" )
220-
221222 if os .Getenv ("DOCKER_ROOTLESS" ) != "" {
222223 if os .Getenv ("DOCKER_REMAP_ROOT" ) != "" {
223224 t .Skip ("DOCKER_ROOTLESS doesn't support DOCKER_REMAP_ROOT currently" )
@@ -410,6 +411,9 @@ func (d *Daemon) ScanLogs(ctx context.Context, match func(s string) bool) (bool,
410411
411412// TailLogs tails N lines from the daemon logs
412413func (d * Daemon ) TailLogs (n int ) ([][]byte , error ) {
414+ if d .logFile == nil {
415+ return nil , errors .New ("d.logFile is nil" )
416+ }
413417 logF , err := os .Open (d .logFile .Name ())
414418 if err != nil {
415419 return nil , errors .Wrap (err , "error opening daemon log file after failed start" )
0 commit comments