forked from GoogleCloudPlatform/marketplace-k8s-app-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.Makefile
131 lines (105 loc) · 3.89 KB
/
tests.Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
ifndef __TESTS_MAKEFILE__
__TESTS_MAKEFILE__ := included
include common.Makefile
include gcloud.Makefile
include marketplace.Makefile
# Use python instead of `/dev/urandom` and `tr` for OSX compatibility.
TEST_ID := $(shell python -c 'import random, string; print("".join([random.choice(string.ascii_lowercase + string.digits) for _ in range(8)]))')
.tests/marketplace/deployer/helm_onbuild:
mkdir -p "$@"
.tests/marketplace/deployer/helm_onbuild/standard_v2: \
.build/marketplace/deployer/helm_onbuild \
.build/marketplace/dev \
.build/var/MARKETPLACE_TOOLS_TAG \
.build/var/REGISTRY \
$(shell find tests/marketplace/deployer_helm_base/onbuild/standard_v2 -type f) \
tests.Makefile \
| .tests/marketplace/deployer/helm_onbuild
$(call print_target)
TEST_ID=$(TEST_ID) \
REGISTRY=$(REGISTRY) \
MARKETPLACE_TOOLS_TAG=$(MARKETPLACE_TOOLS_TAG) \
./tests/marketplace/deployer_helm_base/onbuild/standard_v2/run_test
@touch "$@"
.PHONY: tests/marketplace/deployer/helm_onbuild
tests/marketplace/deployer/helm_onbuild: \
.tests/marketplace/deployer/helm_onbuild/standard_v2
.tests/marketplace/deployer/envsubst:
mkdir -p "$@"
.tests/marketplace/deployer/envsubst/standard: \
.build/marketplace/deployer/envsubst \
.build/marketplace/dev \
.build/var/MARKETPLACE_TOOLS_TAG \
.build/var/REGISTRY \
$(shell find tests/marketplace/deployer_envsubst_base/standard -type f) \
tests.Makefile \
| .tests/marketplace/deployer/envsubst
$(call print_target)
TEST_ID=$(TEST_ID) \
REGISTRY=$(REGISTRY) \
MARKETPLACE_TOOLS_TAG=$(MARKETPLACE_TOOLS_TAG) \
./tests/marketplace/deployer_envsubst_base/standard/run_test
@touch "$@"
.tests/marketplace/deployer/envsubst/standard_v2: \
.build/marketplace/deployer/envsubst \
.build/marketplace/dev \
.build/var/MARKETPLACE_TOOLS_TAG \
.build/var/REGISTRY \
$(shell find tests/marketplace/deployer_envsubst_base/standard_v2 -type f) \
tests.Makefile \
| .tests/marketplace/deployer/envsubst
$(call print_target)
TEST_ID=$(TEST_ID) \
REGISTRY=$(REGISTRY) \
MARKETPLACE_TOOLS_TAG=$(MARKETPLACE_TOOLS_TAG) \
./tests/marketplace/deployer_envsubst_base/standard_v2/run_test
@touch "$@"
.tests/marketplace/deployer/envsubst/full: \
.build/marketplace/deployer/envsubst \
.build/marketplace/dev \
.build/var/MARKETPLACE_TOOLS_TAG \
.build/var/REGISTRY \
$(shell find tests/marketplace/deployer_envsubst_base/full -type f) \
tests.Makefile \
| .tests/marketplace/deployer/envsubst
$(call print_target)
TEST_ID=$(TEST_ID) \
REGISTRY=$(REGISTRY) \
MARKETPLACE_TOOLS_TAG=$(MARKETPLACE_TOOLS_TAG) \
./tests/marketplace/deployer_envsubst_base/full/run_test
@touch "$@"
.PHONY: tests/marketplace/deployer/envsubst
tests/marketplace/deployer/envsubst: \
.tests/marketplace/deployer/envsubst/full \
.tests/marketplace/deployer/envsubst/standard \
.tests/marketplace/deployer/envsubst/standard_v2
.PHONY: tests/integration
tests/integration: \
tests/marketplace/deployer/envsubst \
tests/marketplace/deployer/helm_onbuild
PYTHON_TEST_DIRS = $(shell find . \
-path ./vendor -prune -o \
-name "*_test.py" -type f -print \
| xargs -n 1 dirname | sort | uniq)
# Append .__pytest__ to all python test directories to generate targets.
PYTHON_TEST_TARGETS = $(foreach f,$(PYTHON_TEST_DIRS),$(f).__pytest__)
.PHONY: tests/py
tests/py: $(PYTHON_TEST_TARGETS)
@$(call print_notice,All tests passed.)
.PHONY: $(PYTHON_TEST_TARGETS)
$(PYTHON_TEST_TARGETS): %.__pytest__: .build/tests/py
$(info === Running tests in directory $* ===)
# The coverage tool requires write access to the tested directories
@docker run --rm \
-v $(PWD):/data \
--entrypoint runtests.sh \
tests/py \
"$*"
.build/tests: | .build
mkdir -p "$@"
.build/tests/py: tests/py/Dockerfile \
tests/py/runtests.sh | .build/tests
$(call print_target)
docker build -t tests/py tests/py
@touch "$@"
endif