2018-04-19 05:14:15 -04:00
|
|
|
// +build !windows
|
|
|
|
|
2018-02-08 17:16:20 -05:00
|
|
|
package logging
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/docker/docker/api/types"
|
2019-08-29 16:52:40 -04:00
|
|
|
"github.com/docker/docker/testutil/daemon"
|
2018-06-11 09:32:11 -04:00
|
|
|
"gotest.tools/assert"
|
|
|
|
"gotest.tools/skip"
|
2018-02-08 17:16:20 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
// Regression test for #35553
|
|
|
|
// Ensure that a daemon with a log plugin set as the default logger for containers
|
|
|
|
// does not keep the daemon from starting.
|
|
|
|
func TestDaemonStartWithLogOpt(t *testing.T) {
|
2018-04-25 05:03:43 -04:00
|
|
|
skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon")
|
2018-04-19 05:14:15 -04:00
|
|
|
skip.If(t, testEnv.DaemonInfo.OSType == "windows")
|
2018-02-08 17:16:20 -05:00
|
|
|
t.Parallel()
|
|
|
|
|
2018-04-10 10:29:48 -04:00
|
|
|
d := daemon.New(t)
|
2018-02-08 17:16:20 -05:00
|
|
|
d.Start(t, "--iptables=false")
|
|
|
|
defer d.Stop(t)
|
|
|
|
|
2018-12-22 09:53:02 -05:00
|
|
|
c := d.NewClientT(t)
|
2018-02-08 17:16:20 -05:00
|
|
|
ctx := context.Background()
|
|
|
|
|
2018-12-22 09:53:02 -05:00
|
|
|
createPlugin(t, c, "test", "dummy", asLogDriver)
|
|
|
|
err := c.PluginEnable(ctx, "test", types.PluginEnableOptions{Timeout: 30})
|
2018-03-13 15:28:34 -04:00
|
|
|
assert.Check(t, err)
|
2018-12-22 09:53:02 -05:00
|
|
|
defer c.PluginRemove(ctx, "test", types.PluginRemoveOptions{Force: true})
|
2018-02-08 17:16:20 -05:00
|
|
|
|
|
|
|
d.Stop(t)
|
|
|
|
d.Start(t, "--iptables=false", "--log-driver=test", "--log-opt=foo=bar")
|
|
|
|
}
|