main.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. "github.com/coreos/etcd/tools/functional-tester/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.Bootstrap()
  38. if err != nil {
  39. logger.Fatal("Bootstrap failed", zap.Error(err))
  40. }
  41. defer clus.DestroyEtcdAgents()
  42. err = clus.WaitHealth()
  43. if err != nil {
  44. logger.Fatal("WaitHealth failed", zap.Error(err))
  45. }
  46. clus.StartTester()
  47. }