mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Export the LogT type and use it in the options
Signed-off-by: Sam Whited <sam@samwhited.com>
This commit is contained in:
parent
f5bb374a0c
commit
95ea6e7069
2 changed files with 5 additions and 6 deletions
|
@ -28,11 +28,12 @@ import (
|
||||||
"gotest.tools/assert"
|
"gotest.tools/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
type logT interface {
|
// LogT is the subset of the testing.TB interface used by the daemon.
|
||||||
|
type LogT interface {
|
||||||
Logf(string, ...interface{})
|
Logf(string, ...interface{})
|
||||||
}
|
}
|
||||||
|
|
||||||
// nopLog is a no-op implementation of logT that is used in daemons created by
|
// nopLog is a no-op implementation of LogT that is used in daemons created by
|
||||||
// NewDaemon (where no testing.TB is available).
|
// NewDaemon (where no testing.TB is available).
|
||||||
type nopLog struct{}
|
type nopLog struct{}
|
||||||
|
|
||||||
|
@ -71,7 +72,7 @@ type Daemon struct {
|
||||||
experimental bool
|
experimental bool
|
||||||
init bool
|
init bool
|
||||||
dockerdBinary string
|
dockerdBinary string
|
||||||
log logT
|
log LogT
|
||||||
pidFile string
|
pidFile string
|
||||||
args []string
|
args []string
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package daemon
|
package daemon
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/docker/docker/testutil/environment"
|
"github.com/docker/docker/testutil/environment"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -17,7 +15,7 @@ func WithDefaultCgroupNamespaceMode(mode string) Option {
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithTestLogger causes the daemon to log certain actions to the provided test.
|
// WithTestLogger causes the daemon to log certain actions to the provided test.
|
||||||
func WithTestLogger(t testing.TB) Option {
|
func WithTestLogger(t LogT) Option {
|
||||||
return func(d *Daemon) {
|
return func(d *Daemon) {
|
||||||
d.log = t
|
d.log = t
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue