-
-
Notifications
You must be signed in to change notification settings - Fork 29
fix: add ut for backend runtime. #428
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
base: main
Are you sure you want to change the base?
Conversation
/kind cleanup |
Would you like to take a view first @googs1025 |
/cc sure. I'll take a look today 😄 |
resourcesNil bool | ||
shmNil bool |
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.
Can we not only check whether it is nil, but also check whether it is exactly the same?
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.
Make sense, I have changed to real variable.
type want struct { | ||
cmd []string | ||
envs []corev1.EnvVar | ||
lifecycle *corev1.Lifecycle |
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.
miss Args
param
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.
Got.
}, | ||
} | ||
|
||
return &BackendRuntimeParser{ |
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.
can we use NewBackendRuntimeParser
?
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.
Make sense, I will fix it with NewBackendRuntimeParser
function.
|
||
return &BackendRuntimeParser{ | ||
backendRuntime: backend, | ||
models: []*coreapi.OpenModel{{}}, // 这里只需要占位 |
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.
remove chinese, and can we add OpenModel
for test?
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.
Sorry, I will update it.
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.
No Chinese comments please.
p := tc.parser | ||
|
||
if diff := cmp.Diff(tc.want.cmd, p.Command()); diff != "" { | ||
t.Fatalf("Command() mismatch (-want +got):\n%s", diff) |
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.
Can we keep the error information consistent across each output?
example:
t.Fatalf("Command() mismatch (-want +got):\n%s", diff)
t.Fatalf("Image() = %s, want %s", got, tc.want.image)
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.
Thank you, I will change them to same output.
/approve Leave the LGTM to @googs1025 |
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.
Only one nit. Otherwise LGTM @X1aoZEOuO
|
||
return &BackendRuntimeParser{ | ||
backendRuntime: backend, | ||
models: []*coreapi.OpenModel{{}}, // 这里只需要占位 |
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.
No Chinese comments please.
kindly ping @X1aoZEOuO |
What this PR does / why we need it
Add mode unit tests for backend runtime.
Which issue(s) this PR fixes
Fixes #
Special notes for your reviewer
From:
To:
cc @kerthcet
Does this PR introduce a user-facing change?