#!/bin/bash # Copyright 2015 The Kubernetes Authors. # # 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 set -o xtrace proc retry { for i in [{1..5}] { @Argv && return 0 || sleep $i } @Argv } # Runs the unit and integration tests, producing JUnit-style XML test # reports in ${WORKSPACE}/artifacts. This script is intended to be run from # kubekins-test container with a kubernetes repo mapped in. See # k8s.io/test-infra/scenarios/kubernetes_verify.py export PATH=$(GOPATH)/bin:$(PWD)/third_party/etcd:/usr/local/go/bin:$(PATH) retry go get github.com/tools/godep && godep version retry go get github.com/jstemmer/go-junit-report # Enable the Go race detector. export KUBE_RACE=-race # Disable coverage report export KUBE_COVER="n" # Produce a JUnit-style XML test report for Jenkins. export KUBE_JUNIT_REPORT_DIR=$(WORKSPACE)/artifacts export ARTIFACTS_DIR=$(WORKSPACE)/artifacts # Save the verbose stdout as well. export KUBE_KEEP_VERBOSE_TEST_OUTPUT=y export KUBE_TIMEOUT='-timeout 300s' export KUBE_INTEGRATION_TEST_MAX_CONCURRENCY=4 export LOG_LEVEL=4 cd /go/src/k8s.io/kubernetes make generated_files go install ./cmd/... ./hack/install-etcd.sh make test make test-cmd make test-integration ./hack/test-update-storage-objects.sh (CommandList children: [ (C {(set)} {(-o)} {(errexit)}) (C {(set)} {(-o)} {(nounset)}) (C {(set)} {(-o)} {(pipefail)}) (C {(set)} {(-o)} {(xtrace)}) (FuncDef name: retry body: (BraceGroup children: [ (ForEach iter_name: i iter_words: [{(Lit_LBrace "{") (1..5) (Lit_RBrace "}")}] do_arg_iter: False body: (DoGroup children: [ (AndOr children: [ (C {(DQ ($ VSub_At "$@"))}) (AndOr children: [ (ControlFlow token: arg_word: {(0)} ) (C {(sleep)} {($ VSub_Name "$i")}) ] op_id: Op_DPipe ) ] op_id: Op_DAmp ) ] spids: [87 107] ) spids: [81 85] ) (C {(DQ ($ VSub_At "$@"))}) ] spids: [73] ) spids: [69 72] ) (C {(export)} {(Lit_VarLike "PATH=") (${ VSub_Name GOPATH) (/bin) (Lit_Other ":") (${ VSub_Name PWD) (/third_party/etcd) (Lit_Other ":") (/usr/local/go/bin) (Lit_Other ":") (${ VSub_Name PATH) } ) (AndOr children: [(C {(retry)} {(go)} {(get)} {(github.com/tools/godep)}) (C {(godep)} {(version)})] op_id: Op_DAmp ) (C {(retry)} {(go)} {(get)} {(github.com/jstemmer/go-junit-report)}) (C {(export)} {(Lit_VarLike "KUBE_RACE=") (-race)}) (C {(export)} {(Lit_VarLike "KUBE_COVER=") (DQ (n))}) (C {(export)} {(Lit_VarLike "KUBE_JUNIT_REPORT_DIR=") (${ VSub_Name WORKSPACE) (/artifacts)}) (C {(export)} {(Lit_VarLike "ARTIFACTS_DIR=") (${ VSub_Name WORKSPACE) (/artifacts)}) (C {(export)} {(Lit_VarLike "KUBE_KEEP_VERBOSE_TEST_OUTPUT=") (y)}) (C {(export)} {(Lit_VarLike "KUBE_TIMEOUT=") (SQ <"-timeout 300s">)}) (C {(export)} {(Lit_VarLike "KUBE_INTEGRATION_TEST_MAX_CONCURRENCY=") (4)}) (C {(export)} {(Lit_VarLike "LOG_LEVEL=") (4)}) (C {(cd)} {(/go/src/k8s.io/kubernetes)}) (C {(make)} {(generated_files)}) (C {(go)} {(install)} {(./cmd/...)}) (C {(./hack/install-etcd.sh)}) (C {(make)} {(test)}) (C {(make)} {(test-cmd)}) (C {(make)} {(test-integration)}) (C {(./hack/test-update-storage-objects.sh)}) ] )