mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Revert "Turn the hack/e2e.go commands into standalone scripts."
This commit is contained in:
		@@ -1,34 +0,0 @@
 | 
				
			|||||||
#!/bin/bash
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Copyright 2015 Google Inc. All rights reserved.
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
					 | 
				
			||||||
# you may not use this file except in compliance with the License.
 | 
					 | 
				
			||||||
# You may obtain a copy of the License at
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#     http://www.apache.org/licenses/LICENSE-2.0
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# Unless required by applicable law or agreed to in writing, software
 | 
					 | 
				
			||||||
# distributed under the License is distributed on an "AS IS" BASIS,
 | 
					 | 
				
			||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
					 | 
				
			||||||
# See the License for the specific language governing permissions and
 | 
					 | 
				
			||||||
# limitations under the License.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
set -o errexit
 | 
					 | 
				
			||||||
set -o nounset
 | 
					 | 
				
			||||||
set -o pipefail
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
: ${KUBE_VERSION_ROOT:=${KUBE_ROOT}}
 | 
					 | 
				
			||||||
: ${KUBECTL:="${KUBE_VERSION_ROOT}/cluster/kubectl.sh"}
 | 
					 | 
				
			||||||
: ${KUBE_CONFIG_FILE:="config-test.sh"}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export KUBECTL KUBE_CONFIG_FILE
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
source "${KUBE_ROOT}/cluster/kube-env.sh"
 | 
					 | 
				
			||||||
source "${KUBE_VERSION_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
prepare-e2e
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
test-build-release
 | 
					 | 
				
			||||||
@@ -1,36 +0,0 @@
 | 
				
			|||||||
#!/bin/bash
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Copyright 2015 Google Inc. All rights reserved.
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
					 | 
				
			||||||
# you may not use this file except in compliance with the License.
 | 
					 | 
				
			||||||
# You may obtain a copy of the License at
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#     http://www.apache.org/licenses/LICENSE-2.0
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# Unless required by applicable law or agreed to in writing, software
 | 
					 | 
				
			||||||
# distributed under the License is distributed on an "AS IS" BASIS,
 | 
					 | 
				
			||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
					 | 
				
			||||||
# See the License for the specific language governing permissions and
 | 
					 | 
				
			||||||
# limitations under the License.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
set -o errexit
 | 
					 | 
				
			||||||
set -o nounset
 | 
					 | 
				
			||||||
set -o pipefail
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
: ${KUBE_VERSION_ROOT:=${KUBE_ROOT}}
 | 
					 | 
				
			||||||
: ${KUBECTL:="${KUBE_VERSION_ROOT}/cluster/kubectl.sh"}
 | 
					 | 
				
			||||||
: ${KUBE_CONFIG_FILE:="config-test.sh"}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export KUBECTL KUBE_CONFIG_FILE
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
source "${KUBE_ROOT}/cluster/kube-env.sh"
 | 
					 | 
				
			||||||
source "${KUBE_VERSION_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
prepare-e2e
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
while true; do
 | 
					 | 
				
			||||||
  ${KUBECTL} --watch-only get events
 | 
					 | 
				
			||||||
done
 | 
					 | 
				
			||||||
@@ -1,34 +0,0 @@
 | 
				
			|||||||
#!/bin/bash
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Copyright 2015 Google Inc. All rights reserved.
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
					 | 
				
			||||||
# you may not use this file except in compliance with the License.
 | 
					 | 
				
			||||||
# You may obtain a copy of the License at
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#     http://www.apache.org/licenses/LICENSE-2.0
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# Unless required by applicable law or agreed to in writing, software
 | 
					 | 
				
			||||||
# distributed under the License is distributed on an "AS IS" BASIS,
 | 
					 | 
				
			||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
					 | 
				
			||||||
# See the License for the specific language governing permissions and
 | 
					 | 
				
			||||||
# limitations under the License.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
set -o errexit
 | 
					 | 
				
			||||||
set -o nounset
 | 
					 | 
				
			||||||
set -o pipefail
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
: ${KUBE_VERSION_ROOT:=${KUBE_ROOT}}
 | 
					 | 
				
			||||||
: ${KUBECTL:="${KUBE_VERSION_ROOT}/cluster/kubectl.sh"}
 | 
					 | 
				
			||||||
: ${KUBE_CONFIG_FILE:="config-test.sh"}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export KUBECTL KUBE_CONFIG_FILE
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
source "${KUBE_ROOT}/cluster/kube-env.sh"
 | 
					 | 
				
			||||||
source "${KUBE_VERSION_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
prepare-e2e
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
test-teardown
 | 
					 | 
				
			||||||
@@ -1,34 +0,0 @@
 | 
				
			|||||||
#!/bin/bash
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Copyright 2015 Google Inc. All rights reserved.
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
					 | 
				
			||||||
# you may not use this file except in compliance with the License.
 | 
					 | 
				
			||||||
# You may obtain a copy of the License at
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#     http://www.apache.org/licenses/LICENSE-2.0
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# Unless required by applicable law or agreed to in writing, software
 | 
					 | 
				
			||||||
# distributed under the License is distributed on an "AS IS" BASIS,
 | 
					 | 
				
			||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
					 | 
				
			||||||
# See the License for the specific language governing permissions and
 | 
					 | 
				
			||||||
# limitations under the License.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
set -o errexit
 | 
					 | 
				
			||||||
set -o nounset
 | 
					 | 
				
			||||||
set -o pipefail
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
: ${KUBE_VERSION_ROOT:=${KUBE_ROOT}}
 | 
					 | 
				
			||||||
: ${KUBECTL:="${KUBE_VERSION_ROOT}/cluster/kubectl.sh"}
 | 
					 | 
				
			||||||
: ${KUBE_CONFIG_FILE:="config-test.sh"}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export KUBECTL KUBE_CONFIG_FILE
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
source "${KUBE_ROOT}/cluster/kube-env.sh"
 | 
					 | 
				
			||||||
source "${KUBE_VERSION_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
prepare-e2e
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
"${KUBE_VERSION_ROOT}/cluster/kube-push.sh"
 | 
					 | 
				
			||||||
@@ -1,34 +0,0 @@
 | 
				
			|||||||
#!/bin/bash
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Copyright 2015 Google Inc. All rights reserved.
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
					 | 
				
			||||||
# you may not use this file except in compliance with the License.
 | 
					 | 
				
			||||||
# You may obtain a copy of the License at
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#     http://www.apache.org/licenses/LICENSE-2.0
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# Unless required by applicable law or agreed to in writing, software
 | 
					 | 
				
			||||||
# distributed under the License is distributed on an "AS IS" BASIS,
 | 
					 | 
				
			||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
					 | 
				
			||||||
# See the License for the specific language governing permissions and
 | 
					 | 
				
			||||||
# limitations under the License.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
set -o errexit
 | 
					 | 
				
			||||||
set -o nounset
 | 
					 | 
				
			||||||
set -o pipefail
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
: ${KUBE_VERSION_ROOT:=${KUBE_ROOT}}
 | 
					 | 
				
			||||||
: ${KUBECTL:="${KUBE_VERSION_ROOT}/cluster/kubectl.sh"}
 | 
					 | 
				
			||||||
: ${KUBE_CONFIG_FILE:="config-test.sh"}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export KUBECTL KUBE_CONFIG_FILE
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
source "${KUBE_ROOT}/cluster/kube-env.sh"
 | 
					 | 
				
			||||||
source "${KUBE_VERSION_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
prepare-e2e
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
${KUBECTL} version
 | 
					 | 
				
			||||||
@@ -1,35 +0,0 @@
 | 
				
			|||||||
#!/bin/bash
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Copyright 2015 Google Inc. All rights reserved.
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
					 | 
				
			||||||
# you may not use this file except in compliance with the License.
 | 
					 | 
				
			||||||
# You may obtain a copy of the License at
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#     http://www.apache.org/licenses/LICENSE-2.0
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# Unless required by applicable law or agreed to in writing, software
 | 
					 | 
				
			||||||
# distributed under the License is distributed on an "AS IS" BASIS,
 | 
					 | 
				
			||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
					 | 
				
			||||||
# See the License for the specific language governing permissions and
 | 
					 | 
				
			||||||
# limitations under the License.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
set -o errexit
 | 
					 | 
				
			||||||
set -o nounset
 | 
					 | 
				
			||||||
set -o pipefail
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
: ${KUBE_VERSION_ROOT:=${KUBE_ROOT}}
 | 
					 | 
				
			||||||
: ${KUBECTL:="${KUBE_VERSION_ROOT}/cluster/kubectl.sh"}
 | 
					 | 
				
			||||||
: ${KUBE_CONFIG_FILE:="config-test.sh"}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export KUBECTL KUBE_CONFIG_FILE
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
source "${KUBE_ROOT}/cluster/kube-env.sh"
 | 
					 | 
				
			||||||
source "${KUBE_VERSION_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
prepare-e2e
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
"${KUBE_VERSION_ROOT}/cluster/kube-up.sh"
 | 
					 | 
				
			||||||
test-setup
 | 
					 | 
				
			||||||
@@ -1,34 +0,0 @@
 | 
				
			|||||||
#!/bin/bash
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Copyright 2015 Google Inc. All rights reserved.
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
					 | 
				
			||||||
# you may not use this file except in compliance with the License.
 | 
					 | 
				
			||||||
# You may obtain a copy of the License at
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#     http://www.apache.org/licenses/LICENSE-2.0
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# Unless required by applicable law or agreed to in writing, software
 | 
					 | 
				
			||||||
# distributed under the License is distributed on an "AS IS" BASIS,
 | 
					 | 
				
			||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
					 | 
				
			||||||
# See the License for the specific language governing permissions and
 | 
					 | 
				
			||||||
# limitations under the License.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
set -o errexit
 | 
					 | 
				
			||||||
set -o nounset
 | 
					 | 
				
			||||||
set -o pipefail
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
: ${KUBE_VERSION_ROOT:=${KUBE_ROOT}}
 | 
					 | 
				
			||||||
: ${KUBECTL:="${KUBE_VERSION_ROOT}/cluster/kubectl.sh"}
 | 
					 | 
				
			||||||
: ${KUBE_CONFIG_FILE:="config-test.sh"}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export KUBECTL KUBE_CONFIG_FILE
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
source "${KUBE_ROOT}/cluster/kube-env.sh"
 | 
					 | 
				
			||||||
source "${KUBE_VERSION_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
prepare-e2e
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
${KUBECTL} get minions --no-headers | wc -l
 | 
					 | 
				
			||||||
							
								
								
									
										83
									
								
								hack/e2e.go
									
									
									
									
									
								
							
							
						
						
									
										83
									
								
								hack/e2e.go
									
									
									
									
									
								
							@@ -45,6 +45,7 @@ var (
 | 
				
			|||||||
	test             = flag.Bool("test", false, "Run Ginkgo tests.")
 | 
						test             = flag.Bool("test", false, "Run Ginkgo tests.")
 | 
				
			||||||
	root             = flag.String("root", absOrDie(filepath.Clean(filepath.Join(path.Base(os.Args[0]), ".."))), "Root directory of kubernetes repository.")
 | 
						root             = flag.String("root", absOrDie(filepath.Clean(filepath.Join(path.Base(os.Args[0]), ".."))), "Root directory of kubernetes repository.")
 | 
				
			||||||
	verbose          = flag.Bool("v", false, "If true, print all command output.")
 | 
						verbose          = flag.Bool("v", false, "If true, print all command output.")
 | 
				
			||||||
 | 
						trace_bash       = flag.Bool("trace-bash", false, "If true, pass -x to bash to trace all bash commands")
 | 
				
			||||||
	checkVersionSkew = flag.Bool("check_version_skew", true, ""+
 | 
						checkVersionSkew = flag.Bool("check_version_skew", true, ""+
 | 
				
			||||||
		"By default, verify that client and server have exact version match. "+
 | 
							"By default, verify that client and server have exact version match. "+
 | 
				
			||||||
		"You can explicitly set to false if you're, e.g., testing client changes "+
 | 
							"You can explicitly set to false if you're, e.g., testing client changes "+
 | 
				
			||||||
@@ -100,11 +101,7 @@ func main() {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if *build {
 | 
						if *build {
 | 
				
			||||||
		// The build-release script needs stdin to ask the user whether
 | 
							if !runBash("build-release", `test-build-release`) {
 | 
				
			||||||
		// it's OK to download the docker image.
 | 
					 | 
				
			||||||
		cmd := exec.Command(path.Join(*root, "hack/e2e-internal/build-release.sh"))
 | 
					 | 
				
			||||||
		cmd.Stdin = os.Stdin
 | 
					 | 
				
			||||||
		if !finishRunning("build-release", cmd) {
 | 
					 | 
				
			||||||
			log.Fatal("Error building. Aborting.")
 | 
								log.Fatal("Error building. Aborting.")
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -141,7 +138,7 @@ func main() {
 | 
				
			|||||||
			log.Fatal("Error starting e2e cluster. Aborting.")
 | 
								log.Fatal("Error starting e2e cluster. Aborting.")
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	} else if *push {
 | 
						} else if *push {
 | 
				
			||||||
		if !finishRunning("push", exec.Command(path.Join(*root, "hack/e2e-internal/e2e-push.sh"))) {
 | 
							if !runBash("push", path.Join(versionRoot, "/cluster/kube-push.sh")) {
 | 
				
			||||||
			log.Fatal("Error pushing e2e cluster. Aborting.")
 | 
								log.Fatal("Error pushing e2e cluster. Aborting.")
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -149,8 +146,7 @@ func main() {
 | 
				
			|||||||
	failure := false
 | 
						failure := false
 | 
				
			||||||
	switch {
 | 
						switch {
 | 
				
			||||||
	case *ctlCmd != "":
 | 
						case *ctlCmd != "":
 | 
				
			||||||
		ctlArgs := strings.Fields(*ctlCmd)
 | 
							failure = !runBash("'kubectl "+*ctlCmd+"'", "$KUBECTL "+*ctlCmd)
 | 
				
			||||||
		failure = !finishRunning("'kubectl "+*ctlCmd+"'", exec.Command(path.Join(versionRoot, "cluster/kubectl.sh"), ctlArgs...))
 | 
					 | 
				
			||||||
	case *test:
 | 
						case *test:
 | 
				
			||||||
		failure = Test()
 | 
							failure = Test()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -165,7 +161,7 @@ func main() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func TearDown() bool {
 | 
					func TearDown() bool {
 | 
				
			||||||
	return finishRunning("teardown", exec.Command(path.Join(*root, "hack/e2e-internal/e2e-down.sh")))
 | 
						return runBash("teardown", "test-teardown")
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Up brings an e2e cluster up, recreating it if one is already running.
 | 
					// Up brings an e2e cluster up, recreating it if one is already running.
 | 
				
			||||||
@@ -177,13 +173,15 @@ func Up() bool {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return finishRunning("up", exec.Command(path.Join(*root, "hack/e2e-internal/e2e-up.sh")))
 | 
						return runBash("up", path.Join(versionRoot, "/cluster/kube-up.sh; test-setup;"))
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Ensure that the cluster is large engough to run the e2e tests.
 | 
					// Ensure that the cluster is large engough to run the e2e tests.
 | 
				
			||||||
func ValidateClusterSize() {
 | 
					func ValidateClusterSize() {
 | 
				
			||||||
	// Check that there are at least 3 minions running
 | 
						// Check that there are at least 3 minions running
 | 
				
			||||||
	res, stdout, _ := finishRunningWithOutputs("validate cluster size", exec.Command(path.Join(*root, "hack/e2e-internal/e2e-watch-events.sh")))
 | 
						res, stdout, _ := runBashWithOutputs(
 | 
				
			||||||
 | 
							"validate cluster size",
 | 
				
			||||||
 | 
							"cluster/kubectl.sh get minions --no-headers | wc -l")
 | 
				
			||||||
	if !res {
 | 
						if !res {
 | 
				
			||||||
		log.Fatal("Could not get nodes to validate cluster size")
 | 
							log.Fatal("Could not get nodes to validate cluster size")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -200,7 +198,7 @@ func ValidateClusterSize() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// Is the e2e cluster up?
 | 
					// Is the e2e cluster up?
 | 
				
			||||||
func IsUp() bool {
 | 
					func IsUp() bool {
 | 
				
			||||||
	return finishRunning("get status", exec.Command(path.Join(*root, "hack/e2e-internal/e2e-status.sh")))
 | 
						return runBash("get status", `$KUBECTL version`)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// PrepareVersion makes sure that the specified release version is locally
 | 
					// PrepareVersion makes sure that the specified release version is locally
 | 
				
			||||||
@@ -243,7 +241,7 @@ func PrepareVersion(version string) (string, error) {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		out.Close()
 | 
							out.Close()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if !finishRunning("untarRelease", exec.Command("tar", "-C", localReleaseDir, "-zxf", localReleaseTar, "--strip-components=1")) {
 | 
						if !runRawBash("untarRelease", fmt.Sprintf("tar -C %s -zxf %s --strip-components=1", localReleaseDir, localReleaseTar)) {
 | 
				
			||||||
		log.Fatal("Failed to untar release. Aborting.")
 | 
							log.Fatal("Failed to untar release. Aborting.")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	// Now that we have the binaries saved locally, use the path to the untarred
 | 
						// Now that we have the binaries saved locally, use the path to the untarred
 | 
				
			||||||
@@ -260,7 +258,7 @@ func shuffleStrings(strings []string, r *rand.Rand) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func Test() bool {
 | 
					func Test() bool {
 | 
				
			||||||
	defer runBashUntil("watchEvents", exec.Command(filepath.Join(*root, "hack/e2e-internal/e2e-watch-events.sh")))()
 | 
						defer runBashUntil("watchEvents", "while true; do $KUBECTL --watch-only get events; done")()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if !IsUp() {
 | 
						if !IsUp() {
 | 
				
			||||||
		log.Fatal("Testing requested, but e2e cluster not up!")
 | 
							log.Fatal("Testing requested, but e2e cluster not up!")
 | 
				
			||||||
@@ -268,13 +266,38 @@ func Test() bool {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	ValidateClusterSize()
 | 
						ValidateClusterSize()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return finishRunning("Ginkgo tests", exec.Command(filepath.Join(*root, "hack/ginkgo-e2e.sh")))
 | 
						return runBash("Ginkgo tests", filepath.Join(*root, "hack", "ginkgo-e2e.sh"))
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// All nonsense below is temporary until we have go versions of these things.
 | 
					// All nonsense below is temporary until we have go versions of these things.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Runs the provided bash without wrapping it in any kubernetes-specific gunk.
 | 
				
			||||||
 | 
					func runRawBashWithOutputs(stepName, bash string) (bool, string, string) {
 | 
				
			||||||
 | 
						cmd := exec.Command("bash", "-s")
 | 
				
			||||||
 | 
						if *trace_bash {
 | 
				
			||||||
 | 
							cmd.Args = append(cmd.Args, "-x")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						cmd.Stdin = strings.NewReader(bash)
 | 
				
			||||||
 | 
						return finishRunning(stepName, cmd)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func runRawBash(stepName, bashFragment string) bool {
 | 
				
			||||||
 | 
						result, _, _ := runRawBashWithOutputs(stepName, bashFragment)
 | 
				
			||||||
 | 
						return result
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func runBashWithOutputs(stepName, bashFragment string) (bool, string, string) {
 | 
				
			||||||
 | 
						return runRawBashWithOutputs(stepName, bashWrap(bashFragment))
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func runBash(stepName, bashFragment string) bool {
 | 
				
			||||||
 | 
						return runRawBash(stepName, bashWrap(bashFragment))
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// call the returned anonymous function to stop.
 | 
					// call the returned anonymous function to stop.
 | 
				
			||||||
func runBashUntil(stepName string, cmd *exec.Cmd) func() {
 | 
					func runBashUntil(stepName, bashFragment string) func() {
 | 
				
			||||||
 | 
						cmd := exec.Command("bash", "-s")
 | 
				
			||||||
 | 
						cmd.Stdin = strings.NewReader(bashWrap(bashFragment))
 | 
				
			||||||
	log.Printf("Running in background: %v", stepName)
 | 
						log.Printf("Running in background: %v", stepName)
 | 
				
			||||||
	stdout, stderr := bytes.NewBuffer(nil), bytes.NewBuffer(nil)
 | 
						stdout, stderr := bytes.NewBuffer(nil), bytes.NewBuffer(nil)
 | 
				
			||||||
	cmd.Stdout, cmd.Stderr = stdout, stderr
 | 
						cmd.Stdout, cmd.Stderr = stdout, stderr
 | 
				
			||||||
@@ -290,7 +313,7 @@ func runBashUntil(stepName string, cmd *exec.Cmd) func() {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func finishRunningWithOutputs(stepName string, cmd *exec.Cmd) (bool, string, string) {
 | 
					func finishRunning(stepName string, cmd *exec.Cmd) (bool, string, string) {
 | 
				
			||||||
	log.Printf("Running: %v", stepName)
 | 
						log.Printf("Running: %v", stepName)
 | 
				
			||||||
	stdout, stderr := bytes.NewBuffer(nil), bytes.NewBuffer(nil)
 | 
						stdout, stderr := bytes.NewBuffer(nil), bytes.NewBuffer(nil)
 | 
				
			||||||
	if *verbose {
 | 
						if *verbose {
 | 
				
			||||||
@@ -321,11 +344,6 @@ func finishRunningWithOutputs(stepName string, cmd *exec.Cmd) (bool, string, str
 | 
				
			|||||||
	return true, string(stdout.Bytes()), string(stderr.Bytes())
 | 
						return true, string(stdout.Bytes()), string(stderr.Bytes())
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func finishRunning(stepName string, cmd *exec.Cmd) bool {
 | 
					 | 
				
			||||||
	result, _, _ := finishRunningWithOutputs(stepName, cmd)
 | 
					 | 
				
			||||||
	return result
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func printBashOutputs(headerprefix, lineprefix, stdout, stderr string, escape bool) {
 | 
					func printBashOutputs(headerprefix, lineprefix, stdout, stderr string, escape bool) {
 | 
				
			||||||
	// The |'s (plus appropriate prefixing) are to make this look
 | 
						// The |'s (plus appropriate prefixing) are to make this look
 | 
				
			||||||
	// "YAMLish" to the Jenkins TAP plugin:
 | 
						// "YAMLish" to the Jenkins TAP plugin:
 | 
				
			||||||
@@ -380,3 +398,24 @@ func kubectlArgs() string {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	return ""
 | 
						return ""
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func bashWrap(cmd string) string {
 | 
				
			||||||
 | 
						return `
 | 
				
			||||||
 | 
					set -o errexit
 | 
				
			||||||
 | 
					set -o nounset
 | 
				
			||||||
 | 
					set -o pipefail
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export KUBE_CONFIG_FILE="config-test.sh"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# TODO(jbeda): This will break on usage if there is a space in
 | 
				
			||||||
 | 
					# ${KUBE_ROOT}.  Convert to an array?  Or an exported function?
 | 
				
			||||||
 | 
					export KUBECTL="` + versionRoot + `/cluster/kubectl.sh` + kubectlArgs() + `"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					source "` + *root + `/cluster/kube-env.sh"
 | 
				
			||||||
 | 
					source "` + versionRoot + `/cluster/${KUBERNETES_PROVIDER}/util.sh"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					prepare-e2e
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					` + cmd + `
 | 
				
			||||||
 | 
					`
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -55,7 +55,6 @@ readonly KUBE_TEST_PORTABLE=(
 | 
				
			|||||||
  contrib/for-tests/network-tester/service.json
 | 
					  contrib/for-tests/network-tester/service.json
 | 
				
			||||||
  hack/e2e.go
 | 
					  hack/e2e.go
 | 
				
			||||||
  hack/e2e-suite
 | 
					  hack/e2e-suite
 | 
				
			||||||
  hack/e2e-internal
 | 
					 | 
				
			||||||
  hack/ginkgo-e2e.sh
 | 
					  hack/ginkgo-e2e.sh
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user