mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
internal/testutil/daemon: fix minor linting issues
- rename vars that shadowed - suppress some unhandled errors Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -297,7 +297,7 @@ func (d *Daemon) NewClientT(t testing.TB, extraOpts ...client.Opt) *client.Clien
|
|||||||
|
|
||||||
c, err := d.NewClient(extraOpts...)
|
c, err := d.NewClient(extraOpts...)
|
||||||
assert.NilError(t, err, "[%s] could not create daemon client", d.id)
|
assert.NilError(t, err, "[%s] could not create daemon client", d.id)
|
||||||
t.Cleanup(func() { c.Close() })
|
t.Cleanup(func() { _ = c.Close() })
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -571,20 +571,20 @@ func (d *Daemon) StartWithLogFile(out *os.File, providedArgs ...string) error {
|
|||||||
close(wait)
|
close(wait)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
clientConfig, err := d.getClientConfig()
|
clientCfg, err := d.getClientConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
client := &http.Client{
|
httpClient := &http.Client{
|
||||||
Transport: clientConfig.transport,
|
Transport: clientCfg.transport,
|
||||||
}
|
}
|
||||||
|
|
||||||
req, err := http.NewRequest(http.MethodGet, "/_ping", http.NoBody)
|
req, err := http.NewRequest(http.MethodGet, "/_ping", http.NoBody)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "[%s] could not create new request", d.id)
|
return errors.Wrapf(err, "[%s] could not create new request", d.id)
|
||||||
}
|
}
|
||||||
req.URL.Host = clientConfig.addr
|
req.URL.Host = clientCfg.addr
|
||||||
req.URL.Scheme = clientConfig.scheme
|
req.URL.Scheme = clientCfg.scheme
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
@@ -602,7 +602,7 @@ func (d *Daemon) StartWithLogFile(out *os.File, providedArgs ...string) error {
|
|||||||
rctx, rcancel := context.WithTimeout(context.TODO(), 2*time.Second)
|
rctx, rcancel := context.WithTimeout(context.TODO(), 2*time.Second)
|
||||||
defer rcancel()
|
defer rcancel()
|
||||||
|
|
||||||
resp, err := client.Do(req.WithContext(rctx))
|
resp, err := httpClient.Do(req.WithContext(rctx))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if i > 2 { // don't log the first couple, this ends up just being noise
|
if i > 2 { // don't log the first couple, this ends up just being noise
|
||||||
d.log.Logf("[%s] error pinging daemon on start: %v", d.id, err)
|
d.log.Logf("[%s] error pinging daemon on start: %v", d.id, err)
|
||||||
@@ -615,7 +615,7 @@ func (d *Daemon) StartWithLogFile(out *os.File, providedArgs ...string) error {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
resp.Body.Close()
|
_ = resp.Body.Close()
|
||||||
if resp.StatusCode != http.StatusOK {
|
if resp.StatusCode != http.StatusOK {
|
||||||
d.log.Logf("[%s] received status != 200 OK: %s\n", d.id, resp.Status)
|
d.log.Logf("[%s] received status != 200 OK: %s\n", d.id, resp.Status)
|
||||||
}
|
}
|
||||||
@@ -644,7 +644,7 @@ func (d *Daemon) Kill() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
d.logFile.Close()
|
_ = d.logFile.Close()
|
||||||
d.cmd = nil
|
d.cmd = nil
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@@ -1062,7 +1062,7 @@ func cleanupRaftDir(t testing.TB, d *Daemon) {
|
|||||||
// artifacts.
|
// artifacts.
|
||||||
//
|
//
|
||||||
// We currently do not include container logs in the bundles, so this also
|
// We currently do not include container logs in the bundles, so this also
|
||||||
// removes the "containers" sub-directory.
|
// removes the "containers" subdirectory.
|
||||||
func cleanupDaemonStorage(t testing.TB, d *Daemon) {
|
func cleanupDaemonStorage(t testing.TB, d *Daemon) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
dirs := []string{
|
dirs := []string{
|
||||||
|
|||||||
Reference in New Issue
Block a user