Skip to content

Commit 515518c

Browse files
Merge pull request #2516 from JoaoFula/prepare-test-suite-for-disconnected-tests
OLS-1678 - Modifying script calling and installation for disconnected environment
2 parents efdd447 + 030f565 commit 515518c

File tree

2 files changed

+88
-80
lines changed

2 files changed

+88
-80
lines changed

tests/e2e/utils/ols_installer.py

Lines changed: 53 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -239,61 +239,64 @@ def create_secrets(provider_name: str, creds: str, provider_size: int) -> None:
239239
)
240240

241241

242-
def install_ols() -> tuple[str, str, str]: # pylint: disable=R0915 # noqa: C901
242+
def install_ols() -> tuple[str, str, str]: # pylint: disable=R0915, R0912 # noqa: C901
243243
"""Install OLS onto an OCP cluster using the OLS operator."""
244-
print("Setting up for on cluster test execution")
245-
bundle_image = os.getenv(
246-
"BUNDLE_IMAGE", "quay.io/openshift-lightspeed/lightspeed-operator-bundle:latest"
247-
)
248-
# setup the lightspeed namespace
249-
cluster_utils.run_oc(
250-
["create", "ns", "openshift-lightspeed"], ignore_existing_resource=True
251-
)
252-
cluster_utils.run_oc(
253-
["project", "openshift-lightspeed"], ignore_existing_resource=True
254-
)
255-
print("created OLS project")
244+
disconnected = os.getenv("DISCONNECTED", "")
245+
if not disconnected:
246+
print("Setting up for on cluster test execution")
247+
bundle_image = os.getenv(
248+
"BUNDLE_IMAGE",
249+
"quay.io/openshift-lightspeed/lightspeed-operator-bundle:latest",
250+
)
251+
# setup the lightspeed namespace
252+
cluster_utils.run_oc(
253+
["create", "ns", "openshift-lightspeed"], ignore_existing_resource=True
254+
)
255+
cluster_utils.run_oc(
256+
["project", "openshift-lightspeed"], ignore_existing_resource=True
257+
)
258+
print("created OLS project")
256259

257-
# install the ImageDigestMirrorSet to mirror images
258-
# from "registry.redhat.io/openshift-lightspeed-beta"
259-
# to "quay.io/redhat-user-workloads/crt-nshift-lightspeed-tenant/ols"
260-
cluster_utils.run_oc(
261-
["create", "-f", "tests/config/operator_install/imagedigestmirrorset.yaml"],
262-
ignore_existing_resource=True,
263-
)
260+
# install the ImageDigestMirrorSet to mirror images
261+
# from "registry.redhat.io/openshift-lightspeed-beta"
262+
# to "quay.io/redhat-user-workloads/crt-nshift-lightspeed-tenant/ols"
263+
cluster_utils.run_oc(
264+
["create", "-f", "tests/config/operator_install/imagedigestmirrorset.yaml"],
265+
ignore_existing_resource=True,
266+
)
264267

265-
# install the operator from bundle
266-
print("Installing OLS operator from bundle")
267-
cluster_utils.run_oc(
268-
[
269-
"apply",
270-
"-f",
271-
"tests/config/operator_install/imagedigestmirrorset.yaml",
272-
],
273-
ignore_existing_resource=True,
274-
)
275-
try:
276-
subprocess.run( # noqa: S603
277-
[ # noqa: S607
278-
"operator-sdk",
279-
"run",
280-
"bundle",
281-
"--timeout=20m",
282-
"-n",
283-
"openshift-lightspeed",
284-
bundle_image,
285-
"--verbose",
268+
# install the operator from bundle
269+
print("Installing OLS operator from bundle")
270+
cluster_utils.run_oc(
271+
[
272+
"apply",
273+
"-f",
274+
"tests/config/operator_install/imagedigestmirrorset.yaml",
286275
],
287-
capture_output=True,
288-
text=True,
289-
check=True,
290-
)
291-
# TODO: add run_command func
292-
except subprocess.CalledProcessError as e:
293-
print(
294-
f"Error running operator-sdk: {e}, stdout: {e.output}, stderr: {e.stderr}"
276+
ignore_existing_resource=True,
295277
)
296-
raise
278+
try:
279+
subprocess.run( # noqa: S603
280+
[ # noqa: S607
281+
"operator-sdk",
282+
"run",
283+
"bundle",
284+
"--timeout=20m",
285+
"-n",
286+
"openshift-lightspeed",
287+
bundle_image,
288+
"--verbose",
289+
],
290+
capture_output=True,
291+
text=True,
292+
check=True,
293+
)
294+
# TODO: add run_command func
295+
except subprocess.CalledProcessError as e:
296+
print(
297+
f"Error running operator-sdk: {e}, stdout: {e.output}, stderr: {e.stderr}"
298+
)
299+
raise
297300

298301
token, metrics_token = create_and_config_sas()
299302

tests/scripts/test-e2e-cluster-periodics.sh

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -37,36 +37,41 @@ function run_suites() {
3737
# runsuite arguments:
3838
# suiteid test_tags provider provider_keypath model ols_image
3939
# empty test_tags means run all tests
40-
run_suite "azure_openai" "not certificates and not (tool_calling and not smoketest and not rag)" "azure_openai" "$AZUREOPENAI_PROVIDER_KEY_PATH" "gpt-4o-mini" "$OLS_IMAGE" "n"
41-
(( rc = rc || $? ))
42-
43-
run_suite "openai" "not azure_entra_id and not certificates and not (tool_calling and not smoketest and not rag)" "openai" "$OPENAI_PROVIDER_KEY_PATH" "gpt-4o-mini" "$OLS_IMAGE" "n"
44-
(( rc = rc || $? ))
45-
46-
run_suite "watsonx" "not azure_entra_id and not certificates and not (tool_calling and not smoketest and not rag)" "watsonx" "$WATSONX_PROVIDER_KEY_PATH" "ibm/granite-3-2-8b-instruct" "$OLS_IMAGE" "n"
47-
(( rc = rc || $? ))
48-
49-
# smoke tests for RHOAI VLLM-compatible provider
50-
run_suite "rhoai_vllm" "smoketest" "rhoai_vllm" "$OPENAI_PROVIDER_KEY_PATH" "gpt-3.5-turbo" "$OLS_IMAGE" "n"
51-
(( rc = rc || $? ))
52-
53-
# smoke tests for RHELAI VLLM-compatible provider
54-
run_suite "rhelai_vllm" "smoketest" "rhelai_vllm" "$OPENAI_PROVIDER_KEY_PATH" "gpt-3.5-turbo" "$OLS_IMAGE" "n"
55-
(( rc = rc || $? ))
56-
57-
run_suite "certificates" "certificates" "openai" "$OPENAI_PROVIDER_KEY_PATH" "gpt-4o-mini" "$OLS_IMAGE" "n"
58-
(( rc = rc || $? ))
59-
60-
61-
# TODO: Reduce execution time. Sequential execution will take more time. Parallel execution will have cluster claim issue.
62-
# Run tool calling - Enable tool_calling
63-
run_suite "azure_openai_tool_calling" "tool_calling" "azure_openai" "$AZUREOPENAI_PROVIDER_KEY_PATH" "gpt-4o-mini" "$OLS_IMAGE" "y"
64-
(( rc = rc || $? ))
65-
run_suite "openai_tool_calling" "tool_calling" "openai" "$OPENAI_PROVIDER_KEY_PATH" "gpt-4o-mini" "$OLS_IMAGE" "y"
66-
(( rc = rc || $? ))
67-
run_suite "watsonx_tool_calling" "tool_calling" "watsonx" "$WATSONX_PROVIDER_KEY_PATH" "ibm/granite-3-2-8b-instruct" "$OLS_IMAGE" "y"
68-
(( rc = rc || $? ))
69-
40+
if [$DISCONNECTED]; then
41+
# smoke tests for RHOAI VLLM-compatible provider
42+
run_suite "rhoai_vllm" "smoketest" "rhoai_vllm" "$OPENAI_PROVIDER_KEY_PATH" "gpt-3.5-turbo" "$OLS_IMAGE" "n"
43+
(( rc = rc || $? ))
44+
else
45+
run_suite "azure_openai" "not certificates and not (tool_calling and not smoketest and not rag)" "azure_openai" "$AZUREOPENAI_PROVIDER_KEY_PATH" "gpt-4o-mini" "$OLS_IMAGE" "n"
46+
(( rc = rc || $? ))
47+
48+
run_suite "openai" "not azure_entra_id and not certificates and not (tool_calling and not smoketest and not rag)" "openai" "$OPENAI_PROVIDER_KEY_PATH" "gpt-4o-mini" "$OLS_IMAGE" "n"
49+
(( rc = rc || $? ))
50+
51+
run_suite "watsonx" "not azure_entra_id and not certificates and not (tool_calling and not smoketest and not rag)" "watsonx" "$WATSONX_PROVIDER_KEY_PATH" "ibm/granite-3-2-8b-instruct" "$OLS_IMAGE" "n"
52+
(( rc = rc || $? ))
53+
54+
# smoke tests for RHOAI VLLM-compatible provider
55+
run_suite "rhoai_vllm" "smoketest" "rhoai_vllm" "$OPENAI_PROVIDER_KEY_PATH" "gpt-3.5-turbo" "$OLS_IMAGE" "n"
56+
(( rc = rc || $? ))
57+
58+
# smoke tests for RHELAI VLLM-compatible provider
59+
run_suite "rhelai_vllm" "smoketest" "rhelai_vllm" "$OPENAI_PROVIDER_KEY_PATH" "gpt-3.5-turbo" "$OLS_IMAGE" "n"
60+
(( rc = rc || $? ))
61+
62+
run_suite "certificates" "certificates" "openai" "$OPENAI_PROVIDER_KEY_PATH" "gpt-4o-mini" "$OLS_IMAGE" "n"
63+
(( rc = rc || $? ))
64+
65+
66+
# TODO: Reduce execution time. Sequential execution will take more time. Parallel execution will have cluster claim issue.
67+
# Run tool calling - Enable tool_calling
68+
run_suite "azure_openai_tool_calling" "tool_calling" "azure_openai" "$AZUREOPENAI_PROVIDER_KEY_PATH" "gpt-4o-mini" "$OLS_IMAGE" "y"
69+
(( rc = rc || $? ))
70+
run_suite "openai_tool_calling" "tool_calling" "openai" "$OPENAI_PROVIDER_KEY_PATH" "gpt-4o-mini" "$OLS_IMAGE" "y"
71+
(( rc = rc || $? ))
72+
run_suite "watsonx_tool_calling" "tool_calling" "watsonx" "$WATSONX_PROVIDER_KEY_PATH" "ibm/granite-3-2-8b-instruct" "$OLS_IMAGE" "y"
73+
(( rc = rc || $? ))
74+
fi
7075
set -e
7176

7277
return $rc

0 commit comments

Comments
 (0)