Skip to content

Commit 0200c71

Browse files
committed
Fix regression: previously create test namespace is used across test runs
This fixes regression introduced in PR redhat-developer#848 - we should reuse created test namespace across multiple runs of acceptance tests Signed-off-by: Predrag Knezevic <[email protected]>
1 parent 9e10117 commit 0200c71

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

Makefile

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -164,24 +164,20 @@ setup-venv:
164164
$(Q)$(PYTHON_VENV_DIR)/bin/pip install --upgrade setuptools
165165
$(Q)$(PYTHON_VENV_DIR)/bin/pip install --upgrade pip
166166

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-
173167
.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 test -f $(OUTPUT_DIR)/test-namespace || (mktemp -u test-namespace-XXXX | tr '[:upper:]' '[:lower:]' > $(OUTPUT_DIR)/test-namespace) && cat $(OUTPUT_DIR)/test-namespace))
171+
echo $(TEST_NAMESPACE)
176172

177173
# Testing setup
178174
.PHONY: deploy-test-3rd-party-crds
179175
deploy-test-3rd-party-crds: get-test-namespace
180176
$(Q)kubectl --namespace $(TEST_NAMESPACE) apply -f ./test/third-party-crds/
181177

182178
.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)
185181

186182
.PHONY: test-setup
187183
test-setup: test-cleanup create-test-namespace deploy-test-3rd-party-crds

0 commit comments

Comments
 (0)