main_test.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. binPath string
  16. ctlBinPath string
  17. certPath string
  18. privateKeyPath string
  19. caPath 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. v := m.Run()
  39. if v == 0 && testutil.CheckLeakedGoroutine() {
  40. os.Exit(1)
  41. }
  42. os.Exit(v)
  43. }