main.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // Copyright 2018 The etcd Authors
  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. // etcd-tester is a program that runs functional-tester client.
  15. package main
  16. import (
  17. "flag"
  18. "go.etcd.io/etcd/functional/tester"
  19. "go.uber.org/zap"
  20. )
  21. var logger *zap.Logger
  22. func init() {
  23. var err error
  24. logger, err = zap.NewProduction()
  25. if err != nil {
  26. panic(err)
  27. }
  28. }
  29. func main() {
  30. config := flag.String("config", "", "path to tester configuration")
  31. flag.Parse()
  32. defer logger.Sync()
  33. clus, err := tester.NewCluster(logger, *config)
  34. if err != nil {
  35. logger.Fatal("failed to create a cluster", zap.Error(err))
  36. }
  37. err = clus.Send_INITIAL_START_ETCD()
  38. if err != nil {
  39. logger.Fatal("Bootstrap failed", zap.Error(err))
  40. }
  41. defer clus.Send_SIGQUIT_ETCD_AND_REMOVE_DATA_AND_STOP_AGENT()
  42. logger.Info("wait health after bootstrap")
  43. err = clus.WaitHealth()
  44. if err != nil {
  45. logger.Fatal("WaitHealth failed", zap.Error(err))
  46. }
  47. clus.Run()
  48. }