Skip to content

Commit

Permalink
Added pod yaml print statements
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobbins228 committed Jun 14, 2024
1 parent 232ecfe commit 2ff7351
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 1 deletion.
25 changes: 24 additions & 1 deletion tests/e2e/local_interactive_sdk_kind_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from time import sleep

from support import *
import yaml


@pytest.mark.kind
Expand Down Expand Up @@ -91,7 +92,29 @@ def run_local_interactives(self):
print(
f"Exception when calling CustomObjectsApi->list_namespaced_custom_object: {e}"
)

print("------------- PODS ----------------")
try:
pods = v1.list_namespaced_pod(self.namespace)
except client.exceptions.ApiException as e:
print(f"Exception when calling CoreV1Api->list_namespaced_pod: {e}")
exit(1)

# Loop through the list of pods and print the YAML of those that start with 'test-name-head'
for pod in pods.items:
pod_name = pod.metadata.name
if pod_name.startswith("test-ray-cluster-li"):
print(f"YAML configuration for pod: {pod_name}")
try:
pod_detail = v1.read_namespaced_pod(
name=pod_name, namespace=self.namespace
)
pod_dict = pod_detail.to_dict()
print("---------------------------------")
print(yaml.dump(pod_dict, default_flow_style=False))
except client.exceptions.ApiException as e:
print(
f"Exception when calling CoreV1Api->read_namespaced_pod for pod {pod_name}: {e}"
)
cluster.wait_ready()

generate_cert.generate_tls_cert(cluster_name, self.namespace)
Expand Down
24 changes: 24 additions & 0 deletions tests/e2e/mnist_raycluster_sdk_aw_kind_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from time import sleep

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


@pytest.mark.kind
Expand Down Expand Up @@ -90,6 +91,29 @@ def run_mnist_raycluster_sdk_kind(self):
print(
f"Exception when calling CustomObjectsApi->list_namespaced_custom_object: {e}"
)
print("------------- PODS ----------------")
try:
pods = v1.list_namespaced_pod(self.namespace)
except client.exceptions.ApiException as e:
print(f"Exception when calling CoreV1Api->list_namespaced_pod: {e}")
exit(1)

# Loop through the list of pods and print the YAML of those that start with 'test-name-head'
for pod in pods.items:
pod_name = pod.metadata.name
if pod_name.startswith("mnist"):
print(f"YAML configuration for pod: {pod_name}")
try:
pod_detail = v1.read_namespaced_pod(
name=pod_name, namespace=self.namespace
)
pod_dict = pod_detail.to_dict()
print("---------------------------------")
print(yaml.dump(pod_dict, default_flow_style=False))
except client.exceptions.ApiException as e:
print(
f"Exception when calling CoreV1Api->read_namespaced_pod for pod {pod_name}: {e}"
)
cluster.status()

cluster.wait_ready()
Expand Down
25 changes: 25 additions & 0 deletions tests/e2e/mnist_raycluster_sdk_kind_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

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

import yaml


@pytest.mark.kind
class TestRayClusterSDKKind:
Expand Down Expand Up @@ -90,6 +92,29 @@ def run_mnist_raycluster_sdk_kind(self):
print(
f"Exception when calling CustomObjectsApi->list_namespaced_custom_object: {e}"
)
print("------------- PODS ----------------")
try:
pods = v1.list_namespaced_pod(self.namespace)
except client.exceptions.ApiException as e:
print(f"Exception when calling CoreV1Api->list_namespaced_pod: {e}")
exit(1)

# Loop through the list of pods and print the YAML of those that start with 'test-name-head'
for pod in pods.items:
pod_name = pod.metadata.name
if pod_name.startswith("mnist"):
print(f"YAML configuration for pod: {pod_name}")
try:
pod_detail = v1.read_namespaced_pod(
name=pod_name, namespace=self.namespace
)
pod_dict = pod_detail.to_dict()
print("---------------------------------")
print(yaml.dump(pod_dict, default_flow_style=False))
except client.exceptions.ApiException as e:
print(
f"Exception when calling CoreV1Api->read_namespaced_pod for pod {pod_name}: {e}"
)
cluster.status()

cluster.wait_ready()
Expand Down

0 comments on commit 2ff7351

Please sign in to comment.