main_test.go 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // Copyright 2013 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package e2e
  5. import (
  6. "flag"
  7. "os"
  8. "runtime"
  9. "testing"
  10. "go.etcd.io/etcd/pkg/testutil"
  11. )
  12. var (
  13. binDir string
  14. certDir string
  15. certPath string
  16. privateKeyPath string
  17. caPath string
  18. certPath2 string
  19. privateKeyPath2 string
  20. certPath3 string
  21. privateKeyPath3 string
  22. crlPath string
  23. revokedCertPath string
  24. revokedPrivateKeyPath string
  25. )
  26. func TestMain(m *testing.M) {
  27. os.Setenv("ETCD_UNSUPPORTED_ARCH", runtime.GOARCH)
  28. os.Unsetenv("ETCDCTL_API")
  29. flag.StringVar(&binDir, "bin-dir", "../../bin", "The directory for store etcd and etcdctl binaries.")
  30. flag.StringVar(&certDir, "cert-dir", "../../integration/fixtures", "The directory for store certificate files.")
  31. flag.Parse()
  32. binPath = binDir + "/etcd"
  33. ctlBinPath = binDir + "/etcdctl"
  34. certPath = certDir + "/server.crt"
  35. privateKeyPath = certDir + "/server.key.insecure"
  36. caPath = certDir + "/ca.crt"
  37. revokedCertPath = certDir + "/server-revoked.crt"
  38. revokedPrivateKeyPath = certDir + "/server-revoked.key.insecure"
  39. crlPath = certDir + "/revoke.crl"
  40. certPath2 = certDir + "/server2.crt"
  41. privateKeyPath2 = certDir + "/server2.key.insecure"
  42. certPath3 = certDir + "/server3.crt"
  43. privateKeyPath3 = certDir + "/server3.key.insecure"
  44. v := m.Run()
  45. if v == 0 && testutil.CheckLeakedGoroutine() {
  46. os.Exit(1)
  47. }
  48. os.Exit(v)
  49. }