1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

integration-cli: in TestDaemonEvents* use ioutil.WriteFile

Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
Tibor Vass 2019-10-07 23:50:49 +00:00 committed by Sebastiaan van Stijn
parent 24a419221d
commit 0e0ab58a96
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -391,23 +391,17 @@ func (s *DockerDaemonSuite) TestDaemonEvents(c *testing.T) {
// daemon config file
configFilePath := "test.json"
configFile, err := os.Create(configFilePath)
assert.NilError(c, err)
defer os.Remove(configFilePath)
daemonConfig := `{"labels":["foo=bar"]}`
_, err = configFile.Write([]byte(daemonConfig))
assert.NilError(c, configFile.Close())
err := ioutil.WriteFile(configFilePath, []byte(daemonConfig), 0644)
assert.NilError(c, err)
s.d.Start(c, "--config-file="+configFilePath)
info := s.d.Info(c)
configFile, err = os.Create(configFilePath)
assert.NilError(c, err)
daemonConfig = `{"max-concurrent-downloads":1,"labels":["bar=foo"], "shutdown-timeout": 10}`
_, err = fmt.Fprintf(configFile, "%s", daemonConfig)
assert.NilError(c, configFile.Close())
err = ioutil.WriteFile(configFilePath, []byte(daemonConfig), 0644)
assert.NilError(c, err)
assert.NilError(c, s.d.Signal(unix.SIGHUP))
@ -448,13 +442,10 @@ func (s *DockerDaemonSuite) TestDaemonEventsWithFilters(c *testing.T) {
// daemon config file
configFilePath := "test.json"
configFile, err := os.Create(configFilePath)
assert.NilError(c, err)
defer os.Remove(configFilePath)
daemonConfig := `{"labels":["foo=bar"]}`
_, err = configFile.Write([]byte(daemonConfig))
assert.NilError(c, configFile.Close())
err := ioutil.WriteFile(configFilePath, []byte(daemonConfig), 0644)
assert.NilError(c, err)
s.d.Start(c, "--config-file="+configFilePath)