main_test.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. "github.com/coreos/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. crlPath string
  21. revokedCertPath string
  22. revokedPrivateKeyPath string
  23. )
  24. func TestMain(m *testing.M) {
  25. os.Setenv("ETCD_UNSUPPORTED_ARCH", runtime.GOARCH)
  26. os.Unsetenv("ETCDCTL_API")
  27. flag.StringVar(&binDir, "bin-dir", "../bin", "The directory for store etcd and etcdctl binaries.")
  28. flag.StringVar(&certDir, "cert-dir", "../integration/fixtures", "The directory for store certificate files.")
  29. flag.Parse()
  30. binPath = binDir + "/etcd"
  31. ctlBinPath = binDir + "/etcdctl"
  32. certPath = certDir + "/server.crt"
  33. privateKeyPath = certDir + "/server.key.insecure"
  34. caPath = certDir + "/ca.crt"
  35. revokedCertPath = certDir + "/server-revoked.crt"
  36. revokedPrivateKeyPath = certDir + "/server-revoked.key.insecure"
  37. crlPath = certDir + "/revoke.crl"
  38. certPath2 = certDir + "/server2.crt"
  39. privateKeyPath2 = certDir + "/server2.key.insecure"
  40. v := m.Run()
  41. if v == 0 && testutil.CheckLeakedGoroutine() {
  42. os.Exit(1)
  43. }
  44. os.Exit(v)
  45. }