istio

Форк
0
130 строк · 5.4 Кб
1
#-----------------------------------------------------------------------------
2
# Target: test.integration.*
3
#-----------------------------------------------------------------------------
4

5
# The following flags (in addition to ${V}) can be specified on the command-line, or the environment. This
6
# is primarily used by the CI systems.
7
_INTEGRATION_TEST_FLAGS ?= $(INTEGRATION_TEST_FLAGS)
8

9
# $(CI) specifies that the test is running in a CI system. This enables CI specific logging.
10
ifneq ($(CI),)
11
	_INTEGRATION_TEST_FLAGS += --istio.test.ci
12
	_INTEGRATION_TEST_FLAGS += --istio.test.pullpolicy=IfNotPresent
13
endif
14

15
ifeq ($(TEST_ENV),kind)
16
    _INTEGRATION_TEST_FLAGS += --istio.test.kube.loadbalancer=false
17
endif
18

19
ifeq ($(shell uname -m),aarch64)
20
    _INTEGRATION_TEST_FLAGS += --istio.test.kube.architecture=arm64
21
endif
22

23
ifneq ($(ARTIFACTS),)
24
    _INTEGRATION_TEST_FLAGS += --istio.test.work_dir=$(ARTIFACTS)
25
endif
26

27
ifneq ($(HUB),)
28
    _INTEGRATION_TEST_FLAGS += --istio.test.hub=$(HUB)
29
endif
30

31
ifneq ($(TAG),)
32
    _INTEGRATION_TEST_FLAGS += --istio.test.tag=$(TAG)
33
endif
34

35
_INTEGRATION_TEST_SELECT_FLAGS ?= --istio.test.select=$(TEST_SELECT)
36
ifneq ($(JOB_TYPE),postsubmit)
37
	_INTEGRATION_TEST_SELECT_FLAGS:="$(_INTEGRATION_TEST_SELECT_FLAGS),-postsubmit"
38
endif
39

40
# both ipv6 only and dual stack support ipv6
41
support_ipv6 =
42
ifeq ($(IP_FAMILY),ipv6)
43
	support_ipv6 = yes
44
else ifeq ($(IP_FAMILY),dual)
45
	support_ipv6 = yes
46
	_INTEGRATION_TEST_FLAGS += --istio.test.enableDualStack
47
endif
48
ifdef support_ipv6
49
	_INTEGRATION_TEST_SELECT_FLAGS:="$(_INTEGRATION_TEST_SELECT_FLAGS),-ipv4"
50
	# Fundamentally, VMs should support IPv6. However, our test framework uses a contrived setup to test VMs
51
	# such that they run in the cluster. In particular, they configure DNS to a public DNS server.
52
	# For CI, our nodes do not have IPv6 external connectivity. This means the cluster *cannot* reach these external
53
	# DNS servers.
54
	# Extensive work was done to try to hack around this, but ultimately nothing was able to cover all
55
	# of the edge cases. This work was captured in https://github.com/howardjohn/istio/tree/tf/vm-ipv6.
56
	_INTEGRATION_TEST_FLAGS += --istio.test.skipVM
57
endif
58

59
# $(INTEGRATION_TEST_KUBECONFIG) overrides all kube config settings.
60
_INTEGRATION_TEST_KUBECONFIG ?= $(INTEGRATION_TEST_KUBECONFIG)
61

62
# If $(INTEGRATION_TEST_KUBECONFIG) not specified, use $(KUBECONFIG).
63
ifeq ($(_INTEGRATION_TEST_KUBECONFIG),)
64
    _INTEGRATION_TEST_KUBECONFIG = $(KUBECONFIG)
65
endif
66

67
# If neither $(INTEGRATION_TEST_KUBECONFIG) nor $(KUBECONFIG) specified, use default.
68
ifeq ($(_INTEGRATION_TEST_KUBECONFIG),)
69
    _INTEGRATION_TEST_KUBECONFIG = ~/.kube/config
70
endif
71

72
_INTEGRATION_TEST_TOPOLOGY_FILE ?= $(INTEGRATION_TEST_TOPOLOGY_FILE)
73
ifneq ($(_INTEGRATION_TEST_TOPOLOGY_FILE),)
74
    _INTEGRATION_TEST_FLAGS += --istio.test.kube.topology=$(_INTEGRATION_TEST_TOPOLOGY_FILE)
75
else
76
	# integ-suite-kind.sh should populate the topology file with kubeconfigs
77
	_INTEGRATION_TEST_FLAGS += --istio.test.kube.config=$(_INTEGRATION_TEST_KUBECONFIG)
78
endif
79

80

81
# Precompile tests before running. See https://blog.howardjohn.info/posts/go-build-times/#integration-tests.
82
define run-test
83
$(GO) test -exec=true -toolexec=$(REPO_ROOT)/tools/go-compile-without-link -vet=off -tags=integ $2 $1
84
$(GO) test -p 1 ${T} -tags=integ -vet=off -timeout 30m $2 $1 ${_INTEGRATION_TEST_FLAGS} ${_INTEGRATION_TEST_SELECT_FLAGS} 2>&1 | tee >($(JUNIT_REPORT) > $(JUNIT_OUT))
85
endef
86

87
test.integration.analyze: test.integration...analyze
88

89
test.integration.%.analyze: | $(JUNIT_REPORT) check-go-tag
90
	$(GO) test ${T} -tags=integ -vet=off ./tests/integration/$(subst .,/,$*)/... -timeout 30m \
91
	${_INTEGRATION_TEST_FLAGS} \
92
	--istio.test.analyze \
93
	2>&1 | tee >($(JUNIT_REPORT) > $(JUNIT_OUT))
94

95
# Ensure that all test files are tagged properly. This ensures that we don't accidentally skip tests
96
# and that integration tests are not run as part of the unit test suite.
97
check-go-tag:
98
	@go list ./tests/integration/... 2>/dev/null | xargs -r -I{} sh -c 'echo "Detected a file in tests/integration/ without a build tag set. Add // +build integ to the files: {}"; exit 2'
99

100
# Generate integration test targets for kubernetes environment.
101
test.integration.%.kube: | $(JUNIT_REPORT) check-go-tag
102
	$(call run-test,./tests/integration/$(subst .,/,$*)/...)
103

104
# Generate integration fuzz test targets for kubernetes environment.
105
test.integration-fuzz.%.kube: | $(JUNIT_REPORT) check-go-tag
106
	$(call run-test,./tests/integration/$(subst .,/,$*)/...,-tags="integfuzz integ")
107

108
# Generate presubmit integration test targets for each component in kubernetes environment
109
test.integration.%.kube.presubmit:
110
	@make test.integration.$*.kube
111

112
# Run all tests
113
.PHONY: test.integration.kube
114
test.integration.kube: test.integration.kube.presubmit
115
	@:
116

117
# Presubmit integration tests targeting Kubernetes environment. Really used for postsubmit on different k8s versions.
118
.PHONY: test.integration.kube.presubmit
119
test.integration.kube.presubmit: | $(JUNIT_REPORT) check-go-tag
120
	$(call run-test,./tests/integration/...)
121

122
# Defines a target to run a standard set of tests in various different environments (IPv6, distroless, ARM, etc)
123
# In presubmit, this target runs a minimal set. In postsubmit, all tests are run
124
.PHONY: test.integration.kube.environment
125
test.integration.kube.environment: | $(JUNIT_REPORT) check-go-tag
126
ifeq (${JOB_TYPE},postsubmit)
127
	$(call run-test,./tests/integration/...)
128
else
129
	$(call run-test,./tests/integration/security/ ./tests/integration/pilot,-run="TestReachability|TestTraffic|TestGatewayConformance")
130
endif
131

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.