Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: wait to allow PodDefaults to synced in Job's namespace before running tests #120

Merged
merged 10 commits into from
Sep 17, 2024
17 changes: 17 additions & 0 deletions driver/test_kubeflow_workloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import logging
import os
import subprocess
import time
from pathlib import Path
from typing import Dict

Expand Down Expand Up @@ -144,6 +145,22 @@ async def test_create_profile(lightkube_client, create_profile):

assert_namespace_active(lightkube_client, NAMESPACE)

# Sync of PodDefaults to the namespace can take up to 40 seconds
# Wait here is necessary to allow the creation of PodDefaults before Job is created
sleep_time_seconds = 40
NohaIhab marked this conversation as resolved.
Show resolved Hide resolved
log.info(
f"Sleeping for {sleep_time_seconds}s to allow the creation of PodDefaults in {NAMESPACE} namespace.."
)
time.sleep(sleep_time_seconds)

# Print the names of PodDefaults in the namespace
poddefaults_created_list = lightkube_client.list(PODDEFAULT_RESOURCE, namespace=NAMESPACE)
if poddefaults_created_list:
poddefaults_created_names = [pd.metadata.name for pd in poddefaults_created_list]
log.info(f"PodDefaults in {NAMESPACE} namespace are {poddefaults_created_names}.")
else:
log.warn(f"No PodDefaults found in {NAMESPACE} namespace.")
NohaIhab marked this conversation as resolved.
Show resolved Hide resolved


def test_kubeflow_workloads(
lightkube_client, pytest_cmd, tests_checked_out_commit, request, create_poddefaults_on_proxy
Expand Down