diff --git a/hack/make-rules/test-integration.sh b/hack/make-rules/test-integration.sh index 2ff8c2fa33a..9f5556f2d94 100755 --- a/hack/make-rules/test-integration.sh +++ b/hack/make-rules/test-integration.sh @@ -42,6 +42,7 @@ kube::test::find_integration_test_dirs() { cd ${KUBE_ROOT} find test/integration/${1-} -name '*_test.go' -print0 \ | xargs -0n1 dirname \ + | uniq \ | sort -u ) } @@ -61,7 +62,7 @@ runTests() { # KUBE_RACE="-race" make -C "${KUBE_ROOT}" test \ WHAT="$(kube::test::find_integration_test_dirs ${2-} | paste -sd' ' -)" \ - KUBE_GOFLAGS="${KUBE_GOFLAGS:-} -tags 'integration no-docker'" \ + KUBE_GOFLAGS="${KUBE_GOFLAGS:-} -short=true -tags 'integration no-docker'" \ KUBE_TEST_ARGS="${KUBE_TEST_ARGS:-} --vmodule=garbage*collector*=6 --alsologtostderr=true" \ KUBE_RACE="" \ KUBE_TIMEOUT="${KUBE_TIMEOUT}" \ diff --git a/test/integration/framework/etcd_utils.go b/test/integration/framework/etcd_utils.go index 66a50307f5f..1897195e4ac 100644 --- a/test/integration/framework/etcd_utils.go +++ b/test/integration/framework/etcd_utils.go @@ -30,9 +30,8 @@ import ( // If you need to start an etcd instance by hand, you also need to insert a key // for this check to pass (*any* key will do, eg: //curl -L http://127.0.0.1:2379/v2/keys/message -XPUT -d value="Hello world"). -func init() { - RequireEtcd() -} + +var testing_etcd = false func GetEtcdURLFromEnv() string { url := env.GetEnvAsStringOrFallback("KUBE_INTEGRATION_ETCD_URL", "http://127.0.0.1:2379") @@ -41,6 +40,10 @@ func GetEtcdURLFromEnv() string { } func NewEtcdClient() etcd.Client { + // gaurded to avoid infinite recursion, check etcd. + if testing_etcd { + RequireEtcd() + } cfg := etcd.Config{ Endpoints: []string{GetEtcdURLFromEnv()}, } @@ -52,9 +55,14 @@ func NewEtcdClient() etcd.Client { } func RequireEtcd() { + testing_etcd = true + defer func() { + testing_etcd = false + }() if _, err := etcd.NewKeysAPI(NewEtcdClient()).Get(context.TODO(), "/", nil); err != nil { glog.Fatalf("unable to connect to etcd for testing: %v", err) } + } func WithEtcdKey(f func(string)) { diff --git a/test/component/scheduler/perf/README.md b/test/integration/scheduler_perf/README.md similarity index 95% rename from test/component/scheduler/perf/README.md rename to test/integration/scheduler_perf/README.md index 22192af59ef..e235b1a716a 100644 --- a/test/component/scheduler/perf/README.md +++ b/test/integration/scheduler_perf/README.md @@ -73,3 +73,6 @@ cd kubernetes/test/component/scheduler/perf [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/test/component/scheduler/perf/README.md?pixel)]() + + +[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/test/integration/scheduler_perf/README.md?pixel)]() diff --git a/test/component/scheduler/perf/scheduler_bench_test.go b/test/integration/scheduler_perf/scheduler_bench_test.go similarity index 100% rename from test/component/scheduler/perf/scheduler_bench_test.go rename to test/integration/scheduler_perf/scheduler_bench_test.go diff --git a/test/component/scheduler/perf/scheduler_test.go b/test/integration/scheduler_perf/scheduler_test.go similarity index 92% rename from test/component/scheduler/perf/scheduler_test.go rename to test/integration/scheduler_perf/scheduler_test.go index 06ead4d9ad6..50b9a9e886a 100644 --- a/test/component/scheduler/perf/scheduler_test.go +++ b/test/integration/scheduler_perf/scheduler_test.go @@ -24,11 +24,17 @@ import ( // TestSchedule100Node3KPods schedules 3k pods on 100 nodes. func TestSchedule100Node3KPods(t *testing.T) { + if testing.Short() { + t.Skip("Skipping because we want to run short tests") + } schedulePods(100, 3000) } // TestSchedule1000Node30KPods schedules 30k pods on 1000 nodes. func TestSchedule1000Node30KPods(t *testing.T) { + if testing.Short() { + t.Skip("Skipping because we want to run short tests") + } schedulePods(1000, 30000) } diff --git a/test/component/scheduler/perf/test-performance.sh b/test/integration/scheduler_perf/test-performance.sh similarity index 94% rename from test/component/scheduler/perf/test-performance.sh rename to test/integration/scheduler_perf/test-performance.sh index 7f255ec2b9f..7eb6aba0301 100755 --- a/test/component/scheduler/perf/test-performance.sh +++ b/test/integration/scheduler_perf/test-performance.sh @@ -41,9 +41,9 @@ kube::log::status "performance test start" # theoretically it has less variance. if ${RUN_BENCHMARK:-false}; then go test -c -o "perf.test" - "./perf.test" -test.bench=. -test.run=xxxx -test.cpuprofile=prof.out + "./perf.test" -test.bench=. -test.run=xxxx -test.cpuprofile=prof.out -test.short=false kube::log::status "benchmark tests finished" fi # Running density tests. It might take a long time. -go test -test.run=. -test.timeout=60m +go test -test.run=. -test.timeout=60m -test.short=false kube::log::status "density tests finished" diff --git a/test/component/scheduler/perf/util.go b/test/integration/scheduler_perf/util.go similarity index 99% rename from test/component/scheduler/perf/util.go rename to test/integration/scheduler_perf/util.go index d7d256a1b5e..c9370675eee 100644 --- a/test/component/scheduler/perf/util.go +++ b/test/integration/scheduler_perf/util.go @@ -44,7 +44,7 @@ import ( // Notes on rate limiter: // - client rate limit is set to 5000. func mustSetupScheduler() (schedulerConfigFactory *factory.ConfigFactory, destroyFunc func()) { - framework.DeleteAllEtcdKeys() + // framework.DeleteAllEtcdKeys() var m *master.Master masterConfig := framework.NewIntegrationTestMasterConfig()