mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-11 23:31:03 +00:00
nest profiling options in config file and test
This commit is contained in:
parent
442380f8ab
commit
60c1828dc9
2 changed files with 10 additions and 3 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue