mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 23:15:14 +00:00
Merge pull request #21430 from spxtr/e2e-internal
Auto commit by PR queue bot
This commit is contained in:
commit
1ce188e557
@ -1446,11 +1446,13 @@ function test-build-release {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Execute prior to running tests to initialize required structure. This is
|
# Execute prior to running tests to initialize required structure. This is
|
||||||
# called from hack/e2e.go only when running -up (it is run after kube-up).
|
# called from hack/e2e.go only when running -up.
|
||||||
#
|
#
|
||||||
# Assumed vars:
|
# Assumed vars:
|
||||||
# Variables from config.sh
|
# Variables from config.sh
|
||||||
function test-setup {
|
function test-setup {
|
||||||
|
"${KUBE_ROOT}/cluster/kube-up.sh"
|
||||||
|
|
||||||
VPC_ID=$(get_vpc_id)
|
VPC_ID=$(get_vpc_id)
|
||||||
detect-security-groups
|
detect-security-groups
|
||||||
|
|
||||||
|
@ -1192,7 +1192,7 @@ function test-build-release {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Execute prior to running tests to initialize required structure. This is
|
# Execute prior to running tests to initialize required structure. This is
|
||||||
# called from hack/e2e.go only when running -up (it is run after kube-up).
|
# called from hack/e2e.go only when running -up.
|
||||||
#
|
#
|
||||||
# Assumed vars:
|
# Assumed vars:
|
||||||
# Variables from config.sh
|
# Variables from config.sh
|
||||||
@ -1200,6 +1200,16 @@ function test-setup {
|
|||||||
# Detect the project into $PROJECT if it isn't set
|
# Detect the project into $PROJECT if it isn't set
|
||||||
detect-project
|
detect-project
|
||||||
|
|
||||||
|
if [[ ${MULTIZONE:-} == "true" ]]; then
|
||||||
|
for KUBE_GCE_ZONE in ${E2E_ZONES}
|
||||||
|
do
|
||||||
|
KUBE_GCE_ZONE="${KUBE_GCE_ZONE}" KUBE_USE_EXISTING_MASTER="${KUBE_USE_EXISTING_MASTER:-}" "${KUBE_ROOT}/cluster/kube-up.sh"
|
||||||
|
KUBE_USE_EXISTING_MASTER="true" # For subsequent zones we use the existing master
|
||||||
|
done
|
||||||
|
else
|
||||||
|
"${KUBE_ROOT}/cluster/kube-up.sh"
|
||||||
|
fi
|
||||||
|
|
||||||
# Open up port 80 & 8080 so common containers on minions can be reached
|
# Open up port 80 & 8080 so common containers on minions can be reached
|
||||||
# TODO(roberthbailey): Remove this once we are no longer relying on hostPorts.
|
# TODO(roberthbailey): Remove this once we are no longer relying on hostPorts.
|
||||||
local start=`date +%s`
|
local start=`date +%s`
|
||||||
|
@ -167,6 +167,9 @@ function test-setup() {
|
|||||||
echo "... in gke:test-setup()" >&2
|
echo "... in gke:test-setup()" >&2
|
||||||
# Detect the project into $PROJECT if it isn't set
|
# Detect the project into $PROJECT if it isn't set
|
||||||
detect-project >&2
|
detect-project >&2
|
||||||
|
|
||||||
|
"${KUBE_ROOT}/cluster/kube-up.sh"
|
||||||
|
|
||||||
detect-nodes >&2
|
detect-nodes >&2
|
||||||
|
|
||||||
# At this point, CLUSTER_NAME should have been used, so its value is final.
|
# At this point, CLUSTER_NAME should have been used, so its value is final.
|
||||||
|
@ -165,9 +165,9 @@ function test-build-release {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Execute prior to running tests to initialize required structure. This is
|
# Execute prior to running tests to initialize required structure. This is
|
||||||
# called from hack/e2e.go only when running -up (it is run after kube-up).
|
# called from hack/e2e.go only when running -up.
|
||||||
function test-setup {
|
function test-setup {
|
||||||
echo "test-setup() " 1>&2
|
"${KUBE_ROOT}/cluster/kube-up.sh"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Execute after running tests to perform any required clean-up. This is called
|
# Execute after running tests to perform any required clean-up. This is called
|
||||||
|
@ -316,7 +316,7 @@ function test-build-release {
|
|||||||
|
|
||||||
# Execute prior to running tests to initialize required structure
|
# Execute prior to running tests to initialize required structure
|
||||||
function test-setup {
|
function test-setup {
|
||||||
echo "TODO"
|
"${KUBE_ROOT}/cluster/kube-up.sh"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Execute after running tests to perform any required clean-up
|
# Execute after running tests to perform any required clean-up
|
||||||
|
@ -317,7 +317,8 @@ function kube-down {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function test-setup {
|
function test-setup {
|
||||||
echo "TODO: test-setup" 1>&2
|
echo "test-setup" 1>&2
|
||||||
|
"${KUBE_ROOT}/cluster/kube-up.sh"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Execute after running tests to perform any required clean-up
|
# Execute after running tests to perform any required clean-up
|
||||||
|
@ -319,6 +319,7 @@ function test-build-release {
|
|||||||
|
|
||||||
# Execute prior to running tests to initialize required structure
|
# Execute prior to running tests to initialize required structure
|
||||||
function test-setup {
|
function test-setup {
|
||||||
|
"${KUBE_ROOT}/cluster/kube-up.sh"
|
||||||
echo "Vagrant test setup complete" 1>&2
|
echo "Vagrant test setup complete" 1>&2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,14 +31,4 @@ source "${KUBE_VERSION_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh"
|
|||||||
|
|
||||||
prepare-e2e
|
prepare-e2e
|
||||||
|
|
||||||
if [[ ${MULTIZONE:-} == "true" ]]; then
|
|
||||||
for KUBE_GCE_ZONE in ${E2E_ZONES}
|
|
||||||
do
|
|
||||||
KUBE_GCE_ZONE="${KUBE_GCE_ZONE}" KUBE_USE_EXISTING_MASTER="${KUBE_USE_EXISTING_MASTER:-}" KUBE_TEST_DEBUG=y "${KUBE_VERSION_ROOT}/cluster/kube-up.sh"
|
|
||||||
KUBE_USE_EXISTING_MASTER="true" # For subsequent zones we use the existing master
|
|
||||||
done
|
|
||||||
else
|
|
||||||
KUBE_TEST_DEBUG=y "${KUBE_VERSION_ROOT}/cluster/kube-up.sh"
|
|
||||||
fi
|
|
||||||
|
|
||||||
test-setup
|
test-setup
|
||||||
|
44
hack/e2e.go
44
hack/e2e.go
@ -18,12 +18,10 @@ limitations under the License.
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"math/rand"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
@ -124,6 +122,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
os.Setenv("KUBECTL", versionRoot+`/cluster/kubectl.sh`+kubectlArgs())
|
os.Setenv("KUBECTL", versionRoot+`/cluster/kubectl.sh`+kubectlArgs())
|
||||||
|
os.Setenv("KUBE_TEST_DEBUG", "y")
|
||||||
|
|
||||||
if *pushup {
|
if *pushup {
|
||||||
if IsUp() {
|
if IsUp() {
|
||||||
@ -177,7 +176,6 @@ func Up() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return finishRunning("up", exec.Command(path.Join(*root, "hack/e2e-internal/e2e-up.sh")))
|
return finishRunning("up", exec.Command(path.Join(*root, "hack/e2e-internal/e2e-up.sh")))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,14 +254,6 @@ func PrepareVersion(version string) (string, error) {
|
|||||||
return localReleaseDir, nil
|
return localReleaseDir, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fisher-Yates shuffle using the given RNG r
|
|
||||||
func shuffleStrings(strings []string, r *rand.Rand) {
|
|
||||||
for i := len(strings) - 1; i > 0; i-- {
|
|
||||||
j := r.Intn(i + 1)
|
|
||||||
strings[i], strings[j] = strings[j], strings[i]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func Test() bool {
|
func Test() bool {
|
||||||
if !IsUp() {
|
if !IsUp() {
|
||||||
log.Fatal("Testing requested, but e2e cluster not up!")
|
log.Fatal("Testing requested, but e2e cluster not up!")
|
||||||
@ -274,25 +264,6 @@ func Test() bool {
|
|||||||
return finishRunning("Ginkgo tests", exec.Command(filepath.Join(*root, "hack/ginkgo-e2e.sh"), strings.Fields(*testArgs)...))
|
return finishRunning("Ginkgo tests", exec.Command(filepath.Join(*root, "hack/ginkgo-e2e.sh"), strings.Fields(*testArgs)...))
|
||||||
}
|
}
|
||||||
|
|
||||||
// All nonsense below is temporary until we have go versions of these things.
|
|
||||||
|
|
||||||
// call the returned anonymous function to stop.
|
|
||||||
func runBashUntil(stepName string, cmd *exec.Cmd) func() {
|
|
||||||
log.Printf("Running in background: %v", stepName)
|
|
||||||
output := bytes.NewBuffer(nil)
|
|
||||||
cmd.Stdout, cmd.Stderr = output, output
|
|
||||||
if err := cmd.Start(); err != nil {
|
|
||||||
log.Printf("Unable to start '%v': '%v'", stepName, err)
|
|
||||||
return func() {}
|
|
||||||
}
|
|
||||||
return func() {
|
|
||||||
cmd.Process.Signal(os.Interrupt)
|
|
||||||
headerprefix := stepName + " "
|
|
||||||
lineprefix := " "
|
|
||||||
printBashOutputs(headerprefix, lineprefix, string(output.Bytes()), false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func finishRunning(stepName string, cmd *exec.Cmd) bool {
|
func finishRunning(stepName string, cmd *exec.Cmd) bool {
|
||||||
if *verbose {
|
if *verbose {
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
@ -310,19 +281,6 @@ func finishRunning(stepName string, cmd *exec.Cmd) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func printBashOutputs(headerprefix, lineprefix, output string, escape bool) {
|
|
||||||
if output != "" {
|
|
||||||
fmt.Printf("%voutput: |\n", headerprefix)
|
|
||||||
printPrefixedLines(lineprefix, output)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func printPrefixedLines(prefix, s string) {
|
|
||||||
for _, line := range strings.Split(s, "\n") {
|
|
||||||
fmt.Printf("%v%v\n", prefix, line)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// returns either "", or a list of args intended for appending with the
|
// returns either "", or a list of args intended for appending with the
|
||||||
// kubectl command (beginning with a space).
|
// kubectl command (beginning with a space).
|
||||||
func kubectlArgs() string {
|
func kubectlArgs() string {
|
||||||
|
Loading…
Reference in New Issue
Block a user