mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Automated migration using
gty-migrate-from-testify --ignore-build-tags Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
ef01dea893
commit
6be0f70983
183 changed files with 2253 additions and 2199 deletions
|
@ -6,9 +6,9 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/docker/docker/daemon/config"
|
||||
"github.com/gotestyourself/gotestyourself/assert"
|
||||
is "github.com/gotestyourself/gotestyourself/assert/cmp"
|
||||
"github.com/gotestyourself/gotestyourself/fs"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestLoadDaemonCliConfigWithDaemonFlags(t *testing.T) {
|
||||
|
@ -19,17 +19,17 @@ func TestLoadDaemonCliConfigWithDaemonFlags(t *testing.T) {
|
|||
opts := defaultOptions(tempFile.Path())
|
||||
opts.Debug = true
|
||||
opts.LogLevel = "info"
|
||||
assert.NoError(t, opts.flags.Set("selinux-enabled", "true"))
|
||||
assert.Check(t, opts.flags.Set("selinux-enabled", "true"))
|
||||
|
||||
loadedConfig, err := loadDaemonCliConfig(opts)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, loadedConfig)
|
||||
assert.NilError(t, err)
|
||||
assert.Assert(t, loadedConfig != nil)
|
||||
|
||||
assert.True(t, loadedConfig.Debug)
|
||||
assert.Equal(t, "info", loadedConfig.LogLevel)
|
||||
assert.True(t, loadedConfig.EnableSelinuxSupport)
|
||||
assert.Equal(t, "json-file", loadedConfig.LogConfig.Type)
|
||||
assert.Equal(t, "1k", loadedConfig.LogConfig.Config["max-size"])
|
||||
assert.Check(t, loadedConfig.Debug)
|
||||
assert.Check(t, is.Equal("info", loadedConfig.LogLevel))
|
||||
assert.Check(t, loadedConfig.EnableSelinuxSupport)
|
||||
assert.Check(t, is.Equal("json-file", loadedConfig.LogConfig.Type))
|
||||
assert.Check(t, is.Equal("1k", loadedConfig.LogConfig.Config["max-size"]))
|
||||
}
|
||||
|
||||
func TestLoadDaemonConfigWithNetwork(t *testing.T) {
|
||||
|
@ -39,11 +39,11 @@ func TestLoadDaemonConfigWithNetwork(t *testing.T) {
|
|||
|
||||
opts := defaultOptions(tempFile.Path())
|
||||
loadedConfig, err := loadDaemonCliConfig(opts)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, loadedConfig)
|
||||
assert.NilError(t, err)
|
||||
assert.Assert(t, loadedConfig != nil)
|
||||
|
||||
assert.Equal(t, "127.0.0.2", loadedConfig.IP)
|
||||
assert.Equal(t, "127.0.0.1", loadedConfig.DefaultIP.String())
|
||||
assert.Check(t, is.Equal("127.0.0.2", loadedConfig.IP))
|
||||
assert.Check(t, is.Equal("127.0.0.1", loadedConfig.DefaultIP.String()))
|
||||
}
|
||||
|
||||
func TestLoadDaemonConfigWithMapOptions(t *testing.T) {
|
||||
|
@ -56,14 +56,14 @@ func TestLoadDaemonConfigWithMapOptions(t *testing.T) {
|
|||
|
||||
opts := defaultOptions(tempFile.Path())
|
||||
loadedConfig, err := loadDaemonCliConfig(opts)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, loadedConfig)
|
||||
assert.NotNil(t, loadedConfig.ClusterOpts)
|
||||
assert.NilError(t, err)
|
||||
assert.Assert(t, loadedConfig != nil)
|
||||
assert.Check(t, loadedConfig.ClusterOpts != nil)
|
||||
|
||||
expectedPath := "/var/lib/docker/discovery_certs/ca.pem"
|
||||
assert.Equal(t, expectedPath, loadedConfig.ClusterOpts["kv.cacertfile"])
|
||||
assert.NotNil(t, loadedConfig.LogConfig.Config)
|
||||
assert.Equal(t, "test", loadedConfig.LogConfig.Config["tag"])
|
||||
assert.Check(t, is.Equal(expectedPath, loadedConfig.ClusterOpts["kv.cacertfile"]))
|
||||
assert.Check(t, loadedConfig.LogConfig.Config != nil)
|
||||
assert.Check(t, is.Equal("test", loadedConfig.LogConfig.Config["tag"]))
|
||||
}
|
||||
|
||||
func TestLoadDaemonConfigWithTrueDefaultValues(t *testing.T) {
|
||||
|
@ -73,17 +73,17 @@ func TestLoadDaemonConfigWithTrueDefaultValues(t *testing.T) {
|
|||
|
||||
opts := defaultOptions(tempFile.Path())
|
||||
loadedConfig, err := loadDaemonCliConfig(opts)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, loadedConfig)
|
||||
assert.NilError(t, err)
|
||||
assert.Assert(t, loadedConfig != nil)
|
||||
|
||||
assert.False(t, loadedConfig.EnableUserlandProxy)
|
||||
assert.Check(t, !loadedConfig.EnableUserlandProxy)
|
||||
|
||||
// make sure reloading doesn't generate configuration
|
||||
// conflicts after normalizing boolean values.
|
||||
reload := func(reloadedConfig *config.Config) {
|
||||
assert.False(t, reloadedConfig.EnableUserlandProxy)
|
||||
assert.Check(t, !reloadedConfig.EnableUserlandProxy)
|
||||
}
|
||||
assert.NoError(t, config.Reload(opts.configFile, opts.flags, reload))
|
||||
assert.Check(t, config.Reload(opts.configFile, opts.flags, reload))
|
||||
}
|
||||
|
||||
func TestLoadDaemonConfigWithTrueDefaultValuesLeaveDefaults(t *testing.T) {
|
||||
|
@ -92,8 +92,8 @@ func TestLoadDaemonConfigWithTrueDefaultValuesLeaveDefaults(t *testing.T) {
|
|||
|
||||
opts := defaultOptions(tempFile.Path())
|
||||
loadedConfig, err := loadDaemonCliConfig(opts)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, loadedConfig)
|
||||
assert.NilError(t, err)
|
||||
assert.Assert(t, loadedConfig != nil)
|
||||
|
||||
assert.True(t, loadedConfig.EnableUserlandProxy)
|
||||
assert.Check(t, loadedConfig.EnableUserlandProxy)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue