-
Notifications
You must be signed in to change notification settings - Fork 31
e2e for code interpreter directly api access #185
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
Summary of ChangesHello @YaoZengzeng, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the robustness and accuracy of the code interpreter's end-to-end tests. By transitioning from an SDK-based execution model to direct API calls, the tests now more closely simulate real-world service interactions, ensuring the core functionality of the code interpreter is validated against its actual HTTP endpoints. This change improves the reliability of the test suite and provides a clearer picture of the service's behavior. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request significantly improves the end-to-end tests for the code interpreter by refactoring them to use direct API access instead of executing a Python script. This change makes the tests more robust, direct, and a better representation of how the API is intended to be used. The addition of helper functions like invokeCodeInterpreter and invokeWithSession greatly improves code clarity and reusability within the test suite. The new TestCodeInterpreterBasicInvocation provides good coverage for the basic API functionality.
| if tc.expectStdout != "" { | ||
| if resp.Stdout != tc.expectStdout { | ||
| t.Errorf("Expected stdout %q, got %q", tc.expectStdout, resp.Stdout) | ||
| } | ||
| } | ||
| if tc.expectStderr != "" { | ||
| if resp.Stderr != tc.expectStderr { | ||
| t.Errorf("Expected stderr %q, got %q", tc.expectStderr, resp.Stderr) | ||
| } | ||
| } | ||
| if resp.ExitCode != tc.expectExit { | ||
| t.Errorf("Expected exit code %d, got %d", tc.expectExit, resp.ExitCode) | ||
| } |
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.
The assertions for stdout and stderr are currently skipped if the expected value is an empty string. This could mask issues where a command unexpectedly produces output when none is expected.
To improve test accuracy and align with the idiomatic use of testify in this file, I recommend using require.Equal for all checks. This ensures all expectations, including empty outputs, are validated and makes the code more concise.
require.Equal(t, tc.expectStdout, resp.Stdout)
require.Equal(t, tc.expectStderr, resp.Stderr)
require.Equal(t, tc.expectExit, resp.ExitCode)|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #185 +/- ##
==========================================
+ Coverage 35.60% 35.77% +0.16%
==========================================
Files 29 29
Lines 2533 2549 +16
==========================================
+ Hits 902 912 +10
- Misses 1505 1511 +6
Partials 126 126
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
pkg/workloadmanager/handlers.go
Outdated
| respondError(c, http.StatusNotFound, err.Error()) | ||
| } else { | ||
| respondError(c, http.StatusInternalServerError, "internal server error") | ||
| respondError(c, http.StatusInternalServerError, err.Error()) |
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.
Deliberately hide the error details
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.
Just for debug, will cleanup later.
pkg/workloadmanager/k8s_client.go
Outdated
| // GetSandboxPodIP gets the IP address of the pod corresponding to the Sandbox with retry logic | ||
| func (c *K8sClient) GetSandboxPodIP(ctx context.Context, namespace, sandboxName, podName string) (string, error) { | ||
| retryCtx, cancel := context.WithTimeout(ctx, 20*time.Second) | ||
| defer cancel() | ||
| ticker := time.NewTicker(time.Second) | ||
| defer ticker.Stop() | ||
|
|
||
| var ip string | ||
| var err error | ||
| for { |
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.
donot we have already guranteed it is ready before calling GetSandboxPodIP
How can ip not assigned when it is ready
Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
What type of PR is this?
/kind enhancement
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #178
Special notes for your reviewer:
Does this PR introduce a user-facing change?: