mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
daemon/config: fix TestReloadDefaultConfigNotExist if file exists
The TestReloadDefaultConfigNotExist() test assumed it was running in a clean environment, in which the `/etc/docker/daemon.json` file doesn't exist, and would fail if that was not the case. This patch updates the test to override the default location to a a non-existing path, to allow running the test in an environment where `/etc/docker/daemon.json` is present. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
83970db5ef
commit
5cfcd88d57
1 changed files with 3 additions and 3 deletions
|
@ -446,10 +446,10 @@ func TestReloadSetConfigFileNotExist(t *testing.T) {
|
|||
func TestReloadDefaultConfigNotExist(t *testing.T) {
|
||||
skip.If(t, os.Getuid() != 0, "skipping test that requires root")
|
||||
reloaded := false
|
||||
configFile := "/etc/docker/daemon.json"
|
||||
defaultConfigFile := "/tmp/blabla/not/exists/daemon.json"
|
||||
flags := pflag.NewFlagSet("test", pflag.ContinueOnError)
|
||||
flags.String("config-file", configFile, "")
|
||||
err := Reload(configFile, flags, func(c *Config) {
|
||||
flags.String("config-file", defaultConfigFile, "")
|
||||
err := Reload(defaultConfigFile, flags, func(c *Config) {
|
||||
reloaded = true
|
||||
})
|
||||
assert.Check(t, err)
|
||||
|
|
Loading…
Add table
Reference in a new issue