From 1fbaf6ee8b6cd0c149472bf465bbffb4e78f8b96 Mon Sep 17 00:00:00 2001 From: John Howard Date: Fri, 11 Mar 2016 19:31:08 -0800 Subject: [PATCH] Windows CI: Fix unit test failures Signed-off-by: John Howard --- docker/daemon_test.go | 47 -------------------------------------- docker/daemon_unix_test.go | 47 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 47 deletions(-) diff --git a/docker/daemon_test.go b/docker/daemon_test.go index d35174ea5f..c568bdb1ce 100644 --- a/docker/daemon_test.go +++ b/docker/daemon_test.go @@ -35,53 +35,6 @@ func TestLoadDaemonCliConfigWithoutOverriding(t *testing.T) { } } -func TestLoadDaemonCliConfigWithDaemonFlags(t *testing.T) { - c := &daemon.Config{} - common := &cli.CommonFlags{ - Debug: true, - LogLevel: "info", - } - - f, err := ioutil.TempFile("", "docker-config-") - if err != nil { - t.Fatal(err) - } - - configFile := f.Name() - f.Write([]byte(`{"log-opts": {"max-size": "1k"}}`)) - f.Close() - - flags := mflag.NewFlagSet("test", mflag.ContinueOnError) - flags.String([]string{daemonConfigFileFlag}, "", "") - flags.BoolVar(&c.EnableSelinuxSupport, []string{"-selinux-enabled"}, true, "") - flags.StringVar(&c.LogConfig.Type, []string{"-log-driver"}, "json-file", "") - flags.Var(opts.NewNamedMapOpts("log-opts", c.LogConfig.Config, nil), []string{"-log-opt"}, "") - flags.Set(daemonConfigFileFlag, configFile) - - loadedConfig, err := loadDaemonCliConfig(c, flags, common, configFile) - if err != nil { - t.Fatal(err) - } - if loadedConfig == nil { - t.Fatalf("expected configuration %v, got nil", c) - } - if !loadedConfig.Debug { - t.Fatalf("expected debug mode, got false") - } - if loadedConfig.LogLevel != "info" { - t.Fatalf("expected info log level, got %v", loadedConfig.LogLevel) - } - if !loadedConfig.EnableSelinuxSupport { - t.Fatalf("expected enabled selinux support, got disabled") - } - if loadedConfig.LogConfig.Type != "json-file" { - t.Fatalf("expected LogConfig type json-file, got %v", loadedConfig.LogConfig.Type) - } - if maxSize := loadedConfig.LogConfig.Config["max-size"]; maxSize != "1k" { - t.Fatalf("expected log max-size `1k`, got %s", maxSize) - } -} - func TestLoadDaemonCliConfigWithTLS(t *testing.T) { c := &daemon.Config{} common := &cli.CommonFlags{ diff --git a/docker/daemon_unix_test.go b/docker/daemon_unix_test.go index 58b692b532..5b17b3afa2 100644 --- a/docker/daemon_unix_test.go +++ b/docker/daemon_unix_test.go @@ -12,6 +12,53 @@ import ( "github.com/docker/docker/pkg/mflag" ) +func TestLoadDaemonCliConfigWithDaemonFlags(t *testing.T) { + c := &daemon.Config{} + common := &cli.CommonFlags{ + Debug: true, + LogLevel: "info", + } + + f, err := ioutil.TempFile("", "docker-config-") + if err != nil { + t.Fatal(err) + } + + configFile := f.Name() + f.Write([]byte(`{"log-opts": {"max-size": "1k"}}`)) + f.Close() + + flags := mflag.NewFlagSet("test", mflag.ContinueOnError) + flags.String([]string{daemonConfigFileFlag}, "", "") + flags.BoolVar(&c.EnableSelinuxSupport, []string{"-selinux-enabled"}, true, "") + flags.StringVar(&c.LogConfig.Type, []string{"-log-driver"}, "json-file", "") + flags.Var(opts.NewNamedMapOpts("log-opts", c.LogConfig.Config, nil), []string{"-log-opt"}, "") + flags.Set(daemonConfigFileFlag, configFile) + + loadedConfig, err := loadDaemonCliConfig(c, flags, common, configFile) + if err != nil { + t.Fatal(err) + } + if loadedConfig == nil { + t.Fatalf("expected configuration %v, got nil", c) + } + if !loadedConfig.Debug { + t.Fatalf("expected debug mode, got false") + } + if loadedConfig.LogLevel != "info" { + t.Fatalf("expected info log level, got %v", loadedConfig.LogLevel) + } + if !loadedConfig.EnableSelinuxSupport { + t.Fatalf("expected enabled selinux support, got disabled") + } + if loadedConfig.LogConfig.Type != "json-file" { + t.Fatalf("expected LogConfig type json-file, got %v", loadedConfig.LogConfig.Type) + } + if maxSize := loadedConfig.LogConfig.Config["max-size"]; maxSize != "1k" { + t.Fatalf("expected log max-size `1k`, got %s", maxSize) + } +} + func TestLoadDaemonConfigWithNetwork(t *testing.T) { c := &daemon.Config{} common := &cli.CommonFlags{}