mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Revert "Revert "Use native Ginkgo test runner instead of cmd/e2e (attempt N)""
This reverts commit f4bb6aa37d.
			
			
This commit is contained in:
		@@ -1,88 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
Copyright 2015 The Kubernetes Authors 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.
 | 
					 | 
				
			||||||
*/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
package main
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import (
 | 
					 | 
				
			||||||
	"fmt"
 | 
					 | 
				
			||||||
	"os"
 | 
					 | 
				
			||||||
	goruntime "runtime"
 | 
					 | 
				
			||||||
	"strings"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	"github.com/GoogleCloudPlatform/kubernetes/pkg/client/clientcmd"
 | 
					 | 
				
			||||||
	"github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider"
 | 
					 | 
				
			||||||
	"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
 | 
					 | 
				
			||||||
	"github.com/GoogleCloudPlatform/kubernetes/test/e2e"
 | 
					 | 
				
			||||||
	"github.com/golang/glog"
 | 
					 | 
				
			||||||
	flag "github.com/spf13/pflag"
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
var (
 | 
					 | 
				
			||||||
	context     = &e2e.TestContextType{}
 | 
					 | 
				
			||||||
	cloudConfig = &context.CloudConfig
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	orderseed = flag.Int64("orderseed", 0, "If non-zero, seed of random test shuffle order. (Otherwise random.)")
 | 
					 | 
				
			||||||
	reportDir = flag.String("report-dir", "", "Path to the directory where the JUnit XML reports should be saved. Default is empty, which doesn't generate these reports.")
 | 
					 | 
				
			||||||
	times     = flag.Int("times", 1, "Number of times each test is eligible to be run. Individual order is determined by shuffling --times instances of each test using --orderseed (like a multi-deck shoe of cards).")
 | 
					 | 
				
			||||||
	testList  util.StringList
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func init() {
 | 
					 | 
				
			||||||
	flag.VarP(&testList, "test", "t", "Test to execute (may be repeated or comma separated list of tests.) Defaults to running all tests.")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	flag.StringVar(&context.KubeConfig, clientcmd.RecommendedConfigPathFlag, "", "Path to kubeconfig containing embeded authinfo.")
 | 
					 | 
				
			||||||
	flag.StringVar(&context.KubeContext, clientcmd.FlagContext, "", "kubeconfig context to use/override. If unset, will use value from 'current-context'")
 | 
					 | 
				
			||||||
	flag.StringVar(&context.CertDir, "cert-dir", "", "Path to the directory containing the certs. Default is empty, which doesn't use certs.")
 | 
					 | 
				
			||||||
	flag.StringVar(&context.Host, "host", "", "The host, or apiserver, to connect to")
 | 
					 | 
				
			||||||
	flag.StringVar(&context.RepoRoot, "repo-root", "./", "Root directory of kubernetes repository, for finding test files. Default assumes working directory is repository root")
 | 
					 | 
				
			||||||
	flag.StringVar(&context.Provider, "provider", "", "The name of the Kubernetes provider (gce, gke, local, vagrant, etc.)")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// TODO: Flags per provider?  Rename gce_project/gce_zone?
 | 
					 | 
				
			||||||
	flag.StringVar(&cloudConfig.MasterName, "kube-master", "", "Name of the kubernetes master. Only required if provider is gce or gke")
 | 
					 | 
				
			||||||
	flag.StringVar(&cloudConfig.ProjectID, "gce-project", "", "The GCE project being used, if applicable")
 | 
					 | 
				
			||||||
	flag.StringVar(&cloudConfig.Zone, "gce-zone", "", "GCE zone being used, if applicable")
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func main() {
 | 
					 | 
				
			||||||
	util.InitFlags()
 | 
					 | 
				
			||||||
	goruntime.GOMAXPROCS(goruntime.NumCPU())
 | 
					 | 
				
			||||||
	if context.Provider == "" {
 | 
					 | 
				
			||||||
		glog.Info("The --provider flag is not set.  Treating as a conformance test.  Some tests may not be run.")
 | 
					 | 
				
			||||||
		os.Exit(1)
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if *times <= 0 {
 | 
					 | 
				
			||||||
		glog.Error("Invalid --times (negative or no testing requested)!")
 | 
					 | 
				
			||||||
		os.Exit(1)
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if context.Provider == "aws" {
 | 
					 | 
				
			||||||
		awsConfig := "[Global]\n"
 | 
					 | 
				
			||||||
		if cloudConfig.Zone == "" {
 | 
					 | 
				
			||||||
			glog.Error("--gce-zone must be specified for AWS")
 | 
					 | 
				
			||||||
			os.Exit(1)
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		awsConfig += fmt.Sprintf("Zone=%s\n", cloudConfig.Zone)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		var err error
 | 
					 | 
				
			||||||
		cloudConfig.Provider, err = cloudprovider.GetCloudProvider(context.Provider, strings.NewReader(awsConfig))
 | 
					 | 
				
			||||||
		if err != nil {
 | 
					 | 
				
			||||||
			glog.Error("Error building AWS provider: ", err)
 | 
					 | 
				
			||||||
			os.Exit(1)
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	e2e.RunE2ETests(context, *orderseed, *times, *reportDir, testList)
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -18,54 +18,18 @@ set -o errexit
 | 
				
			|||||||
set -o nounset
 | 
					set -o nounset
 | 
				
			||||||
set -o pipefail
 | 
					set -o pipefail
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					GINKGO_PARALLEL=${GINKGO_PARALLEL:-n} # set to 'y' to run tests in parallel
 | 
				
			||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
 | 
					KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
 | 
				
			||||||
 | 
					
 | 
				
			||||||
source "${KUBE_ROOT}/cluster/common.sh"
 | 
					source "${KUBE_ROOT}/cluster/common.sh"
 | 
				
			||||||
 | 
					source "${KUBE_ROOT}/hack/lib/init.sh"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# --- Find local test binaries.
 | 
					# Ginkgo will build the e2e tests, so we need to make sure that the environment
 | 
				
			||||||
 | 
					# is set up correctly (including Godeps, etc).
 | 
				
			||||||
# Detect the OS name/arch so that we can find our binary
 | 
					kube::golang::setup_env
 | 
				
			||||||
case "$(uname -s)" in
 | 
					# Find the ginkgo binary build as part of the release.
 | 
				
			||||||
  Darwin)
 | 
					ginkgo=$(kube::util::find-binary "ginkgo")
 | 
				
			||||||
    host_os=darwin
 | 
					e2e_test=$(kube::util::find-binary "e2e.test")
 | 
				
			||||||
    ;;
 | 
					 | 
				
			||||||
  Linux)
 | 
					 | 
				
			||||||
    host_os=linux
 | 
					 | 
				
			||||||
    ;;
 | 
					 | 
				
			||||||
  *)
 | 
					 | 
				
			||||||
    echo "Unsupported host OS.  Must be Linux or Mac OS X." >&2
 | 
					 | 
				
			||||||
    exit 1
 | 
					 | 
				
			||||||
    ;;
 | 
					 | 
				
			||||||
esac
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
case "$(uname -m)" in
 | 
					 | 
				
			||||||
  x86_64*)
 | 
					 | 
				
			||||||
    host_arch=amd64
 | 
					 | 
				
			||||||
    ;;
 | 
					 | 
				
			||||||
  i?86_64*)
 | 
					 | 
				
			||||||
    host_arch=amd64
 | 
					 | 
				
			||||||
    ;;
 | 
					 | 
				
			||||||
  amd64*)
 | 
					 | 
				
			||||||
    host_arch=amd64
 | 
					 | 
				
			||||||
    ;;
 | 
					 | 
				
			||||||
  arm*)
 | 
					 | 
				
			||||||
    host_arch=arm
 | 
					 | 
				
			||||||
    ;;
 | 
					 | 
				
			||||||
  i?86*)
 | 
					 | 
				
			||||||
    host_arch=x86
 | 
					 | 
				
			||||||
    ;;
 | 
					 | 
				
			||||||
  *)
 | 
					 | 
				
			||||||
    echo "Unsupported host arch. Must be x86_64, 386 or arm." >&2
 | 
					 | 
				
			||||||
    exit 1
 | 
					 | 
				
			||||||
    ;;
 | 
					 | 
				
			||||||
esac
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Gather up the list of likely places and use ls to find the latest one.
 | 
					 | 
				
			||||||
locations=(
 | 
					 | 
				
			||||||
  "${KUBE_ROOT}/_output/dockerized/bin/${host_os}/${host_arch}/e2e"
 | 
					 | 
				
			||||||
  "${KUBE_ROOT}/_output/local/bin/${host_os}/${host_arch}/e2e"
 | 
					 | 
				
			||||||
  "${KUBE_ROOT}/platforms/${host_os}/${host_arch}/e2e"
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
e2e=$( (ls -t "${locations[@]}" 2>/dev/null || true) | head -1 )
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# --- Setup some env vars.
 | 
					# --- Setup some env vars.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -89,8 +53,8 @@ if [[ -z "${AUTH_CONFIG:-}" ]];  then
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if [[ "${KUBERNETES_PROVIDER}" == "conformance_test" ]]; then
 | 
					    if [[ "${KUBERNETES_PROVIDER}" == "conformance_test" ]]; then
 | 
				
			||||||
      auth_config=(
 | 
					      auth_config=(
 | 
				
			||||||
        "--auth_config=${KUBERNETES_CONFORMANCE_TEST_AUTH_CONFIG:-}"
 | 
					        "--auth-config=${KUBERNETES_CONFORMANCE_TEST_AUTH_CONFIG:-}"
 | 
				
			||||||
        "--cert_dir=${KUBERNETES_CONFORMANCE_TEST_CERT_DIR:-}"
 | 
					        "--cert-dir=${KUBERNETES_CONFORMANCE_TEST_CERT_DIR:-}"
 | 
				
			||||||
      )
 | 
					      )
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      auth_config=(
 | 
					      auth_config=(
 | 
				
			||||||
@@ -108,21 +72,26 @@ else
 | 
				
			|||||||
  echo "Conformance Test.  No cloud-provider-specific preparation."
 | 
					  echo "Conformance Test.  No cloud-provider-specific preparation."
 | 
				
			||||||
  KUBERNETES_PROVIDER=""
 | 
					  KUBERNETES_PROVIDER=""
 | 
				
			||||||
  auth_config=(
 | 
					  auth_config=(
 | 
				
			||||||
    "--auth_config=${AUTH_CONFIG:-}"
 | 
					    "--auth-config=${AUTH_CONFIG:-}"
 | 
				
			||||||
    "--cert_dir=${CERT_DIR:-}"
 | 
					    "--cert-dir=${CERT_DIR:-}"
 | 
				
			||||||
  )
 | 
					  )
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Use the kubectl binary from the same directory as the e2e binary.
 | 
					ginkgo_args=()
 | 
				
			||||||
 | 
					if [[ ${GINKGO_PARALLEL} =~ ^[yY]$ ]]; then
 | 
				
			||||||
 | 
					  ginkgo_args+=("-p")
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# The --host setting is used only when providing --auth_config
 | 
					# The --host setting is used only when providing --auth_config
 | 
				
			||||||
# If --kubeconfig is used, the host to use is retrieved from the .kubeconfig
 | 
					# If --kubeconfig is used, the host to use is retrieved from the .kubeconfig
 | 
				
			||||||
# file and the one provided with --host is ignored.
 | 
					# file and the one provided with --host is ignored.
 | 
				
			||||||
export PATH=$(dirname "${e2e}"):"${PATH}"
 | 
					"${ginkgo}" "${ginkgo_args[@]:+${ginkgo_args[@]}}" "${e2e_test}" -- \
 | 
				
			||||||
"${e2e}" "${auth_config[@]:+${auth_config[@]}}" \
 | 
					  "${auth_config[@]:+${auth_config[@]}}" \
 | 
				
			||||||
  --host="https://${KUBE_MASTER_IP-}" \
 | 
					  --host="https://${KUBE_MASTER_IP-}" \
 | 
				
			||||||
  --provider="${KUBERNETES_PROVIDER}" \
 | 
					  --provider="${KUBERNETES_PROVIDER}" \
 | 
				
			||||||
  --gce_project="${PROJECT:-}" \
 | 
					  --gce-project="${PROJECT:-}" \
 | 
				
			||||||
  --gce_zone="${ZONE:-}" \
 | 
					  --gce-zone="${ZONE:-}" \
 | 
				
			||||||
  --kube_master="${KUBE_MASTER:-}" \
 | 
					  --kube-master="${KUBE_MASTER:-}" \
 | 
				
			||||||
  ${E2E_REPORT_DIR+"--report_dir=${E2E_REPORT_DIR}"} \
 | 
					  --repo-root="${KUBE_VERSION_ROOT}" \
 | 
				
			||||||
 | 
					  ${E2E_REPORT_DIR+"--report-dir=${E2E_REPORT_DIR}"} \
 | 
				
			||||||
  "${@:-}"
 | 
					  "${@:-}"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -44,13 +44,13 @@ readonly KUBE_CLIENT_BINARIES_WIN=("${KUBE_CLIENT_BINARIES[@]/%/.exe}")
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# The set of test targets that we are building for all platforms
 | 
					# The set of test targets that we are building for all platforms
 | 
				
			||||||
readonly KUBE_TEST_TARGETS=(
 | 
					readonly KUBE_TEST_TARGETS=(
 | 
				
			||||||
  cmd/e2e
 | 
					 | 
				
			||||||
  cmd/integration
 | 
					  cmd/integration
 | 
				
			||||||
  cmd/gendocs
 | 
					  cmd/gendocs
 | 
				
			||||||
  cmd/genman
 | 
					  cmd/genman
 | 
				
			||||||
  cmd/genbashcomp
 | 
					  cmd/genbashcomp
 | 
				
			||||||
  examples/k8petstore/web-server
 | 
					  examples/k8petstore/web-server
 | 
				
			||||||
  github.com/onsi/ginkgo/ginkgo
 | 
					  github.com/onsi/ginkgo/ginkgo
 | 
				
			||||||
 | 
					  test/e2e/e2e.test
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
readonly KUBE_TEST_BINARIES=("${KUBE_TEST_TARGETS[@]##*/}")
 | 
					readonly KUBE_TEST_BINARIES=("${KUBE_TEST_TARGETS[@]##*/}")
 | 
				
			||||||
readonly KUBE_TEST_BINARIES_WIN=("${KUBE_TEST_BINARIES[@]/%/.exe}")
 | 
					readonly KUBE_TEST_BINARIES_WIN=("${KUBE_TEST_BINARIES[@]/%/.exe}")
 | 
				
			||||||
@@ -289,14 +289,33 @@ kube::golang::fallback_if_stdlib_not_installable() {
 | 
				
			|||||||
  use_go_build=true
 | 
					  use_go_build=true
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Try and replicate the native binary placement of go install without
 | 
				
			||||||
 | 
					# calling go install.
 | 
				
			||||||
 | 
					kube::golang::output_filename_for_binary() {
 | 
				
			||||||
 | 
					  local binary=$1
 | 
				
			||||||
 | 
					  local platform=$2
 | 
				
			||||||
 | 
					  local output_path="${KUBE_GOPATH}/bin"
 | 
				
			||||||
 | 
					  if [[ $platform != $host_platform ]]; then
 | 
				
			||||||
 | 
					    output_path="${output_path}/${platform//\//_}"
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
 | 
					  local bin=$(basename "${binary}")
 | 
				
			||||||
 | 
					  if [[ ${GOOS} == "windows" ]]; then
 | 
				
			||||||
 | 
					    bin="${bin}.exe"
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
 | 
					  echo "${output_path}/${bin}"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
kube::golang::build_binaries_for_platform() {
 | 
					kube::golang::build_binaries_for_platform() {
 | 
				
			||||||
  local platform=$1
 | 
					  local platform=$1
 | 
				
			||||||
  local use_go_build=${2-}
 | 
					  local use_go_build=${2-}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  local -a statics=()
 | 
					  local -a statics=()
 | 
				
			||||||
  local -a nonstatics=()
 | 
					  local -a nonstatics=()
 | 
				
			||||||
 | 
					  local -a tests=()
 | 
				
			||||||
  for binary in "${binaries[@]}"; do
 | 
					  for binary in "${binaries[@]}"; do
 | 
				
			||||||
    if kube::golang::is_statically_linked_library "${binary}"; then
 | 
					    if [[ "${binary}" =~ ".test"$ ]]; then
 | 
				
			||||||
 | 
					      tests+=($binary)
 | 
				
			||||||
 | 
					    elif kube::golang::is_statically_linked_library "${binary}"; then
 | 
				
			||||||
      statics+=($binary)
 | 
					      statics+=($binary)
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      nonstatics+=($binary)
 | 
					      nonstatics+=($binary)
 | 
				
			||||||
@@ -307,27 +326,17 @@ kube::golang::build_binaries_for_platform() {
 | 
				
			|||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if [[ -n ${use_go_build:-} ]]; then
 | 
					  if [[ -n ${use_go_build:-} ]]; then
 | 
				
			||||||
    # Try and replicate the native binary placement of go install without
 | 
					 | 
				
			||||||
    # calling go install.  This means we have to iterate each binary.
 | 
					 | 
				
			||||||
    local output_path="${KUBE_GOPATH}/bin"
 | 
					 | 
				
			||||||
    if [[ $platform != $host_platform ]]; then
 | 
					 | 
				
			||||||
      output_path="${output_path}/${platform//\//_}"
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    kube::log::progress "    "
 | 
					    kube::log::progress "    "
 | 
				
			||||||
    for binary in "${binaries[@]}"; do
 | 
					    for binary in "${binaries[@]}"; do
 | 
				
			||||||
      local bin=$(basename "${binary}")
 | 
					      local outfile=$(kube::golang::output_filename_for_binary "${binary}" \
 | 
				
			||||||
      if [[ ${GOOS} == "windows" ]]; then
 | 
					        "${platform}")
 | 
				
			||||||
        bin="${bin}.exe"
 | 
					 | 
				
			||||||
      fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if kube::golang::is_statically_linked_library "${binary}"; then
 | 
					      if kube::golang::is_statically_linked_library "${binary}"; then
 | 
				
			||||||
        CGO_ENABLED=0 go build -o "${output_path}/${bin}" \
 | 
					        CGO_ENABLED=0 go build -o "${outfile}" \
 | 
				
			||||||
          "${goflags[@]:+${goflags[@]}}" \
 | 
					          "${goflags[@]:+${goflags[@]}}" \
 | 
				
			||||||
          -ldflags "${version_ldflags}" \
 | 
					          -ldflags "${version_ldflags}" \
 | 
				
			||||||
          "${binary}"
 | 
					          "${binary}"
 | 
				
			||||||
      else
 | 
					      else
 | 
				
			||||||
        go build -o "${output_path}/${bin}" \
 | 
					        go build -o "${outfile}" \
 | 
				
			||||||
          "${goflags[@]:+${goflags[@]}}" \
 | 
					          "${goflags[@]:+${goflags[@]}}" \
 | 
				
			||||||
          -ldflags "${version_ldflags}" \
 | 
					          -ldflags "${version_ldflags}" \
 | 
				
			||||||
          "${binary}"
 | 
					          "${binary}"
 | 
				
			||||||
@@ -349,6 +358,18 @@ kube::golang::build_binaries_for_platform() {
 | 
				
			|||||||
    fi
 | 
					    fi
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  for test in "${tests[@]:+${tests[@]}}"; do
 | 
				
			||||||
 | 
					      local outfile=$(kube::golang::output_filename_for_binary "${test}" \
 | 
				
			||||||
 | 
					        "${platform}")
 | 
				
			||||||
 | 
					    # Go 1.4 added -o to control where the binary is saved, but Go 1.3 doesn't
 | 
				
			||||||
 | 
					    # have this flag. Whenever we deprecate go 1.3, update to use -o instead of
 | 
				
			||||||
 | 
					    # calling mv.
 | 
				
			||||||
 | 
					    go test -c \
 | 
				
			||||||
 | 
					      "${goflags[@]:+${goflags[@]}}" \
 | 
				
			||||||
 | 
					      -ldflags "${version_ldflags}" \
 | 
				
			||||||
 | 
					      "$(dirname ${test})"
 | 
				
			||||||
 | 
					    mv -f "$(basename ${outfile})" "${outfile}"
 | 
				
			||||||
 | 
					  done
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Return approximate physical memory in gigabytes.
 | 
					# Return approximate physical memory in gigabytes.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -35,6 +35,7 @@ kube::test::find_dirs() {
 | 
				
			|||||||
          -o -wholename '*/third_party/*' \
 | 
					          -o -wholename '*/third_party/*' \
 | 
				
			||||||
          -o -wholename '*/Godeps/*' \
 | 
					          -o -wholename '*/Godeps/*' \
 | 
				
			||||||
          -o -wholename '*/contrib/podex/*' \
 | 
					          -o -wholename '*/contrib/podex/*' \
 | 
				
			||||||
 | 
					          -o -wholename '*/test/e2e/*' \
 | 
				
			||||||
          -o -wholename '*/test/integration/*' \
 | 
					          -o -wholename '*/test/integration/*' \
 | 
				
			||||||
        \) -prune \
 | 
					        \) -prune \
 | 
				
			||||||
      \) -name '*_test.go' -print0 | xargs -0n1 dirname | sed 's|^\./||' | sort -u
 | 
					      \) -name '*_test.go' -print0 | xargs -0n1 dirname | sed 's|^\./||' | sort -u
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,98 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
Copyright 2014 The Kubernetes Authors 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.
 | 
					 | 
				
			||||||
*/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
package e2e
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import (
 | 
					 | 
				
			||||||
	"fmt"
 | 
					 | 
				
			||||||
	"path"
 | 
					 | 
				
			||||||
	"regexp"
 | 
					 | 
				
			||||||
	"strings"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	"github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider"
 | 
					 | 
				
			||||||
	"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
 | 
					 | 
				
			||||||
	"github.com/golang/glog"
 | 
					 | 
				
			||||||
	"github.com/onsi/ginkgo"
 | 
					 | 
				
			||||||
	"github.com/onsi/ginkgo/config"
 | 
					 | 
				
			||||||
	"github.com/onsi/ginkgo/reporters"
 | 
					 | 
				
			||||||
	"github.com/onsi/gomega"
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
type testResult bool
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
type CloudConfig struct {
 | 
					 | 
				
			||||||
	ProjectID  string
 | 
					 | 
				
			||||||
	Zone       string
 | 
					 | 
				
			||||||
	MasterName string
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	Provider cloudprovider.Interface
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func init() {
 | 
					 | 
				
			||||||
	// Turn on verbose by default to get spec names
 | 
					 | 
				
			||||||
	config.DefaultReporterConfig.Verbose = true
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// Turn on EmitSpecProgress to get spec progress (especially on interrupt)
 | 
					 | 
				
			||||||
	config.GinkgoConfig.EmitSpecProgress = true
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// Randomize specs as well as suites
 | 
					 | 
				
			||||||
	config.GinkgoConfig.RandomizeAllSpecs = true
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func (t *testResult) Fail() { *t = false }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Run each Go end-to-end-test. This function assumes the
 | 
					 | 
				
			||||||
// creation of a test cluster.
 | 
					 | 
				
			||||||
func RunE2ETests(context *TestContextType, orderseed int64, times int, reportDir string, testList []string) {
 | 
					 | 
				
			||||||
	testContext = *context
 | 
					 | 
				
			||||||
	util.ReallyCrash = true
 | 
					 | 
				
			||||||
	util.InitLogs()
 | 
					 | 
				
			||||||
	defer util.FlushLogs()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if len(testList) != 0 {
 | 
					 | 
				
			||||||
		if config.GinkgoConfig.FocusString != "" || config.GinkgoConfig.SkipString != "" {
 | 
					 | 
				
			||||||
			glog.Fatal("Either specify --test/-t or --ginkgo.focus/--ginkgo.skip but not both.")
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		var testRegexps []string
 | 
					 | 
				
			||||||
		for _, t := range testList {
 | 
					 | 
				
			||||||
			testRegexps = append(testRegexps, regexp.QuoteMeta(t))
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		config.GinkgoConfig.FocusString = `\b(` + strings.Join(testRegexps, "|") + `)\b`
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// Disable density test unless it's explicitly requested.
 | 
					 | 
				
			||||||
	if config.GinkgoConfig.FocusString == "" && config.GinkgoConfig.SkipString == "" {
 | 
					 | 
				
			||||||
		config.GinkgoConfig.SkipString = "Skipped"
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// TODO: Make orderseed work again.
 | 
					 | 
				
			||||||
	var passed testResult = true
 | 
					 | 
				
			||||||
	gomega.RegisterFailHandler(ginkgo.Fail)
 | 
					 | 
				
			||||||
	// Run the existing tests with output to console + JUnit for Jenkins
 | 
					 | 
				
			||||||
	for i := 0; i < times && passed; i++ {
 | 
					 | 
				
			||||||
		var r []ginkgo.Reporter
 | 
					 | 
				
			||||||
		if reportDir != "" {
 | 
					 | 
				
			||||||
			r = append(r, reporters.NewJUnitReporter(path.Join(reportDir, fmt.Sprintf("junit_%d.xml", i+1))))
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		ginkgo.RunSpecsWithDefaultAndCustomReporters(&passed, fmt.Sprintf("Kubernetes e2e Suite run %d of %d", i+1, times), r)
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if !passed {
 | 
					 | 
				
			||||||
		glog.Fatalf("At least one test failed")
 | 
					 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
		glog.Infof("All tests pass")
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
							
								
								
									
										101
									
								
								test/e2e/e2e_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										101
									
								
								test/e2e/e2e_test.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,101 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					Copyright 2015 The Kubernetes Authors 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.
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					package e2e
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import (
 | 
				
			||||||
 | 
						"flag"
 | 
				
			||||||
 | 
						"fmt"
 | 
				
			||||||
 | 
						"path"
 | 
				
			||||||
 | 
						"strings"
 | 
				
			||||||
 | 
						"testing"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"github.com/GoogleCloudPlatform/kubernetes/pkg/client/clientcmd"
 | 
				
			||||||
 | 
						"github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider"
 | 
				
			||||||
 | 
						"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
 | 
				
			||||||
 | 
						"github.com/golang/glog"
 | 
				
			||||||
 | 
						"github.com/onsi/ginkgo"
 | 
				
			||||||
 | 
						"github.com/onsi/ginkgo/config"
 | 
				
			||||||
 | 
						"github.com/onsi/ginkgo/reporters"
 | 
				
			||||||
 | 
						"github.com/onsi/gomega"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					var (
 | 
				
			||||||
 | 
						cloudConfig = &testContext.CloudConfig
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						reportDir = flag.String("report-dir", "", "Path to the directory where the JUnit XML reports should be saved. Default is empty, which doesn't generate these reports.")
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func init() {
 | 
				
			||||||
 | 
						// Turn on verbose by default to get spec names
 | 
				
			||||||
 | 
						config.DefaultReporterConfig.Verbose = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Turn on EmitSpecProgress to get spec progress (especially on interrupt)
 | 
				
			||||||
 | 
						config.GinkgoConfig.EmitSpecProgress = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Randomize specs as well as suites
 | 
				
			||||||
 | 
						config.GinkgoConfig.RandomizeAllSpecs = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						flag.StringVar(&testContext.KubeConfig, clientcmd.RecommendedConfigPathFlag, "", "Path to kubeconfig containing embeded authinfo.")
 | 
				
			||||||
 | 
						flag.StringVar(&testContext.KubeContext, clientcmd.FlagContext, "", "kubeconfig context to use/override. If unset, will use value from 'current-context'")
 | 
				
			||||||
 | 
						flag.StringVar(&testContext.CertDir, "cert-dir", "", "Path to the directory containing the certs. Default is empty, which doesn't use certs.")
 | 
				
			||||||
 | 
						flag.StringVar(&testContext.Host, "host", "", "The host, or apiserver, to connect to")
 | 
				
			||||||
 | 
						flag.StringVar(&testContext.RepoRoot, "repo-root", "../../", "Root directory of kubernetes repository, for finding test files.")
 | 
				
			||||||
 | 
						flag.StringVar(&testContext.Provider, "provider", "", "The name of the Kubernetes provider (gce, gke, local, vagrant, etc.)")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// TODO: Flags per provider?  Rename gce-project/gce-zone?
 | 
				
			||||||
 | 
						flag.StringVar(&cloudConfig.MasterName, "kube-master", "", "Name of the kubernetes master. Only required if provider is gce or gke")
 | 
				
			||||||
 | 
						flag.StringVar(&cloudConfig.ProjectID, "gce-project", "", "The GCE project being used, if applicable")
 | 
				
			||||||
 | 
						flag.StringVar(&cloudConfig.Zone, "gce-zone", "", "GCE zone being used, if applicable")
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func TestE2E(t *testing.T) {
 | 
				
			||||||
 | 
						util.ReallyCrash = true
 | 
				
			||||||
 | 
						util.InitLogs()
 | 
				
			||||||
 | 
						defer util.FlushLogs()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// TODO: possibly clean up or refactor this functionality.
 | 
				
			||||||
 | 
						if testContext.Provider == "" {
 | 
				
			||||||
 | 
							glog.Fatal("The --provider flag is not set.  Treating as a conformance test.  Some tests may not be run.")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if testContext.Provider == "aws" {
 | 
				
			||||||
 | 
							awsConfig := "[Global]\n"
 | 
				
			||||||
 | 
							if cloudConfig.Zone == "" {
 | 
				
			||||||
 | 
								glog.Fatal("gce-zone must be specified for AWS")
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							awsConfig += fmt.Sprintf("Zone=%s\n", cloudConfig.Zone)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							var err error
 | 
				
			||||||
 | 
							cloudConfig.Provider, err = cloudprovider.GetCloudProvider(testContext.Provider, strings.NewReader(awsConfig))
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								glog.Fatal("Error building AWS provider: ", err)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Disable density test unless it's explicitly requested.
 | 
				
			||||||
 | 
						if config.GinkgoConfig.FocusString == "" && config.GinkgoConfig.SkipString == "" {
 | 
				
			||||||
 | 
							config.GinkgoConfig.SkipString = "Skipped"
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						gomega.RegisterFailHandler(ginkgo.Fail)
 | 
				
			||||||
 | 
						// Run tests through the Ginkgo runner with output to console + JUnit for Jenkins
 | 
				
			||||||
 | 
						var r []ginkgo.Reporter
 | 
				
			||||||
 | 
						if *reportDir != "" {
 | 
				
			||||||
 | 
							r = append(r, reporters.NewJUnitReporter(path.Join(*reportDir, fmt.Sprintf("junit_%02d.xml", config.GinkgoConfig.ParallelNode))))
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						ginkgo.RunSpecsWithDefaultAndCustomReporters(t, "Kubernetes e2e suite", r)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -45,6 +45,7 @@ const (
 | 
				
			|||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var _ = Describe("kubectl", func() {
 | 
					var _ = Describe("kubectl", func() {
 | 
				
			||||||
 | 
						defer GinkgoRecover()
 | 
				
			||||||
	var c *client.Client
 | 
						var c *client.Client
 | 
				
			||||||
	var ns string
 | 
						var ns string
 | 
				
			||||||
	var testingNs *api.Namespace
 | 
						var testingNs *api.Namespace
 | 
				
			||||||
@@ -65,11 +66,12 @@ var _ = Describe("kubectl", func() {
 | 
				
			|||||||
	})
 | 
						})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	Describe("update-demo", func() {
 | 
						Describe("update-demo", func() {
 | 
				
			||||||
		var (
 | 
							var updateDemoRoot, nautilusPath, kittenPath string
 | 
				
			||||||
 | 
							BeforeEach(func() {
 | 
				
			||||||
			updateDemoRoot = filepath.Join(testContext.RepoRoot, "examples/update-demo")
 | 
								updateDemoRoot = filepath.Join(testContext.RepoRoot, "examples/update-demo")
 | 
				
			||||||
			nautilusPath = filepath.Join(updateDemoRoot, "nautilus-rc.yaml")
 | 
								nautilusPath = filepath.Join(updateDemoRoot, "nautilus-rc.yaml")
 | 
				
			||||||
			kittenPath = filepath.Join(updateDemoRoot, "kitten-rc.yaml")
 | 
								kittenPath = filepath.Join(updateDemoRoot, "kitten-rc.yaml")
 | 
				
			||||||
		)
 | 
							})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		It("should create and stop a replication controller", func() {
 | 
							It("should create and stop a replication controller", func() {
 | 
				
			||||||
			defer cleanup(nautilusPath, ns, updateDemoSelector)
 | 
								defer cleanup(nautilusPath, ns, updateDemoSelector)
 | 
				
			||||||
@@ -105,7 +107,10 @@ var _ = Describe("kubectl", func() {
 | 
				
			|||||||
	})
 | 
						})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	Describe("guestbook", func() {
 | 
						Describe("guestbook", func() {
 | 
				
			||||||
		var guestbookPath = filepath.Join(testContext.RepoRoot, "examples/guestbook")
 | 
							var guestbookPath string
 | 
				
			||||||
 | 
							BeforeEach(func() {
 | 
				
			||||||
 | 
								guestbookPath = filepath.Join(testContext.RepoRoot, "examples/guestbook")
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		It("should create and stop a working application", func() {
 | 
							It("should create and stop a working application", func() {
 | 
				
			||||||
			if !providerIs("gce", "gke") {
 | 
								if !providerIs("gce", "gke") {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,7 +19,6 @@ package e2e
 | 
				
			|||||||
import (
 | 
					import (
 | 
				
			||||||
	"bytes"
 | 
						"bytes"
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"io/ioutil"
 | 
					 | 
				
			||||||
	"os/exec"
 | 
						"os/exec"
 | 
				
			||||||
	"path/filepath"
 | 
						"path/filepath"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -27,36 +26,19 @@ import (
 | 
				
			|||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var _ = Describe("Shell", func() {
 | 
					var _ = Describe("Shell", func() {
 | 
				
			||||||
	bashE2ERoot := filepath.Join(testContext.RepoRoot, "hack/e2e-suite")
 | 
						defer GinkgoRecover()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Slurp up all the tests in hack/e2e-suite
 | 
						It(fmt.Sprintf("tests that services.sh passes"), func() {
 | 
				
			||||||
	files, err := ioutil.ReadDir(bashE2ERoot)
 | 
							// The services script only works on gce/gke
 | 
				
			||||||
	if err != nil {
 | 
					 | 
				
			||||||
		Fail(fmt.Sprintf("Error reading test suites from %v %v", bashE2ERoot, err.Error()))
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	for _, file := range files {
 | 
					 | 
				
			||||||
		fileName := file.Name() // Make a copy
 | 
					 | 
				
			||||||
		It(fmt.Sprintf("tests that %v passes", fileName), func() {
 | 
					 | 
				
			||||||
			// A number of scripts only work on gce
 | 
					 | 
				
			||||||
		if !providerIs("gce", "gke") {
 | 
							if !providerIs("gce", "gke") {
 | 
				
			||||||
				By(fmt.Sprintf("Skipping Shell test %s, which is only supported for provider gce and gke (not %s)",
 | 
								By(fmt.Sprintf("Skipping Shell test services.sh, which is only supported for provider gce and gke (not %s)",
 | 
				
			||||||
					fileName, testContext.Provider))
 | 
									testContext.Provider))
 | 
				
			||||||
			return
 | 
								return
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
			runCmdTest(filepath.Join(bashE2ERoot, fileName))
 | 
							runCmdTest(filepath.Join(testContext.RepoRoot, "hack/e2e-suite/services.sh"))
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func absOrDie(path string) string {
 | 
					 | 
				
			||||||
	out, err := filepath.Abs(path)
 | 
					 | 
				
			||||||
	if err != nil {
 | 
					 | 
				
			||||||
		panic(err)
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return out
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Runs the given cmd test.
 | 
					// Runs the given cmd test.
 | 
				
			||||||
func runCmdTest(path string) {
 | 
					func runCmdTest(path string) {
 | 
				
			||||||
	By(fmt.Sprintf("Running %v", path))
 | 
						By(fmt.Sprintf("Running %v", path))
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -34,6 +34,7 @@ import (
 | 
				
			|||||||
	"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
 | 
						"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
 | 
				
			||||||
	"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
 | 
						"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
 | 
				
			||||||
	"github.com/GoogleCloudPlatform/kubernetes/pkg/client/clientcmd"
 | 
						"github.com/GoogleCloudPlatform/kubernetes/pkg/client/clientcmd"
 | 
				
			||||||
 | 
						"github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider"
 | 
				
			||||||
	"github.com/GoogleCloudPlatform/kubernetes/pkg/fields"
 | 
						"github.com/GoogleCloudPlatform/kubernetes/pkg/fields"
 | 
				
			||||||
	"github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl"
 | 
						"github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl"
 | 
				
			||||||
	"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
 | 
						"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
 | 
				
			||||||
@@ -57,6 +58,14 @@ const (
 | 
				
			|||||||
	podPoll = 5 * time.Second
 | 
						podPoll = 5 * time.Second
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type CloudConfig struct {
 | 
				
			||||||
 | 
						ProjectID  string
 | 
				
			||||||
 | 
						Zone       string
 | 
				
			||||||
 | 
						MasterName string
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						Provider cloudprovider.Interface
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type TestContextType struct {
 | 
					type TestContextType struct {
 | 
				
			||||||
	KubeConfig  string
 | 
						KubeConfig  string
 | 
				
			||||||
	KubeContext string
 | 
						KubeContext string
 | 
				
			||||||
@@ -302,7 +311,7 @@ func validateController(c *client.Client, containerImage string, replicas int, c
 | 
				
			|||||||
	Failf("Timed out after %v seconds waiting for %s pods to reach valid state", podStartTimeout.Seconds(), testname)
 | 
						Failf("Timed out after %v seconds waiting for %s pods to reach valid state", podStartTimeout.Seconds(), testname)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// kubectlCmd runs the kubectl executable.
 | 
					// kubectlCmd runs the kubectl executable through the wrapper script.
 | 
				
			||||||
func kubectlCmd(args ...string) *exec.Cmd {
 | 
					func kubectlCmd(args ...string) *exec.Cmd {
 | 
				
			||||||
	defaultArgs := []string{}
 | 
						defaultArgs := []string{}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -329,7 +338,7 @@ func kubectlCmd(args ...string) *exec.Cmd {
 | 
				
			|||||||
	kubectlArgs := append(defaultArgs, args...)
 | 
						kubectlArgs := append(defaultArgs, args...)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	//TODO: the "kubectl" path string might be worth externalizing into an (optional) ginko arg.
 | 
						//TODO: the "kubectl" path string might be worth externalizing into an (optional) ginko arg.
 | 
				
			||||||
	cmd := exec.Command("kubectl", kubectlArgs...)
 | 
						cmd := exec.Command(filepath.Join(testContext.RepoRoot, "cluster/kubectl.sh"), kubectlArgs...)
 | 
				
			||||||
	Logf("Running '%s %s'", cmd.Path, strings.Join(cmd.Args, " "))
 | 
						Logf("Running '%s %s'", cmd.Path, strings.Join(cmd.Args, " "))
 | 
				
			||||||
	return cmd
 | 
						return cmd
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user