e2e: Make the certificate file path configurable

This commit will help us to run the e2e tests in an enviroment
without e2e source code more convenient.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
This commit is contained in:
Yiqiao Pu 2016-08-08 13:07:06 +08:00
parent 2ca87f6c03
commit a5e4fbd335
2 changed files with 11 additions and 8 deletions

View File

@ -26,16 +26,14 @@ import (
"github.com/coreos/etcd/pkg/fileutil"
)
const (
etcdProcessBasePort = 20000
certPath = "../integration/fixtures/server.crt"
privateKeyPath = "../integration/fixtures/server.key.insecure"
caPath = "../integration/fixtures/ca.crt"
)
const etcdProcessBasePort = 20000
var (
binPath string
ctlBinPath string
binPath string
ctlBinPath string
certPath string
privateKeyPath string
caPath string
)
type clientConnType int
@ -207,6 +205,9 @@ func newEtcdProcess(cfg *etcdProcessConfig) (*etcdProcess, error) {
func (cfg *etcdProcessClusterConfig) etcdProcessConfigs() []*etcdProcessConfig {
binPath = binDir + "/etcd"
ctlBinPath = binDir + "/etcdctl"
certPath = certDir + "/server.crt"
privateKeyPath = certDir + "/server.key.insecure"
caPath = certDir + "/ca.crt"
if cfg.basePort == 0 {
cfg.basePort = etcdProcessBasePort

View File

@ -14,11 +14,13 @@ import (
)
var binDir string
var certDir string
func TestMain(m *testing.M) {
os.Setenv("ETCD_UNSUPPORTED_ARCH", runtime.GOARCH)
flag.StringVar(&binDir, "bin-dir", "../bin", "The directory for store etcd and etcdctl binaries.")
flag.StringVar(&certDir, "cert-dir", "../integration/fixtures", "The directory for store certificate files.")
flag.Parse()
v := m.Run()