Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
413 changes: 319 additions & 94 deletions images/tests/run-tests.sh

Large diffs are not rendered by default.

21 changes: 12 additions & 9 deletions tests/e2e/gateway_api_resources_oauth_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from codeflare_sdk import (
Cluster,
ClusterConfiguration,
TokenAuthentication,
)

from kubernetes import client
Expand All @@ -31,6 +30,8 @@
delete_kueue_resources,
get_ray_image,
run_oc_command,
authenticate_for_tests,
cleanup_authentication,
# Gateway API helpers
get_reference_grant,
list_reference_grants,
Expand All @@ -44,6 +45,7 @@
verify_reference_grant_spec,
verify_httproute_spec,
verify_network_policy_spec,
wait_ready_enhanced,
)


Expand All @@ -61,6 +63,9 @@ def setup_method(self):
self.networking_api = client.NetworkingV1Api(self.api_instance.api_client)

def teardown_method(self):
# Clean up authentication if needed
if hasattr(self, "auth_instance"):
cleanup_authentication(self.auth_instance)
# Only delete namespace if it was created
if hasattr(self, "namespace"):
delete_namespace(self)
Expand All @@ -80,13 +85,11 @@ def test_gateway_resources_created_with_raycluster(self):
cluster_name = "gateway-test"
ray_image = get_ray_image()

# Authenticate with current user token
auth = TokenAuthentication(
token=run_oc_command(["whoami", "--show-token=true"]),
server=run_oc_command(["whoami", "--show-server=true"]),
skip_tls=True,
)
auth.login()
# Set up authentication based on detected method
auth_instance = authenticate_for_tests()

# Store auth instance for cleanup
self.auth_instance = auth_instance

cluster = Cluster(
ClusterConfiguration(
Expand Down Expand Up @@ -116,7 +119,7 @@ def test_gateway_resources_created_with_raycluster(self):
cluster.apply()

# Wait for cluster to be ready
cluster.wait_ready()
wait_ready_enhanced(cluster)

# Verify ReferenceGrant is created
reference_grant_name = self.verify_reference_grant_created(cluster_name)
Expand Down
17 changes: 9 additions & 8 deletions tests/e2e/heterogeneous_clusters_oauth_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from codeflare_sdk import (
Cluster,
ClusterConfiguration,
TokenAuthentication,
)

from codeflare_sdk.common.kueue.kueue import list_local_queues
Expand All @@ -19,6 +18,9 @@ def setup_method(self):
initialize_kubernetes_client(self)

def teardown_method(self):
# Clean up authentication if needed
if hasattr(self, "auth_instance"):
cleanup_authentication(self.auth_instance)
delete_namespace(self)
delete_kueue_resources(self)

Expand All @@ -32,12 +34,11 @@ def run_heterogeneous_clusters(
):
ray_image = get_ray_image()

auth = TokenAuthentication(
token=run_oc_command(["whoami", "--show-token=true"]),
server=run_oc_command(["whoami", "--show-server=true"]),
skip_tls=True,
)
auth.login()
# Set up authentication based on detected method
auth_instance = authenticate_for_tests()

# Store auth instance for cleanup
self.auth_instance = auth_instance

for flavor in self.resource_flavors:
node_labels = (
Expand Down Expand Up @@ -70,7 +71,7 @@ def run_heterogeneous_clusters(
)
cluster.apply()
# Wait for the cluster to be scheduled and ready, we don't need the dashboard for this check
cluster.wait_ready(dashboard_check=False)
wait_ready_with_stuck_detection(cluster, dashboard_check=False)
node_name = get_pod_node(self, self.namespace, cluster_name)
print(f"Cluster {cluster_name}-{flavor} is running on node: {node_name}")
assert (
Expand Down
17 changes: 9 additions & 8 deletions tests/e2e/local_interactive_sdk_oauth_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from codeflare_sdk import (
Cluster,
ClusterConfiguration,
TokenAuthentication,
generate_cert,
)

Expand All @@ -20,6 +19,9 @@ def setup_method(self):
initialize_kubernetes_client(self)

def teardown_method(self):
# Clean up authentication if needed
if hasattr(self, "auth_instance"):
cleanup_authentication(self.auth_instance)
delete_namespace(self)
delete_kueue_resources(self)

Expand All @@ -32,12 +34,11 @@ def test_local_interactives(self):
def run_local_interactives(self):
ray_image = get_ray_image()

auth = TokenAuthentication(
token=run_oc_command(["whoami", "--show-token=true"]),
server=run_oc_command(["whoami", "--show-server=true"]),
skip_tls=True,
)
auth.login()
# Set up authentication based on detected method
auth_instance = authenticate_for_tests()

# Store auth instance for cleanup
self.auth_instance = auth_instance

cluster_name = "test-ray-cluster-li"

Expand All @@ -59,7 +60,7 @@ def run_local_interactives(self):
)
)
cluster.apply()
cluster.wait_ready()
wait_ready_with_stuck_detection(cluster)

generate_cert.generate_tls_cert(cluster_name, self.namespace)
generate_cert.export_env(cluster_name, self.namespace)
Expand Down
Loading
Loading