mirror of https://github.com/etcd-io/dbtester.git
*: add default value to 'database-id'
Fix https://github.com/coreos/dbtester/issues/312.
This commit is contained in:
parent
74de567743
commit
5173082931
|
|
@ -18,6 +18,7 @@ package control
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/coreos/dbtester"
|
"github.com/coreos/dbtester"
|
||||||
|
|
@ -55,7 +56,8 @@ func init() {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
Command.PersistentFlags().StringVar(&databaseID, "database-id", "etcd__tip", "See dbtesterpb/database_id.pb.go")
|
ids := dbtesterpb.GetAllDatabaseIDs()
|
||||||
|
Command.PersistentFlags().StringVar(&databaseID, "database-id", ids[0], strings.Join(ids, ", "))
|
||||||
Command.PersistentFlags().StringVarP(&configPath, "config", "c", "", "YAML configuration file path.")
|
Command.PersistentFlags().StringVarP(&configPath, "config", "c", "", "YAML configuration file path.")
|
||||||
Command.PersistentFlags().StringVar(&diskDevice, "disk-device", dn, "Disk device to collect disk statistics metrics from.")
|
Command.PersistentFlags().StringVar(&diskDevice, "disk-device", dn, "Disk device to collect disk statistics metrics from.")
|
||||||
Command.PersistentFlags().StringVar(&networkInterface, "network-interface", nt, "Network interface to record in/outgoing packets.")
|
Command.PersistentFlags().StringVar(&networkInterface, "network-interface", nt, "Network interface to record in/outgoing packets.")
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ package dbtesterpb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"image/color"
|
"image/color"
|
||||||
|
"sort"
|
||||||
|
|
||||||
"github.com/gonum/plot/plotutil"
|
"github.com/gonum/plot/plotutil"
|
||||||
)
|
)
|
||||||
|
|
@ -26,6 +27,16 @@ func IsValidDatabaseID(id string) bool {
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetAllDatabaseIDs returns all database ids.
|
||||||
|
func GetAllDatabaseIDs() []string {
|
||||||
|
var ids []string
|
||||||
|
for k := range DatabaseID_value {
|
||||||
|
ids = append(ids, k)
|
||||||
|
}
|
||||||
|
sort.Strings(ids)
|
||||||
|
return ids
|
||||||
|
}
|
||||||
|
|
||||||
func GetRGBI(databaseID string, i int) color.Color {
|
func GetRGBI(databaseID string, i int) color.Color {
|
||||||
switch databaseID {
|
switch databaseID {
|
||||||
case "etcd__v2_3":
|
case "etcd__v2_3":
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue