Browse Source

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>
Yiqiao Pu 9 years ago
parent
commit
a5e4fbd335
2 changed files with 11 additions and 8 deletions
  1. 9 8
      e2e/etcd_test.go
  2. 2 0
      e2e/main_test.go

+ 9 - 8
e2e/etcd_test.go

@@ -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

+ 2 - 0
e2e/main_test.go

@@ -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()