Skip to content

Commit 63a88b8

Browse files
committed
test: sdk upgrade tests
1 parent 158224f commit 63a88b8

File tree

13 files changed

+1717
-25
lines changed

13 files changed

+1717
-25
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ docs/sphinx/modules.rst
2020
.idea/
2121
.cursor/plans/
2222
.cursor/commands/
23+
/results

images/tests/Dockerfile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,20 @@ RUN poetry install --no-root --with test && rm -rf $POETRY_CACHE_DIR
3535
# Runtime stage
3636
FROM python:3.12-slim
3737

38-
# Install system dependencies for runtime
38+
# Install system dependencies for runtime including Chrome for Selenium tests
3939
RUN apt-get update && \
4040
apt-get install -y --no-install-recommends \
4141
curl \
4242
ca-certificates \
43-
&& rm -rf /var/lib/apt/lists/*
43+
wget \
44+
gnupg \
45+
&& wget -q -O /tmp/google-chrome-key.pub https://dl-ssl.google.com/linux/linux_signing_key.pub \
46+
&& gpg --dearmor -o /usr/share/keyrings/google-chrome-keyring.gpg /tmp/google-chrome-key.pub \
47+
&& echo "deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome-keyring.gpg] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list \
48+
&& apt-get update \
49+
&& apt-get install -y --no-install-recommends \
50+
google-chrome-stable \
51+
&& rm -rf /var/lib/apt/lists/* /tmp/google-chrome-key.pub
4452

4553
# Install OpenShift CLI (oc)
4654
RUN curl -L https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/linux/oc.tar.gz | \

images/tests/run-tests.sh

Lines changed: 76 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,23 @@ cleanup_on_exit() {
5555
echo "WARNING: TEST_USER_USERNAME not found, cannot cleanup RBAC"
5656
fi
5757

58-
# Set Kueue Component to Removed State
59-
echo "Setting Kueue component to Removed state..."
60-
DSC_NAME=$(get_dsc_name 2>/dev/null || echo "")
61-
62-
if [ -n "$DSC_NAME" ] && [[ ! "$DSC_NAME" =~ ^ERROR ]]; then
63-
set_kueue_management_state "Removed" "$DSC_NAME" 2>/dev/null || {
64-
echo "WARNING: Failed to set Kueue to Removed state"
65-
}
66-
wait_for_dsc_ready 600 2>/dev/null || {
67-
echo "WARNING: DataScienceCluster did not reach Ready state after setting Kueue to Removed"
68-
}
58+
# Set Kueue Component to Removed State (only if we changed it)
59+
if [ "${INITIAL_KUEUE_STATE:-}" = "Unmanaged" ]; then
60+
echo "Kueue was already Unmanaged at start, skipping state change in cleanup"
6961
else
70-
echo "WARNING: Failed to get DataScienceCluster name, skipping Kueue cleanup"
62+
echo "Setting Kueue component to Removed state..."
63+
DSC_NAME=$(get_dsc_name 2>/dev/null || echo "")
64+
65+
if [ -n "$DSC_NAME" ] && [[ ! "$DSC_NAME" =~ ^ERROR ]]; then
66+
set_kueue_management_state "Removed" "$DSC_NAME" 2>/dev/null || {
67+
echo "WARNING: Failed to set Kueue to Removed state"
68+
}
69+
wait_for_dsc_ready 600 2>/dev/null || {
70+
echo "WARNING: DataScienceCluster did not reach Ready state after setting Kueue to Removed"
71+
}
72+
else
73+
echo "WARNING: Failed to get DataScienceCluster name, skipping Kueue cleanup"
74+
fi
7175
fi
7276
else
7377
echo "WARNING: Failed to login with OCP_ADMIN_USER for cleanup"
@@ -186,6 +190,28 @@ wait_for_dsc_ready() {
186190
return 1
187191
}
188192

193+
# Get Kueue component management state
194+
# Arguments: cluster_name
195+
get_kueue_management_state() {
196+
local cluster_name=$1
197+
198+
if [ -z "$cluster_name" ]; then
199+
echo "ERROR: Invalid arguments for get_kueue_management_state"
200+
return 1
201+
fi
202+
203+
local state
204+
state=$(oc get DataScienceCluster "$cluster_name" -o jsonpath='{.spec.components.kueue.managementState}' 2>/dev/null)
205+
206+
if [ -z "$state" ]; then
207+
echo "ERROR: Failed to get Kueue management state"
208+
return 1
209+
fi
210+
211+
echo "$state"
212+
return 0
213+
}
214+
189215
# Set Kueue component management state
190216
# Arguments: state (Unmanaged or Removed), cluster_name
191217
set_kueue_management_state() {
@@ -296,22 +322,38 @@ echo "Successfully logged in with OCP_ADMIN_USER (verified: $CURRENT_USER)"
296322
# ============================================================================
297323
# Set Kueue Component to Unmanaged State
298324
# ============================================================================
299-
echo "Setting Kueue component to Unmanaged state..."
325+
echo "Checking current Kueue component state..."
300326
DSC_NAME=$(get_dsc_name) || {
301327
echo "ERROR: Failed to get DataScienceCluster name"
302328
exit 1
303329
}
304330

305-
set_kueue_management_state "Unmanaged" "$DSC_NAME" || {
306-
echo "ERROR: Failed to set Kueue to Unmanaged state"
331+
# Get and store the initial Kueue management state
332+
INITIAL_KUEUE_STATE=$(get_kueue_management_state "$DSC_NAME") || {
333+
echo "ERROR: Failed to get initial Kueue management state"
307334
exit 1
308335
}
336+
echo "Initial Kueue management state: $INITIAL_KUEUE_STATE"
309337

310-
# Wait for DataScienceCluster to be Ready after setting Kueue to Unmanaged
311-
wait_for_dsc_ready 600 || {
312-
echo "ERROR: DataScienceCluster did not reach Ready state after setting Kueue to Unmanaged"
313-
exit 1
314-
}
338+
# Export it so cleanup function can access it
339+
export INITIAL_KUEUE_STATE
340+
341+
# Only set to Unmanaged if it's not already Unmanaged
342+
if [ "$INITIAL_KUEUE_STATE" = "Unmanaged" ]; then
343+
echo "Kueue is already in Unmanaged state, skipping state change"
344+
else
345+
echo "Setting Kueue component to Unmanaged state..."
346+
set_kueue_management_state "Unmanaged" "$DSC_NAME" || {
347+
echo "ERROR: Failed to set Kueue to Unmanaged state"
348+
exit 1
349+
}
350+
351+
# Wait for DataScienceCluster to be Ready after setting Kueue to Unmanaged
352+
wait_for_dsc_ready 600 || {
353+
echo "ERROR: DataScienceCluster did not reach Ready state after setting Kueue to Unmanaged"
354+
exit 1
355+
}
356+
fi
315357

316358
# ============================================================================
317359
# Apply RBAC Policies
@@ -387,6 +429,20 @@ cp "${TEMP_KUBECONFIG}" ~/.kube/config || {
387429

388430
echo "Successfully logged in with TEST_USER"
389431

432+
# ============================================================================
433+
# Get RHOAI Dashboard URL for UI Tests
434+
# ============================================================================
435+
echo "Retrieving RHOAI Dashboard URL..."
436+
ODH_DASHBOARD_URL=$(oc get consolelink rhodslink -o jsonpath='{.spec.href}' 2>/dev/null)
437+
438+
if [ -z "$ODH_DASHBOARD_URL" ]; then
439+
echo "WARNING: Failed to retrieve Dashboard URL from consolelink rhodslink"
440+
echo " UI tests will be skipped or may fail"
441+
else
442+
echo "Dashboard URL: $ODH_DASHBOARD_URL"
443+
export ODH_DASHBOARD_URL
444+
fi
445+
390446
# ============================================================================
391447
# Run Tests
392448
# ============================================================================

poetry.lock

Lines changed: 149 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)