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

Config-reload IT

Signed-off-by: Madhu Venugopal <madhu@docker.com>
This commit is contained in:
Madhu Venugopal 2016-02-18 11:00:26 -08:00 committed by Alessandro Boch
parent e5293f97f2
commit c9bec2be2a

View file

@ -17,6 +17,7 @@ import (
"strconv" "strconv"
"strings" "strings"
"sync" "sync"
"syscall"
"time" "time"
"github.com/docker/docker/pkg/integration/checker" "github.com/docker/docker/pkg/integration/checker"
@ -2157,3 +2158,43 @@ func (s *DockerDaemonSuite) TestDaemonDebugLog(c *check.C) {
newD.Stop() newD.Stop()
c.Assert(b.String(), checker.Contains, debugLog) c.Assert(b.String(), checker.Contains, debugLog)
} }
func (s *DockerSuite) TestDaemonDiscoveryBackendConfigReload(c *check.C) {
testRequires(c, SameHostDaemon, DaemonIsLinux)
// daemon config file
daemonConfig := `{ "debug" : false }`
configFilePath := "test.json"
configFile, err := os.Create(configFilePath)
c.Assert(err, checker.IsNil)
fmt.Fprintf(configFile, "%s", daemonConfig)
d := NewDaemon(c)
err = d.Start(fmt.Sprintf("--config-file=%s", configFilePath))
c.Assert(err, checker.IsNil)
defer d.Stop()
// daemon config file
daemonConfig = `{
"cluster-store": "consul://consuladdr:consulport/some/path",
"cluster-advertise": "192.168.56.100:0",
"debug" : false
}`
configFile.Close()
os.Remove(configFilePath)
configFile, err = os.Create(configFilePath)
c.Assert(err, checker.IsNil)
fmt.Fprintf(configFile, "%s", daemonConfig)
syscall.Kill(d.cmd.Process.Pid, syscall.SIGHUP)
time.Sleep(3 * time.Second)
out, err := d.Cmd("info")
c.Assert(err, checker.IsNil)
c.Assert(out, checker.Contains, fmt.Sprintf("Cluster store: consul://consuladdr:consulport/some/path"))
c.Assert(out, checker.Contains, fmt.Sprintf("Cluster advertise: 192.168.56.100:0"))
}