Pass the GCE project, zone, and master name into e2e.go as flags.
This commit is contained in:
@@ -18,7 +18,6 @@ package e2e
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
||||
@@ -42,25 +41,10 @@ var _ = Describe("MasterCerts", func() {
|
||||
return
|
||||
}
|
||||
|
||||
// gcloud requires the project, zone and master VM name, it can't SSH
|
||||
// based only on the host IP. Unfortunately, you can't SSH into a GCE VM
|
||||
// without using gcloud SSH or doing out-of-band configuration.
|
||||
project := os.Getenv("PROJECT")
|
||||
if project == "" {
|
||||
Fail(fmt.Sprintf("Error getting PROJECT environment variable"))
|
||||
}
|
||||
zone := os.Getenv("ZONE")
|
||||
if zone == "" {
|
||||
Fail(fmt.Sprintf("Error getting ZONE environment variable"))
|
||||
}
|
||||
master := os.Getenv("KUBE_MASTER")
|
||||
if master == "" {
|
||||
Fail(fmt.Sprintf("Error getting KUBE_MASTER environment variable"))
|
||||
}
|
||||
|
||||
for _, certFile := range []string{"kubecfg.key", "kubecfg.crt", "ca.crt"} {
|
||||
cmd := exec.Command("gcloud", "compute", "ssh", "--project", project, "--zone", zone,
|
||||
master, "--command", fmt.Sprintf("ls /srv/kubernetes/%s", certFile))
|
||||
cmd := exec.Command("gcloud", "compute", "ssh", "--project", testContext.gceConfig.ProjectID,
|
||||
"--zone", testContext.gceConfig.Zone, testContext.gceConfig.MasterName,
|
||||
"--command", fmt.Sprintf("ls /srv/kubernetes/%s", certFile))
|
||||
if _, err := cmd.CombinedOutput(); err != nil {
|
||||
Fail(fmt.Sprintf("Error checking for cert file %s on master: %v", certFile, err))
|
||||
}
|
||||
|
@@ -31,6 +31,12 @@ import (
|
||||
|
||||
type testResult bool
|
||||
|
||||
type GCEConfig struct {
|
||||
ProjectID string
|
||||
Zone string
|
||||
MasterName string
|
||||
}
|
||||
|
||||
func init() {
|
||||
// Turn on verbose by default to get spec names
|
||||
config.DefaultReporterConfig.Verbose = true
|
||||
@@ -46,8 +52,8 @@ func (t *testResult) Fail() { *t = false }
|
||||
|
||||
// Run each Go end-to-end-test. This function assumes the
|
||||
// creation of a test cluster.
|
||||
func RunE2ETests(authConfig, certDir, host, repoRoot, provider string, orderseed int64, times int, reportDir string, testList []string) {
|
||||
testContext = testContextType{authConfig, certDir, host, repoRoot, provider}
|
||||
func RunE2ETests(authConfig, certDir, host, repoRoot, provider string, gceConfig *GCEConfig, orderseed int64, times int, reportDir string, testList []string) {
|
||||
testContext = testContextType{authConfig, certDir, host, repoRoot, provider, *gceConfig}
|
||||
util.ReallyCrash = true
|
||||
util.InitLogs()
|
||||
defer util.FlushLogs()
|
||||
|
@@ -37,6 +37,7 @@ type testContextType struct {
|
||||
host string
|
||||
repoRoot string
|
||||
provider string
|
||||
gceConfig GCEConfig
|
||||
}
|
||||
|
||||
var testContext testContextType
|
||||
|
Reference in New Issue
Block a user