mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	component tests as integration-tests with short option.
This commit is contained in:
		@@ -42,6 +42,7 @@ kube::test::find_integration_test_dirs() {
 | 
				
			|||||||
    cd ${KUBE_ROOT}
 | 
					    cd ${KUBE_ROOT}
 | 
				
			||||||
    find test/integration/${1-} -name '*_test.go' -print0 \
 | 
					    find test/integration/${1-} -name '*_test.go' -print0 \
 | 
				
			||||||
      | xargs -0n1 dirname \
 | 
					      | xargs -0n1 dirname \
 | 
				
			||||||
 | 
					      | uniq \
 | 
				
			||||||
      | sort -u
 | 
					      | sort -u
 | 
				
			||||||
  )
 | 
					  )
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -61,7 +62,7 @@ runTests() {
 | 
				
			|||||||
  # KUBE_RACE="-race"
 | 
					  # KUBE_RACE="-race"
 | 
				
			||||||
  make -C "${KUBE_ROOT}" test \
 | 
					  make -C "${KUBE_ROOT}" test \
 | 
				
			||||||
      WHAT="$(kube::test::find_integration_test_dirs ${2-} | paste -sd' ' -)" \
 | 
					      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_TEST_ARGS="${KUBE_TEST_ARGS:-} --vmodule=garbage*collector*=6 --alsologtostderr=true" \
 | 
				
			||||||
      KUBE_RACE="" \
 | 
					      KUBE_RACE="" \
 | 
				
			||||||
      KUBE_TIMEOUT="${KUBE_TIMEOUT}" \
 | 
					      KUBE_TIMEOUT="${KUBE_TIMEOUT}" \
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,9 +30,8 @@ import (
 | 
				
			|||||||
// If you need to start an etcd instance by hand, you also need to insert a key
 | 
					// 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:
 | 
					// 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").
 | 
					//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 {
 | 
					func GetEtcdURLFromEnv() string {
 | 
				
			||||||
	url := env.GetEnvAsStringOrFallback("KUBE_INTEGRATION_ETCD_URL", "http://127.0.0.1:2379")
 | 
						url := env.GetEnvAsStringOrFallback("KUBE_INTEGRATION_ETCD_URL", "http://127.0.0.1:2379")
 | 
				
			||||||
@@ -41,6 +40,10 @@ func GetEtcdURLFromEnv() string {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func NewEtcdClient() etcd.Client {
 | 
					func NewEtcdClient() etcd.Client {
 | 
				
			||||||
 | 
						// gaurded to avoid infinite recursion, check etcd.
 | 
				
			||||||
 | 
						if testing_etcd {
 | 
				
			||||||
 | 
							RequireEtcd()
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	cfg := etcd.Config{
 | 
						cfg := etcd.Config{
 | 
				
			||||||
		Endpoints: []string{GetEtcdURLFromEnv()},
 | 
							Endpoints: []string{GetEtcdURLFromEnv()},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -52,9 +55,14 @@ func NewEtcdClient() etcd.Client {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func RequireEtcd() {
 | 
					func RequireEtcd() {
 | 
				
			||||||
 | 
						testing_etcd = true
 | 
				
			||||||
 | 
						defer func() {
 | 
				
			||||||
 | 
							testing_etcd = false
 | 
				
			||||||
 | 
						}()
 | 
				
			||||||
	if _, err := etcd.NewKeysAPI(NewEtcdClient()).Get(context.TODO(), "/", nil); err != nil {
 | 
						if _, err := etcd.NewKeysAPI(NewEtcdClient()).Get(context.TODO(), "/", nil); err != nil {
 | 
				
			||||||
		glog.Fatalf("unable to connect to etcd for testing: %v", err)
 | 
							glog.Fatalf("unable to connect to etcd for testing: %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func WithEtcdKey(f func(string)) {
 | 
					func WithEtcdKey(f func(string)) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -73,3 +73,6 @@ cd kubernetes/test/component/scheduler/perf
 | 
				
			|||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
 | 
					<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
 | 
				
			||||||
[]()
 | 
					[]()
 | 
				
			||||||
<!-- END MUNGE: GENERATED_ANALYTICS -->
 | 
					<!-- END MUNGE: GENERATED_ANALYTICS -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[]()
 | 
				
			||||||
@@ -24,11 +24,17 @@ import (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// TestSchedule100Node3KPods schedules 3k pods on 100 nodes.
 | 
					// TestSchedule100Node3KPods schedules 3k pods on 100 nodes.
 | 
				
			||||||
func TestSchedule100Node3KPods(t *testing.T) {
 | 
					func TestSchedule100Node3KPods(t *testing.T) {
 | 
				
			||||||
 | 
						if testing.Short() {
 | 
				
			||||||
 | 
							t.Skip("Skipping because we want to run short tests")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	schedulePods(100, 3000)
 | 
						schedulePods(100, 3000)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// TestSchedule1000Node30KPods schedules 30k pods on 1000 nodes.
 | 
					// TestSchedule1000Node30KPods schedules 30k pods on 1000 nodes.
 | 
				
			||||||
func TestSchedule1000Node30KPods(t *testing.T) {
 | 
					func TestSchedule1000Node30KPods(t *testing.T) {
 | 
				
			||||||
 | 
						if testing.Short() {
 | 
				
			||||||
 | 
							t.Skip("Skipping because we want to run short tests")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	schedulePods(1000, 30000)
 | 
						schedulePods(1000, 30000)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -41,9 +41,9 @@ kube::log::status "performance test start"
 | 
				
			|||||||
# theoretically it has less variance.
 | 
					# theoretically it has less variance.
 | 
				
			||||||
if ${RUN_BENCHMARK:-false}; then
 | 
					if ${RUN_BENCHMARK:-false}; then
 | 
				
			||||||
  go test -c -o "perf.test"
 | 
					  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"
 | 
					  kube::log::status "benchmark tests finished"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
# Running density tests. It might take a long time.
 | 
					# 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"
 | 
					kube::log::status "density tests finished"
 | 
				
			||||||
@@ -44,7 +44,7 @@ import (
 | 
				
			|||||||
// Notes on rate limiter:
 | 
					// Notes on rate limiter:
 | 
				
			||||||
//   - client rate limit is set to 5000.
 | 
					//   - client rate limit is set to 5000.
 | 
				
			||||||
func mustSetupScheduler() (schedulerConfigFactory *factory.ConfigFactory, destroyFunc func()) {
 | 
					func mustSetupScheduler() (schedulerConfigFactory *factory.ConfigFactory, destroyFunc func()) {
 | 
				
			||||||
	framework.DeleteAllEtcdKeys()
 | 
						// framework.DeleteAllEtcdKeys()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var m *master.Master
 | 
						var m *master.Master
 | 
				
			||||||
	masterConfig := framework.NewIntegrationTestMasterConfig()
 | 
						masterConfig := framework.NewIntegrationTestMasterConfig()
 | 
				
			||||||
		Reference in New Issue
	
	Block a user