main_test.go 1.2 KB

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