Signed-off-by: Tibor Vass <tibor@docker.com>
| ... | ... |
@@ -391,23 +391,17 @@ func (s *DockerDaemonSuite) TestDaemonEvents(c *testing.T) {
|
| 391 | 391 |
|
| 392 | 392 |
// daemon config file |
| 393 | 393 |
configFilePath := "test.json" |
| 394 |
- configFile, err := os.Create(configFilePath) |
|
| 395 |
- assert.NilError(c, err) |
|
| 396 | 394 |
defer os.Remove(configFilePath) |
| 397 | 395 |
|
| 398 | 396 |
daemonConfig := `{"labels":["foo=bar"]}`
|
| 399 |
- _, err = configFile.Write([]byte(daemonConfig)) |
|
| 400 |
- assert.NilError(c, configFile.Close()) |
|
| 397 |
+ err := ioutil.WriteFile(configFilePath, []byte(daemonConfig), 0644) |
|
| 401 | 398 |
assert.NilError(c, err) |
| 402 | 399 |
s.d.Start(c, "--config-file="+configFilePath) |
| 403 | 400 |
|
| 404 | 401 |
info := s.d.Info(c) |
| 405 | 402 |
|
| 406 |
- configFile, err = os.Create(configFilePath) |
|
| 407 |
- assert.NilError(c, err) |
|
| 408 | 403 |
daemonConfig = `{"max-concurrent-downloads":1,"labels":["bar=foo"], "shutdown-timeout": 10}`
|
| 409 |
- _, err = fmt.Fprintf(configFile, "%s", daemonConfig) |
|
| 410 |
- assert.NilError(c, configFile.Close()) |
|
| 404 |
+ err = ioutil.WriteFile(configFilePath, []byte(daemonConfig), 0644) |
|
| 411 | 405 |
assert.NilError(c, err) |
| 412 | 406 |
|
| 413 | 407 |
assert.NilError(c, s.d.Signal(unix.SIGHUP)) |
| ... | ... |
@@ -448,13 +442,10 @@ func (s *DockerDaemonSuite) TestDaemonEventsWithFilters(c *testing.T) {
|
| 448 | 448 |
|
| 449 | 449 |
// daemon config file |
| 450 | 450 |
configFilePath := "test.json" |
| 451 |
- configFile, err := os.Create(configFilePath) |
|
| 452 |
- assert.NilError(c, err) |
|
| 453 | 451 |
defer os.Remove(configFilePath) |
| 454 | 452 |
|
| 455 | 453 |
daemonConfig := `{"labels":["foo=bar"]}`
|
| 456 |
- _, err = configFile.Write([]byte(daemonConfig)) |
|
| 457 |
- assert.NilError(c, configFile.Close()) |
|
| 454 |
+ err := ioutil.WriteFile(configFilePath, []byte(daemonConfig), 0644) |
|
| 458 | 455 |
assert.NilError(c, err) |
| 459 | 456 |
s.d.Start(c, "--config-file="+configFilePath) |
| 460 | 457 |
|