#!/usr/bin/env bash # Copyright 2014 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 global KUBE_ROOT := "$[dirname $(BASH_SOURCE)]/../../../" source "$(KUBE_ROOT)/hack/lib/init.sh" kube::golang::setup_env global DIR_BASENAME := $[dirname $(BASH_SOURCE)] pushd $(DIR_BASENAME) proc cleanup { popd !2 > /dev/null kube::etcd::cleanup kube::log::status "performance test cleanup complete" } trap cleanup EXIT kube::etcd::start # We are using the benchmark suite to do profiling. Because it only runs a few pods and # theoretically it has less variance. if $(RUN_BENCHMARK:-false) { kube::log::status "performance test (benchmark) compiling" go test -c -o "perf.test" kube::log::status "performance test (benchmark) start" "./perf.test" -test.bench=. -test.run=xxxx -test.cpuprofile=prof.out -test.short=false kube::log::status "...benchmark tests finished" } # Running density tests. It might take a long time. kube::log::status "performance test (density) start" go test -test.run=. -test.timeout=60m -test.short=false kube::log::status "...density tests finished" (CommandList children: [ (C {(set)} {(-o)} {(errexit)}) (C {(set)} {(-o)} {(nounset)}) (C {(set)} {(-o)} {(pipefail)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KUBE_ROOT) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(dirname)} {(DQ (${ VSub_Name BASH_SOURCE))})] ) left_token: spids: [64 72] ) (/../../../) } spids: [63] ) ] spids: [63] ) (C {(source)} {(DQ (${ VSub_Name KUBE_ROOT) (/hack/lib/init.sh))}) (C {(kube) (Lit_Other ":") (Lit_Other ":") (golang) (Lit_Other ":") (Lit_Other ":") (setup_env)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:DIR_BASENAME) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(dirname)} {(DQ (${ VSub_Name BASH_SOURCE))})] ) left_token: spids: [95 103] ) } spids: [94] ) ] spids: [94] ) (C {(pushd)} {(${ VSub_Name DIR_BASENAME)}) (FuncDef name: cleanup body: (BraceGroup children: [ (SimpleCommand words: [{(popd)}] redirects: [(Redir op_id:Redir_Great fd:2 arg_word:{(/dev/null)} spids:[121])] ) (C {(kube) (Lit_Other ":") (Lit_Other ":") (etcd) (Lit_Other ":") (Lit_Other ":") (cleanup)} ) (C {(kube) (Lit_Other ":") (Lit_Other ":") (log) (Lit_Other ":") (Lit_Other ":") (status)} {(DQ ("performance test cleanup complete"))} ) ] spids: [116] ) spids: [112 115] ) (C {(trap)} {(cleanup)} {(EXIT)}) (C {(kube) (Lit_Other ":") (Lit_Other ":") (etcd) (Lit_Other ":") (Lit_Other ":") (start)}) (If arms: [ (if_arm cond: [ (Sentence child: (C { (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(false)}) spids: [174 178] ) } ) terminator: ) ] action: [ (C {(kube) (Lit_Other ":") (Lit_Other ":") (log) (Lit_Other ":") (Lit_Other ":") (status)} {(DQ ("performance test (benchmark) compiling"))} ) (C {(go)} {(test)} {(-c)} {(-o)} {(DQ (perf.test))}) (C {(kube) (Lit_Other ":") (Lit_Other ":") (log) (Lit_Other ":") (Lit_Other ":") (status)} {(DQ ("performance test (benchmark) start"))} ) (C {(DQ (./perf.test))} {(-test.bench) (Lit_Other "=") (.)} {(-test.run) (Lit_Other "=") (xxxx)} {(-test.cpuprofile) (Lit_Other "=") (prof.out)} {(-test.short) (Lit_Other "=") (false)} ) (C {(kube) (Lit_Other ":") (Lit_Other ":") (log) (Lit_Other ":") (Lit_Other ":") (status)} {(DQ ("...benchmark tests finished"))} ) ] spids: [-1 181] ) ] spids: [-1 257] ) (C {(kube) (Lit_Other ":") (Lit_Other ":") (log) (Lit_Other ":") (Lit_Other ":") (status)} {(DQ ("performance test (density) start"))} ) (C {(go)} {(test)} {(-test.run) (Lit_Other "=") (.)} {(-test.timeout) (Lit_Other "=") (60m)} {(-test.short) (Lit_Other "=") (false)} ) (C {(kube) (Lit_Other ":") (Lit_Other ":") (log) (Lit_Other ":") (Lit_Other ":") (status)} {(DQ ("...density tests finished"))} ) ] )