|
@@ -2115,14 +2115,10 @@ func (s *DockerDaemonSuite) TestDaemonMaxConcurrencyWithConfigFile(c *testing.T)
|
|
|
testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux)
|
|
|
|
|
|
// daemon config file
|
|
|
- configFilePath := "test.json"
|
|
|
- configFile, err := os.Create(configFilePath)
|
|
|
+ const configFilePath = "test-daemon.json"
|
|
|
+ err := os.WriteFile(configFilePath, []byte(`{ "max-concurrent-downloads" : 8 }`), 0666)
|
|
|
assert.NilError(c, err)
|
|
|
defer os.Remove(configFilePath)
|
|
|
-
|
|
|
- daemonConfig := `{ "max-concurrent-downloads" : 8 }`
|
|
|
- fmt.Fprintf(configFile, "%s", daemonConfig)
|
|
|
- configFile.Close()
|
|
|
s.d.Start(c, fmt.Sprintf("--config-file=%s", configFilePath))
|
|
|
|
|
|
expectedMaxConcurrentUploads := `level=debug msg="Max Concurrent Uploads: 5"`
|
|
@@ -2131,12 +2127,8 @@ func (s *DockerDaemonSuite) TestDaemonMaxConcurrencyWithConfigFile(c *testing.T)
|
|
|
assert.NilError(c, err)
|
|
|
assert.Assert(c, strings.Contains(string(content), expectedMaxConcurrentUploads))
|
|
|
assert.Assert(c, strings.Contains(string(content), expectedMaxConcurrentDownloads))
|
|
|
- configFile, err = os.Create(configFilePath)
|
|
|
+ err = os.WriteFile(configFilePath, []byte(`{ "max-concurrent-uploads" : 7, "max-concurrent-downloads" : 9 }`), 0666)
|
|
|
assert.NilError(c, err)
|
|
|
- daemonConfig = `{ "max-concurrent-uploads" : 7, "max-concurrent-downloads" : 9 }`
|
|
|
- fmt.Fprintf(configFile, "%s", daemonConfig)
|
|
|
- configFile.Close()
|
|
|
-
|
|
|
assert.Assert(c, s.d.Signal(unix.SIGHUP) == nil)
|
|
|
// unix.Kill(s.d.cmd.Process.Pid, unix.SIGHUP)
|
|
|
|
|
@@ -2157,14 +2149,11 @@ func (s *DockerDaemonSuite) TestDaemonMaxConcurrencyWithConfigFileReload(c *test
|
|
|
testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux)
|
|
|
|
|
|
// daemon config file
|
|
|
- configFilePath := "test.json"
|
|
|
- configFile, err := os.Create(configFilePath)
|
|
|
+ const configFilePath = "test-daemon.json"
|
|
|
+ err := os.WriteFile(configFilePath, []byte(`{ "max-concurrent-uploads" : null }`), 0666)
|
|
|
assert.NilError(c, err)
|
|
|
defer os.Remove(configFilePath)
|
|
|
|
|
|
- daemonConfig := `{ "max-concurrent-uploads" : null }`
|
|
|
- fmt.Fprintf(configFile, "%s", daemonConfig)
|
|
|
- configFile.Close()
|
|
|
s.d.Start(c, fmt.Sprintf("--config-file=%s", configFilePath))
|
|
|
|
|
|
expectedMaxConcurrentUploads := `level=debug msg="Max Concurrent Uploads: 5"`
|
|
@@ -2173,11 +2162,8 @@ func (s *DockerDaemonSuite) TestDaemonMaxConcurrencyWithConfigFileReload(c *test
|
|
|
assert.NilError(c, err)
|
|
|
assert.Assert(c, strings.Contains(string(content), expectedMaxConcurrentUploads))
|
|
|
assert.Assert(c, strings.Contains(string(content), expectedMaxConcurrentDownloads))
|
|
|
- configFile, err = os.Create(configFilePath)
|
|
|
+ err = os.WriteFile(configFilePath, []byte(`{ "max-concurrent-uploads" : 1, "max-concurrent-downloads" : null }`), 0666)
|
|
|
assert.NilError(c, err)
|
|
|
- daemonConfig = `{ "max-concurrent-uploads" : 1, "max-concurrent-downloads" : null }`
|
|
|
- fmt.Fprintf(configFile, "%s", daemonConfig)
|
|
|
- configFile.Close()
|
|
|
|
|
|
assert.Assert(c, s.d.Signal(unix.SIGHUP) == nil)
|
|
|
// unix.Kill(s.d.cmd.Process.Pid, unix.SIGHUP)
|
|
@@ -2190,11 +2176,8 @@ func (s *DockerDaemonSuite) TestDaemonMaxConcurrencyWithConfigFileReload(c *test
|
|
|
assert.NilError(c, err)
|
|
|
assert.Assert(c, strings.Contains(string(content), expectedMaxConcurrentUploads))
|
|
|
assert.Assert(c, strings.Contains(string(content), expectedMaxConcurrentDownloads))
|
|
|
- configFile, err = os.Create(configFilePath)
|
|
|
+ err = os.WriteFile(configFilePath, []byte(`{ "labels":["foo=bar"] }`), 0666)
|
|
|
assert.NilError(c, err)
|
|
|
- daemonConfig = `{ "labels":["foo=bar"] }`
|
|
|
- fmt.Fprintf(configFile, "%s", daemonConfig)
|
|
|
- configFile.Close()
|
|
|
|
|
|
assert.Assert(c, s.d.Signal(unix.SIGHUP) == nil)
|
|
|
|
|
@@ -2533,21 +2516,15 @@ func (s *DockerDaemonSuite) TestDaemonShutdownTimeoutWithConfigFile(c *testing.T
|
|
|
testRequires(c, testEnv.IsLocalDaemon)
|
|
|
|
|
|
// daemon config file
|
|
|
- configFilePath := "test.json"
|
|
|
- configFile, err := os.Create(configFilePath)
|
|
|
+ const configFilePath = "test-daemon.json"
|
|
|
+ err := os.WriteFile(configFilePath, []byte(`{ "shutdown-timeout" : 8 }`), 0666)
|
|
|
assert.NilError(c, err)
|
|
|
defer os.Remove(configFilePath)
|
|
|
|
|
|
- daemonConfig := `{ "shutdown-timeout" : 8 }`
|
|
|
- fmt.Fprintf(configFile, "%s", daemonConfig)
|
|
|
- configFile.Close()
|
|
|
s.d.Start(c, fmt.Sprintf("--config-file=%s", configFilePath))
|
|
|
|
|
|
- configFile, err = os.Create(configFilePath)
|
|
|
+ err = os.WriteFile(configFilePath, []byte(`{ "shutdown-timeout" : 5 }`), 0666)
|
|
|
assert.NilError(c, err)
|
|
|
- daemonConfig = `{ "shutdown-timeout" : 5 }`
|
|
|
- fmt.Fprintf(configFile, "%s", daemonConfig)
|
|
|
- configFile.Close()
|
|
|
|
|
|
assert.Assert(c, s.d.Signal(unix.SIGHUP) == nil)
|
|
|
|