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
5package e2e
6
7import (
8	"flag"
9	"os"
10	"runtime"
11	"testing"
12
13	"github.com/coreos/etcd/pkg/testutil"
14)
15
16var (
17	binDir  string
18	certDir string
19
20	certPath       string
21	privateKeyPath string
22	caPath         string
23
24	certPath2       string
25	privateKeyPath2 string
26
27	crlPath               string
28	revokedCertPath       string
29	revokedPrivateKeyPath string
30)
31
32func TestMain(m *testing.M) {
33	os.Setenv("ETCD_UNSUPPORTED_ARCH", runtime.GOARCH)
34	os.Unsetenv("ETCDCTL_API")
35
36	flag.StringVar(&binDir, "bin-dir", "../bin", "The directory for store etcd and etcdctl binaries.")
37	flag.StringVar(&certDir, "cert-dir", "../integration/fixtures", "The directory for store certificate files.")
38	flag.Parse()
39
40	binPath = binDir + "/etcd"
41	ctlBinPath = binDir + "/etcdctl"
42	certPath = certDir + "/server.crt"
43	privateKeyPath = certDir + "/server.key.insecure"
44	caPath = certDir + "/ca.crt"
45	revokedCertPath = certDir + "/server-revoked.crt"
46	revokedPrivateKeyPath = certDir + "/server-revoked.key.insecure"
47	crlPath = certDir + "/revoke.crl"
48
49	certPath2 = certDir + "/server2.crt"
50	privateKeyPath2 = certDir + "/server2.key.insecure"
51
52	v := m.Run()
53	if v == 0 && testutil.CheckLeakedGoroutine() {
54		os.Exit(1)
55	}
56	os.Exit(v)
57}
58