Skip to content

Commit 72dcce4

Browse files
committed
NO-JIRA: chore(tests/): fix running rstudio rhel9 Makefile image tests
1 parent d69c115 commit 72dcce4

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

Makefile

+21
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,27 @@ undeploy-c9s-%: bin/kubectl
269269
$(info # Undeploying notebook from $(NOTEBOOK_DIR) directory...)
270270
$(KUBECTL_BIN) delete -k $(NOTEBOOK_DIR)
271271

272+
.PHONY: deploy-rhel9
273+
deploy-rhel9-%: bin/kubectl bin/yq
274+
$(eval TARGET := $(shell echo $* | sed 's/-rhel9-python.*//'))
275+
$(eval PYTHON_VERSION := $(shell echo $* | sed 's/.*-python-//'))
276+
$(eval NOTEBOOK_DIR := $(subst -,/,$(subst cuda-,,$(TARGET)))/rhel9-python-$(PYTHON_VERSION)/kustomize/base)
277+
ifndef NOTEBOOK_TAG
278+
$(eval NOTEBOOK_TAG := $*-$(IMAGE_TAG))
279+
endif
280+
$(info # Deploying notebook from $(NOTEBOOK_DIR) directory...)
281+
@arg=$(IMAGE_REGISTRY) $(YQ_BIN) e -i '.images[].newName = strenv(arg)' $(NOTEBOOK_DIR)/kustomization.yaml
282+
@arg=$(NOTEBOOK_TAG) $(YQ_BIN) e -i '.images[].newTag = strenv(arg)' $(NOTEBOOK_DIR)/kustomization.yaml
283+
$(KUBECTL_BIN) apply -k $(NOTEBOOK_DIR)
284+
285+
.PHONY: undeploy-rhel9
286+
undeploy-rhel9-%: bin/kubectl
287+
$(eval TARGET := $(shell echo $* | sed 's/-rhel9-python.*//'))
288+
$(eval PYTHON_VERSION := $(shell echo $* | sed 's/.*-python-//'))
289+
$(eval NOTEBOOK_DIR := $(subst -,/,$(subst cuda-,,$(TARGET)))/rhel9-python-$(PYTHON_VERSION)/kustomize/base)
290+
$(info # Undeploying notebook from $(NOTEBOOK_DIR) directory...)
291+
$(KUBECTL_BIN) delete -k $(NOTEBOOK_DIR)
292+
272293
# Verify the notebook's readiness by pinging the /api endpoint and executing the corresponding test_notebook.ipynb file in accordance with the build chain logic.
273294
.PHONY: test
274295
test-%: bin/kubectl

ci/cached-builds/make_test.py

+20-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ def wait_for_stability(pod: str) -> None:
141141
timeout = 100
142142
for _ in range(3):
143143
call(
144-
f"timeout {timeout}s bash -c 'until kubectl wait --for=condition=Ready pods --all --timeout 5s; do sleep 1; done'", shell=True)
144+
f"timeout {timeout}s bash -c 'until kubectl wait --for=condition=Ready pods --all --timeout 5s; do sleep 1; done'",
145+
shell=True)
145146
timeout = 50
146147
time.sleep(3)
147148

@@ -198,6 +199,15 @@ def test_make_commands_rstudio(self, mock_execute: unittest.mock.Mock) -> None:
198199
assert "make validate-rstudio-image image=rstudio-c9s-python-3.11" in commands
199200
assert "make undeploy-c9s-rstudio-c9s-python-3.11" in commands
200201

202+
@unittest.mock.patch("make_test.execute")
203+
def test_make_commands_rsudio_rhel(self, mock_execute: unittest.mock.Mock) -> None:
204+
"""Compares the commands with what we had in the openshift/release yaml"""
205+
run_tests("rstudio-rhel9-python-3.11")
206+
commands: list[str] = [c[0][1][0] for c in mock_execute.call_args_list]
207+
assert "make deploy-rhel9-rstudio-rhel9-python-3.11" in commands
208+
assert "make validate-rstudio-image image=rstudio-rhel9-python-3.11" in commands
209+
assert "make undeploy-rhel9-rstudio-rhel9-python-3.11" in commands
210+
201211
@unittest.mock.patch("make_test.execute")
202212
def test_make_commands_cuda_rstudio(self, mock_execute: unittest.mock.Mock) -> None:
203213
"""Compares the commands with what we had in the openshift/release yaml"""
@@ -207,6 +217,15 @@ def test_make_commands_cuda_rstudio(self, mock_execute: unittest.mock.Mock) -> N
207217
assert "make validate-rstudio-image image=cuda-rstudio-c9s-python-3.11" in commands
208218
assert "make undeploy-c9s-rstudio-c9s-python-3.11" in commands
209219

220+
@unittest.mock.patch("make_test.execute")
221+
def test_make_commands_cuda_rstudio_rhel(self, mock_execute: unittest.mock.Mock) -> None:
222+
"""Compares the commands with what we had in the openshift/release yaml"""
223+
run_tests("cuda-rstudio-rhel9-python-3.11")
224+
commands: list[str] = [c[0][1][0] for c in mock_execute.call_args_list]
225+
assert "make deploy-rhel9-rstudio-rhel9-python-3.11" in commands
226+
assert "make validate-rstudio-image image=cuda-rstudio-rhel9-python-3.11" in commands
227+
assert "make undeploy-rhel9-rstudio-rhel9-python-3.11" in commands
228+
210229
@unittest.mock.patch("make_test.execute")
211230
def test_make_commands_runtime(self, mock_execute: unittest.mock.Mock) -> None:
212231
"""Compares the commands with what we had in the openshift/release yaml"""

0 commit comments

Comments
 (0)