Skip to content

Commit bc11df5

Browse files
committed
TEST Python ver
updated python ver print rc Added debug helpers Added debug helpers to all scripts Added exception for event lister test Removed sdk-user for testing purposes
1 parent f00c3ab commit bc11df5

File tree

4 files changed

+124
-30
lines changed

4 files changed

+124
-30
lines changed

.github/workflows/e2e_tests.yaml

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979
- name: Set up specific Python version
8080
uses: actions/setup-python@v5
8181
with:
82-
python-version: '3.9'
82+
python-version: '3.9.18'
8383
cache: 'pip' # caching pip dependencies
8484

8585
- name: Setup and start KinD cluster
@@ -98,39 +98,14 @@ jobs:
9898
kubectl wait --timeout=120s --for=condition=Available=true deployment -n openshift-operators codeflare-operator-manager
9999
cd ..
100100
101-
- name: Add user to KinD
102-
uses: ./common/github-actions/kind-add-user
103-
with:
104-
user-name: sdk-user
105-
106101
- name: Add kueue resources
107102
run: kubectl apply --server-side -f "https://github.com/kubernetes-sigs/kueue/releases/download/v0.6.2/manifests.yaml"
108103

109-
- name: Configure RBAC for sdk user with limited permissions
110-
run: |
111-
kubectl create clusterrole list-ingresses --verb=get,list --resource=ingresses
112-
kubectl create clusterrolebinding sdk-user-list-ingresses --clusterrole=list-ingresses --user=sdk-user
113-
kubectl create clusterrole namespace-creator --verb=get,list,create,delete,patch --resource=namespaces
114-
kubectl create clusterrolebinding sdk-user-namespace-creator --clusterrole=namespace-creator --user=sdk-user
115-
kubectl create clusterrole raycluster-creator --verb=get,list,create,delete,patch --resource=rayclusters
116-
kubectl create clusterrolebinding sdk-user-raycluster-creator --clusterrole=raycluster-creator --user=sdk-user
117-
kubectl create clusterrole appwrapper-creator --verb=get,list,create,delete,patch --resource=appwrappers
118-
kubectl create clusterrolebinding sdk-user-appwrapper-creator --clusterrole=appwrapper-creator --user=sdk-user
119-
kubectl create clusterrole resourceflavor-creator --verb=get,list,create,delete --resource=resourceflavors
120-
kubectl create clusterrolebinding sdk-user-resourceflavor-creator --clusterrole=resourceflavor-creator --user=sdk-user
121-
kubectl create clusterrole clusterqueue-creator --verb=get,list,create,delete,patch --resource=clusterqueues
122-
kubectl create clusterrolebinding sdk-user-clusterqueue-creator --clusterrole=clusterqueue-creator --user=sdk-user
123-
kubectl create clusterrole localqueue-creator --verb=get,list,create,delete,patch --resource=localqueues
124-
kubectl create clusterrolebinding sdk-user-localqueue-creator --clusterrole=localqueue-creator --user=sdk-user
125-
kubectl create clusterrole list-secrets --verb=get,list --resource=secrets
126-
kubectl create clusterrolebinding sdk-user-list-secrets --clusterrole=list-secrets --user=sdk-user
127-
kubectl config use-context sdk-user
128-
129104
- name: Run e2e tests
130105
run: |
131106
export CODEFLARE_TEST_OUTPUT_DIR=${{ env.TEMP_DIR }}
132107
echo "CODEFLARE_TEST_OUTPUT_DIR=${CODEFLARE_TEST_OUTPUT_DIR}" >> $GITHUB_ENV
133-
108+
python --version
134109
set -euo pipefail
135110
pip install poetry
136111
poetry install --with test,docs

tests/e2e/local_interactive_sdk_kind_test.py

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import pytest
99
import ray
1010
import math
11+
from time import sleep
1112

1213
from support import *
1314

@@ -45,11 +46,51 @@ def run_local_interactives(self):
4546
max_memory=2,
4647
num_gpus=0,
4748
image=ray_image,
48-
write_to_file=True,
49+
write_to_file=False,
4950
verify_tls=False,
5051
)
5152
)
5253
cluster.up()
54+
sleep(60)
55+
api_instance = client.CustomObjectsApi()
56+
rcs = api_instance.list_namespaced_custom_object(
57+
group="ray.io",
58+
version="v1",
59+
namespace=self.namespace,
60+
plural="rayclusters",
61+
)
62+
print("------------------ Ray Cluster ------------------")
63+
for rc in rcs["items"]:
64+
print(rc)
65+
print("------------------ EVENTS ------------------")
66+
v1 = client.CoreV1Api()
67+
print(f"Events in namespace: {self.namespace}")
68+
try:
69+
events = v1.list_namespaced_event(namespace=self.namespace).items
70+
for event in events:
71+
print(
72+
f"Event: {event.metadata.name}, Reason: {event.reason}, Message: {event.message}, Timestamp: {event.last_timestamp}"
73+
)
74+
except client.exceptions.ApiException as e:
75+
print(f"Exception when calling CoreV1Api->list_namespaced_event: {e}")
76+
77+
print("------------------ Workloads ------------------")
78+
api_instance = client.CustomObjectsApi()
79+
try:
80+
workloads = api_instance.list_namespaced_custom_object(
81+
"kueue.x-k8s.io", "v1beta1", self.namespace, "workloads"
82+
)
83+
for workload in workloads.get("items", []):
84+
name = workload["metadata"]["name"]
85+
status = workload.get("status", {})
86+
print(
87+
f"Workload: {name}, Namespace: {self.namespace}, Status: {status}"
88+
)
89+
except client.exceptions.ApiException as e:
90+
print(
91+
f"Exception when calling CustomObjectsApi->list_namespaced_custom_object: {e}"
92+
)
93+
5394
cluster.wait_ready()
5495

5596
generate_cert.generate_tls_cert(cluster_name, self.namespace)

tests/e2e/mnist_raycluster_sdk_aw_kind_test.py

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import pytest
99

1010
from support import *
11+
from time import sleep
1112

1213
# This test creates an AppWrapper containing a Ray Cluster and covers the Ray Job submission functionality on Kind Cluster
1314

@@ -49,7 +50,45 @@ def run_mnist_raycluster_sdk_kind(self):
4950
)
5051

5152
cluster.up()
52-
53+
sleep(45)
54+
api_instance = client.CustomObjectsApi()
55+
rcs = api_instance.list_namespaced_custom_object(
56+
group="ray.io",
57+
version="v1",
58+
namespace=self.namespace,
59+
plural="rayclusters",
60+
)
61+
print("------------------ Ray Cluster ------------------")
62+
for rc in rcs["items"]:
63+
print(rc)
64+
print("------------------ EVENTS ------------------")
65+
v1 = client.CoreV1Api()
66+
print(f"Events in namespace: {self.namespace}")
67+
try:
68+
events = v1.list_namespaced_event(namespace=self.namespace).items
69+
for event in events:
70+
print(
71+
f"Event: {event.metadata.name}, Reason: {event.reason}, Message: {event.message}, Timestamp: {event.last_timestamp}"
72+
)
73+
except client.exceptions.ApiException as e:
74+
print(f"Exception when calling CoreV1Api->list_namespaced_event: {e}")
75+
76+
print("------------------ Workloads ------------------")
77+
api_instance = client.CustomObjectsApi()
78+
try:
79+
workloads = api_instance.list_namespaced_custom_object(
80+
"kueue.x-k8s.io", "v1beta1", self.namespace, "workloads"
81+
)
82+
for workload in workloads.get("items", []):
83+
name = workload["metadata"]["name"]
84+
status = workload.get("status", {})
85+
print(
86+
f"Workload: {name}, Namespace: {self.namespace}, Status: {status}"
87+
)
88+
except client.exceptions.ApiException as e:
89+
print(
90+
f"Exception when calling CustomObjectsApi->list_namespaced_custom_object: {e}"
91+
)
5392
cluster.status()
5493

5594
cluster.wait_ready()

tests/e2e/mnist_raycluster_sdk_kind_test.py

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import pytest
99

1010
from support import *
11+
from time import sleep
1112

1213
# This test creates a Ray Cluster and covers the Ray Job submission functionality on Kind Cluster
1314

@@ -49,7 +50,45 @@ def run_mnist_raycluster_sdk_kind(self):
4950
)
5051

5152
cluster.up()
52-
53+
sleep(45)
54+
api_instance = client.CustomObjectsApi()
55+
rcs = api_instance.list_namespaced_custom_object(
56+
group="ray.io",
57+
version="v1",
58+
namespace=self.namespace,
59+
plural="rayclusters",
60+
)
61+
print("------------------ Ray Cluster ------------------")
62+
for rc in rcs["items"]:
63+
print(rc)
64+
print("------------------ EVENTS ------------------")
65+
v1 = client.CoreV1Api()
66+
print(f"Events in namespace: {self.namespace}")
67+
try:
68+
events = v1.list_namespaced_event(namespace=self.namespace).items
69+
for event in events:
70+
print(
71+
f"Event: {event.metadata.name}, Reason: {event.reason}, Message: {event.message}, Timestamp: {event.last_timestamp}"
72+
)
73+
except client.exceptions.ApiException as e:
74+
print(f"Exception when calling CoreV1Api->list_namespaced_event: {e}")
75+
76+
print("------------------ Workloads ------------------")
77+
api_instance = client.CustomObjectsApi()
78+
try:
79+
workloads = api_instance.list_namespaced_custom_object(
80+
"kueue.x-k8s.io", "v1beta1", self.namespace, "workloads"
81+
)
82+
for workload in workloads.get("items", []):
83+
name = workload["metadata"]["name"]
84+
status = workload.get("status", {})
85+
print(
86+
f"Workload: {name}, Namespace: {self.namespace}, Status: {status}"
87+
)
88+
except client.exceptions.ApiException as e:
89+
print(
90+
f"Exception when calling CustomObjectsApi->list_namespaced_custom_object: {e}"
91+
)
5392
cluster.status()
5493

5594
cluster.wait_ready()

0 commit comments

Comments
 (0)