-
Notifications
You must be signed in to change notification settings - Fork 58
Python runtime sandbox e2e test #161
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?
Python runtime sandbox e2e test #161
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: shrutiyam-glitch The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
✅ Deploy Preview for agent-sandbox canceled.
|
|
Welcome @shrutiyam-glitch! |
|
Hi @shrutiyam-glitch. Thanks for your PR. I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
Thank you @shrutiyam-glitch for the PR, can you also add a test for python-runtime using gVisor? It can be based on "e2e-pytest-template" by changing the runtime in the template. This depends on other open PRs for the test to check if it works (#150 and #159) |
|
/ok-to-test |
|
@shrutiyam-glitch please sign the CLA, ref #161 (comment) |
4806373 to
f1be5f0
Compare
test/e2e/pythonruntime_test.go
Outdated
| } | ||
|
|
||
| portForwardCtx, portForwardCancel := context.WithCancel(ctx) | ||
| h.PortForward(portForwardCtx, podID, 8888, 8888) |
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.
Check if the runtime is set so runsc or kata-qemu and if so skip the port forwarding part. TODO - After the python e2e tests are merged test via gateway
igooch
left a comment
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.
Good work, left a new comments.
| "sigs.k8s.io/agent-sandbox/test/e2e/framework" | ||
| ) | ||
|
|
||
| const sandboxManifest = ` |
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.
For a few manifests this is fine. If we have more than that you'll want to pull these out into separate .yaml files.
test/e2e/framework/client.go
Outdated
| cl.Helper() | ||
| // Static 30 second timeout, this can be adjusted if needed | ||
| timeoutCtx, cancel := context.WithTimeout(ctx, 30*time.Second) | ||
| timeoutCtx, cancel := context.WithTimeout(ctx, 60*time.Second) |
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.
We should update this from be configurable, and make the default timeout a constant defined at the top of the file. That way each tests can have an appropriate timeout. So something like:
var cancel context.CancelFunc
if _, ok := ctx.Deadline(); !ok {
ctx, cancel = context.WithTimeout(ctx, DefaultTimeout)
defer cancel()
}
And then tests either use the default timeout, or pass a context with a longer timeout:
// Uses default timeout
cl.WaitForObject(ctx, sandbox, predicates.ReadyConditionIsTrue)
// Custom timeout case for slower operations like warmPool
timeoutCtx, cancel := context.WithTimeout(ctx, 1*time.Minute)
defer cancel()
cl.WaitForObject(timeoutCtx, warmPool, predicates.ReadyConditionIsTrue)
test/e2e/framework/client.go
Outdated
| for { | ||
| select { |
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 outer for loop + select with cases can be replaced by a wait from the package k8s.io/apimachinery/pkg/util/wait similar to:
return wait.PollUntilContextTimeout(ctx, 2*time.Second, 1*time.Minute, true, func(ctx context.Context) (bool, error) {
| ctx, cancel := context.WithCancel(ctx) | ||
| defer cancel() | ||
|
|
||
| log := klog.FromContext(ctx) |
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.
Use the testing.T logger and context (see #106 as an example)
|
PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| sys.exit(main()) |
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.
This change isn't needed
Adds e2e test for the python runtime sandbox example.
Test file: test/e2e/pythonruntime_test.go
Scenarios covered -
Test cases -