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

Improve E2E tests for the gang-scheduling #1801

Merged
merged 1 commit into from
May 11, 2023
Merged
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
11 changes: 5 additions & 6 deletions sdk/python/test/e2e/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@ def verify_unschedulable_job_e2e(
logging.info(f"\n\n\n{job_kind} is creating")
client.wait_for_job_conditions(name, namespace, job_kind, {constants.JOB_CONDITION_CREATED})

# Job should have Created conditions.
conditions = client.get_job_conditions(name, namespace, job_kind)
if len(conditions) != 1:
raise Exception(f"{job_kind} conditions are invalid: {conditions}")

# Job should have correct conditions.
# Job should have a Created condition.
if not client.is_job_created(name, namespace, job_kind):
raise Exception(f"{job_kind} should be in Created condition")

# Job shouldn't have a Running condition.
if client.is_job_running(name, namespace, job_kind):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this be flaky? What if job gets into running state?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, the test should be failed since we pass an unschedulable job to def verify_unschedulable_job_e2e.

unschedulable_tfjob = generate_tfjob(worker, V1SchedulingPolicy(min_available=10), job_namespace)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@nagar-ajay nagar-ajay May 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tenzen-y Sorry for the late response.
I agree with the behavior, that if we're passing an unschedulable job and it has a running state then our test should fail.
My doubt is, are we sure that the job we're passing is unschedulable? Because in my testing the job had two states (created and running). If the job is unschedulable then it shouldn't have running state, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My doubt is, are we sure that the job we're passing is unschedulable?

@nagar-ajay Ah, I see.

In the previous test, we verify the number of Conditions. So, If the Job has Created=true and Running=false, this test unintentionally fails.

In this PR, the test would be passed in that case (Created=true and Running=false).

Does that make sense?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, that makes sense.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me summarize for @johnugeorge.

In the previous Implementation, tests go to fail if the Job has Created=false OR Has(Running).

In this implementation, tests go to fail only if Job has Created=false OR Running=true.

raise Exception(f"{job_kind} shouldn't be in Running condition")


def verify_job_e2e(
client: TrainingClient, name: str, namespace: str, job_kind: str, container: str, timeout: int = 600
Expand Down