diff --git a/cmd/server.go b/cmd/server.go index cf17e906c..3ab7c2822 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -82,8 +82,8 @@ on the configured port.`, flags.DurationVarP((*time.Duration)(&Serve.Config.Cluster.PollingInterval), "cluster.poll-interval", "", time.Minute, "Polling interval for cluster.") // TODO what actually is this? flags.StringVarP(&Serve.Config.Plugins.Path, "plugins.path", "", "", "Path to plugin directory.") flags.DurationVarP((*time.Duration)(&Serve.Config.AntiEntropy.Interval), "anti-entropy.interval", "", time.Minute*10, "Interval at which to run anti-entropy routine.") - flags.StringVarP(&Serve.CPUProfile, "cpu-profile", "", "", "Where to store CPU profile.") - flags.DurationVarP(&Serve.CPUTime, "cpu-time", "", 30*time.Second, "CPU profile duration.") + flags.StringVarP(&Serve.CPUProfile, "profile.cpu", "", "", "Where to store CPU profile.") + flags.DurationVarP(&Serve.CPUTime, "profile.cpu-time", "", 30*time.Second, "CPU profile duration.") return serveCmd } diff --git a/cmd/server_test.go b/cmd/server_test.go index afbefc7af..fe0d52244 100644 --- a/cmd/server_test.go +++ b/cmd/server_test.go @@ -47,6 +47,8 @@ type commandTest struct { func TestServerConfig(t *testing.T) { actualDataDir, err := ioutil.TempDir("", "") failErr(t, err, "making data dir") + profFile, err := ioutil.TempFile("", "") + failErr(t, err, "making temp file") tests := []commandTest{ // TEST 0 { @@ -96,7 +98,7 @@ bind = "localhost:0" // TEST 2 { args: []string{"server"}, - env: map[string]string{}, + env: map[string]string{"PILOSA_PROFILE.CPU_TIME": "1m"}, cfgFileContent: ` [cluster] poll-interval = "2m0s" @@ -105,12 +107,17 @@ bind = "localhost:0" ] [anti-entropy] interval = "11m0s" +[profile] + cpu = "` + profFile.Name() + `" + cpu-time = "35s" `, validation: func() error { v := validator{} v.Check(cmd.Serve.Config.Cluster.Nodes, []string{"localhost:19444"}) v.Check(cmd.Serve.Config.Cluster.PollingInterval, pilosa.Duration(time.Minute*2)) v.Check(cmd.Serve.Config.AntiEntropy.Interval, pilosa.Duration(time.Minute*11)) + v.Check(cmd.Serve.CPUProfile, profFile.Name()) + v.Check(cmd.Serve.CPUTime, time.Minute) return v.Error() }, },