File tree Expand file tree Collapse file tree 2 files changed +44
-10
lines changed Expand file tree Collapse file tree 2 files changed +44
-10
lines changed Original file line number Diff line number Diff line change @@ -164,24 +164,20 @@ setup-venv:
164
164
$(Q )$(PYTHON_VENV_DIR ) /bin/pip install --upgrade setuptools
165
165
$(Q )$(PYTHON_VENV_DIR ) /bin/pip install --upgrade pip
166
166
167
- .PHONY : out/test-namespace
168
- # Generate namespace name for test
169
- out/test-namespace :
170
- $(Q ) mkdir -p $(OUTPUT_DIR )
171
- @echo -n " test-namespace-$( shell uuidgen | tr ' [:upper:]' ' [:lower:]' | head -c 8) " > $(OUTPUT_DIR ) /test-namespace
172
-
173
167
.PHONY : get-test-namespace
174
- get-test-namespace : out/test-namespace
175
- $(eval TEST_NAMESPACE := $(shell cat $(OUTPUT_DIR ) /test-namespace) )
168
+ get-test-namespace :
169
+ $(Q ) mkdir -p $(OUTPUT_DIR )
170
+ $(eval TEST_NAMESPACE := $(shell $(HACK_DIR ) /get-test-namespace $(OUTPUT_DIR ) ) )
171
+ echo $(TEST_NAMESPACE )
176
172
177
173
# Testing setup
178
174
.PHONY : deploy-test-3rd-party-crds
179
175
deploy-test-3rd-party-crds : get-test-namespace
180
176
$(Q ) kubectl --namespace $(TEST_NAMESPACE ) apply -f ./test/third-party-crds/
181
177
182
178
.PHONY : create-test-namespace
183
- create-test-namespace :
184
- $(Q ) kubectl create namespace $(TEST_NAMESPACE )
179
+ create-test-namespace : get-test-namespace
180
+ $(Q ) kubectl get namespace $( TEST_NAMESPACE ) || kubectl create namespace $(TEST_NAMESPACE )
185
181
186
182
.PHONY : test-setup
187
183
test-setup : test-cleanup create-test-namespace deploy-test-3rd-party-crds
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ OUTPUT_DIR=$1
4
+ NS_FILE=${OUTPUT_DIR} /test-namespace
5
+
6
+ # https://gist.github.com/markusfisch/6110640
7
+ uuid ()
8
+ {
9
+ local N B C=' 89ab'
10
+
11
+ for (( N= 0 ; N < 16 ; ++ N ))
12
+ do
13
+ B=$(( $RANDOM % 256 ))
14
+
15
+ case $N in
16
+ 6)
17
+ printf ' 4%x' $(( B% 16 ))
18
+ ;;
19
+ 8)
20
+ printf ' %c%x' ${C: $RANDOM % ${# C} : 1} $(( B% 16 ))
21
+ ;;
22
+ 3 | 5 | 7 | 9)
23
+ printf ' %02x-' $B
24
+ ;;
25
+ * )
26
+ printf ' %02x' $B
27
+ ;;
28
+ esac
29
+ done
30
+
31
+ echo
32
+ }
33
+
34
+ mkdir -p " $OUTPUT_DIR "
35
+
36
+ [ -f " $NS_FILE " ] || echo " test-namespace-$( uuid | cut -d ' -' -f 5) " > " $NS_FILE "
37
+
38
+ cat " $NS_FILE "
You can’t perform that action at this time.
0 commit comments