Browse code

Export the LogT type and use it in the options

Signed-off-by: Sam Whited <sam@samwhited.com>

Sam Whited authored on 2019/10/17 05:27:22
Showing 2 changed files
... ...
@@ -28,11 +28,12 @@ import (
28 28
 	"gotest.tools/assert"
29 29
 )
30 30
 
31
-type logT interface {
31
+// LogT is the subset of the testing.TB interface used by the daemon.
32
+type LogT interface {
32 33
 	Logf(string, ...interface{})
33 34
 }
34 35
 
35
-// nopLog is a no-op implementation of logT that is used in daemons created by
36
+// nopLog is a no-op implementation of LogT that is used in daemons created by
36 37
 // NewDaemon (where no testing.TB is available).
37 38
 type nopLog struct{}
38 39
 
... ...
@@ -71,7 +72,7 @@ type Daemon struct {
71 71
 	experimental               bool
72 72
 	init                       bool
73 73
 	dockerdBinary              string
74
-	log                        logT
74
+	log                        LogT
75 75
 	pidFile                    string
76 76
 	args                       []string
77 77
 
... ...
@@ -1,8 +1,6 @@
1 1
 package daemon
2 2
 
3 3
 import (
4
-	"testing"
5
-
6 4
 	"github.com/docker/docker/testutil/environment"
7 5
 )
8 6
 
... ...
@@ -17,7 +15,7 @@ func WithDefaultCgroupNamespaceMode(mode string) Option {
17 17
 }
18 18
 
19 19
 // WithTestLogger causes the daemon to log certain actions to the provided test.
20
-func WithTestLogger(t testing.TB) Option {
20
+func WithTestLogger(t LogT) Option {
21 21
 	return func(d *Daemon) {
22 22
 		d.log = t
23 23
 	}