add replicaN to pilosa server and test

This commit is contained in:
Matt Jaffee 2017-03-14 16:43:09 -05:00
parent 372b7ca1c4
commit 2af42eedb5
2 changed files with 7 additions and 2 deletions

View file

@ -75,8 +75,9 @@ on the configured port.`,
flags := serveCmd.Flags()
flags.StringVarP(&Serve.ConfigPath, "config", "c", "", "Configuration file to read from.")
flags.StringVarP(&Serve.Config.Host, "host", "", ":10101", "Default URI on which pilosa should listen.")
flags.StringVarP(&Serve.Config.DataDir, "data-dir", "d", "~/.pilosa", "Directory to store pilosa data files.")
flags.StringVarP(&Serve.Config.Host, "bind", "", ":10101", "Default URI on which pilosa should listen.")
flags.IntVarP(&Serve.Config.Cluster.ReplicaN, "cluster.replicas", "", 1, "Number hosts each piece of data should be stored on.")
flags.StringVarP(&Serve.CPUProfile, "cpu-profile", "", "", "Where to store CPU profile.")
flags.DurationVarP(&Serve.CPUTime, "cpu-time", "", 30*time.Second, "CPU profile duration.")

View file

@ -51,12 +51,16 @@ func TestServerConfig(t *testing.T) {
env: map[string]string{"PILOSA_DATA_DIR": "/tmp/myEnvDatadir"},
cfgFileContent: `
data-dir = "/tmp/myFileDatadir"
host = "localhost:0"
bind = "localhost:0"
[cluster]
replicas = 2
`,
validation: func() error {
v := validator{}
v.Check(cmd.Serve.Config.DataDir, actualDataDir)
v.Check(cmd.Serve.Config.Host, "localhost:0")
v.Check(cmd.Serve.Config.Cluster.ReplicaN, 2)
return v.Error()
},
},