-
Notifications
You must be signed in to change notification settings - Fork 162
feat(BA-1561): Add session status history retriever test #4697
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
feat(BA-1561): Add session status history retriever test #4697
Conversation
src/ai/backend/test/testcases/session/status_history_retriever.py
Outdated
Show resolved
Hide resolved
60c5a9f
to
7926f57
Compare
expected_status = set([ | ||
"PENDING", | ||
"SCHEDULED", | ||
"PREPARING", | ||
"PULLING", | ||
"PREPARED", | ||
"CREATING", | ||
"RUNNING", | ||
"RESTARTING", | ||
"RUNNING_DEGRADED", | ||
"TERMINATING", | ||
"TERMINATED", | ||
"ERROR", | ||
"CANCELED", | ||
]) | ||
|
||
result = await session.ComputeSession(name=session_name).get_status_history() | ||
assert result["result"] != "", "Status history should not be empty" | ||
# NOTE: SessionStatus enum is not available due to BUILD rules | ||
# NOTE: src/ai/backend/test/BUILD[//src/ai/backend/**] -> src/ai/backend/manager/BUILD[!*] : DENY | ||
for status_key, status_value in result["result"].items(): | ||
assert status_key in expected_status, ( | ||
f"Status {status_key} is not a valid session status" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What kind of test are you trying to do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to test the session status history retrieval API is working properly and second, none of the retrieved status histories have unexpected session history values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please create tests for this part like, "In both success and failure scenarios, a specific history must have existed." I don't think it's necessary to verify parts that are already checked by type checking with test code again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As get_status_history
only retrieve activate session history, I only defined test code with success scenario
ee49c4a
to
2cfcd00
Compare
2cfcd00
to
2e71ffe
Compare
2e71ffe
to
813aa96
Compare
16b0e79
to
0765177
Compare
resolves #4682 (BA-1561)