main.go 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Copyright 2015 CoreOS, Inc.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package main
  15. import (
  16. "flag"
  17. "log"
  18. "net/http"
  19. "strings"
  20. )
  21. func main() {
  22. endpointStr := flag.String("agent-endpoints", "localhost:9027", "HTTP RPC endpoints of agents. Do not specify the schema.")
  23. datadir := flag.String("data-dir", "agent.etcd", "etcd data directory location on agent machine.")
  24. stressKeySize := flag.Int("stress-key-size", 100, "the size of each key written into etcd.")
  25. stressKeySuffixRange := flag.Int("stress-key-count", 250000, "the count of key range written into etcd.")
  26. limit := flag.Int("limit", 3, "the limit of rounds to run failure set.")
  27. isV2Only := flag.Bool("v2-only", false, "'true' to run V2 only tester.")
  28. flag.Parse()
  29. endpoints := strings.Split(*endpointStr, ",")
  30. c, err := newCluster(endpoints, *datadir, *stressKeySize, *stressKeySuffixRange, *isV2Only)
  31. if err != nil {
  32. log.Fatal(err)
  33. }
  34. defer c.Terminate()
  35. t := &tester{
  36. failures: []failure{
  37. newFailureKillAll(),
  38. newFailureKillMajority(),
  39. newFailureKillOne(),
  40. newFailureKillOneForLongTime(),
  41. newFailureIsolate(),
  42. newFailureIsolateAll(),
  43. },
  44. cluster: c,
  45. limit: *limit,
  46. }
  47. sh := statusHandler{status: &t.status}
  48. http.Handle("/status", sh)
  49. go func() { log.Fatal(http.ListenAndServe(":9028", nil)) }()
  50. t.runLoop()
  51. }