Exemplo n.º 1
0
func runTests(fullhost string) ([]byte, error) {
	host := strings.Split(fullhost, ".")[0]
	c := gcloud.NewGCloudClient(host, *zone)
	// TODO(pwittrock): Come up with something better for bootstrapping the environment.
	eh, err := c.RunAndWaitTillHealthy(
		false, false, "4001", healthyTimeoutDuration, "v2/keys/", "etcd", "--data-dir", "./", "--name", "e2e-node")
	defer func() { eh.TearDown() }()
	if err != nil {
		return nil, fmt.Errorf("Host %s failed to run command %v", host, err)
	}

	apiBin := filepath.Join(kubeRoot, *kubeOutputRelPath, "kube-apiserver")
	ah, err := c.RunAndWaitTillHealthy(
		true, true, "8080", healthyTimeoutDuration, "healthz", apiBin, "--service-cluster-ip-range",
		"10.0.0.1/24", "--insecure-bind-address", "0.0.0.0", "--etcd-servers", "http://127.0.0.1:4001",
		"--v", "2", "--kubelet-port", "10250")
	defer func() { ah.TearDown() }()
	if err != nil {
		return nil, fmt.Errorf("Host %s failed to run command %v", host, err)
	}

	kubeletBin := filepath.Join(kubeRoot, *kubeOutputRelPath, "kubelet")
	kh, err := c.RunAndWaitTillHealthy(
		true, true, "10255", healthyTimeoutDuration, "healthz", kubeletBin, "--api-servers", "http://127.0.0.1:8080",
		"--logtostderr", "--address", "0.0.0.0", "--port", "10250")
	defer func() { kh.TearDown() }()
	if err != nil {
		return nil, fmt.Errorf("Host %s failed to run command %v", host, err)
	}

	// Run the tests
	glog.Infof("Kubelet healthy on host %s", host)
	glog.Infof("Kubelet host %s tunnel running on port %s", host, ah.LPort)
	u.Wait()
	glog.Infof("Running ginkgo tests against host %s", host)
	ginkgoTests := filepath.Join(kubeRoot, ginkgoTestRelPath)
	return exec.Command(
		"ginkgo", ginkgoTests, "--",
		"--kubelet-address", fmt.Sprintf("http://127.0.0.1:%s", kh.LPort),
		"--api-server-address", fmt.Sprintf("http://127.0.0.1:%s", ah.LPort),
		"--node-name", fullhost,
		"-logtostderr").CombinedOutput()
}
Exemplo n.º 2
0
func runTests(fullhost string) *TestResult {
	result := &TestResult{fullhost: fullhost}

	host := strings.Split(fullhost, ".")[0]
	c := gcloud.NewGCloudClient(host, *zone)
	// TODO(pwittrock): Come up with something better for bootstrapping the environment.
	eh, err := c.RunAndWaitTillHealthy(
		false, false, "4001", healthyTimeoutDuration, "v2/keys/", "etcd", "--data-dir", "./", "--name", "e2e-node")
	defer func() {
		eh.TearDown()
		result.etcdCombinedOutput = fmt.Sprintf("%s", eh.CombinedOutput.Bytes())
	}()
	if err != nil {
		result.err = fmt.Errorf("Host %s failed to run command %v", host, err)
		return result
	}

	apiBin := filepath.Join(kubeRoot, *kubeOutputRelPath, "kube-apiserver")
	ah, err := c.RunAndWaitTillHealthy(
		true, true, "8080", healthyTimeoutDuration, "healthz", apiBin, "--service-cluster-ip-range",
		"10.0.0.1/24", "--insecure-bind-address", "0.0.0.0", "--etcd-servers", "http://127.0.0.1:4001",
		"--v", "2", "--alsologtostderr", "--kubelet-port", "10250")
	defer func() {
		ah.TearDown()
		result.apiServerCombinedOutput = fmt.Sprintf("%s", ah.CombinedOutput.Bytes())
	}()
	if err != nil {
		result.err = fmt.Errorf("Host %s failed to run command %v", host, err)
		return result
	}

	kubeletBin := filepath.Join(kubeRoot, *kubeOutputRelPath, "kubelet")
	// TODO: Used --v 4 or higher and upload to gcs instead of printing to the console
	// TODO: Copy /var/log/messages and upload to GCS for failed tests
	kh, err := c.RunAndWaitTillHealthy(
		true, true, "10255", healthyTimeoutDuration, "healthz", kubeletBin, "--api-servers", "http://127.0.0.1:8080",
		"--v", "2", "--alsologtostderr", "--address", "0.0.0.0", "--port", "10250")
	defer func() {
		kh.TearDown()
		result.kubeletCombinedOutput = fmt.Sprintf("%s", kh.CombinedOutput.Bytes())
	}()
	if err != nil {
		result.err = fmt.Errorf("Host %s failed to run command %v", host, err)
	}

	// Run the tests
	glog.Infof("Kubelet healthy on host %s", host)
	glog.Infof("Kubelet host %s tunnel running on port %s", host, ah.LPort)
	u.Wait()
	glog.Infof("Running ginkgo tests against host %s", host)
	ginkgoTests := filepath.Join(kubeRoot, ginkgoTestRelPath)
	out, err := exec.Command(
		"ginkgo", ginkgoTests, "--",
		"--kubelet-address", fmt.Sprintf("http://127.0.0.1:%s", kh.LPort),
		"--api-server-address", fmt.Sprintf("http://127.0.0.1:%s", ah.LPort),
		"--node-name", fullhost,
		"--v", "2", "--alsologtostderr").CombinedOutput()

	result.err = err
	result.testCombinedOutput = fmt.Sprintf("%s", out)
	return result
}