Skip to content

Conversation

@shrutiyam-glitch
Copy link
Contributor

@shrutiyam-glitch shrutiyam-glitch commented Nov 14, 2025

Adds e2e test for the python runtime sandbox example.
Test file: test/e2e/pythonruntime_test.go
Scenarios covered -

  • applies sandbox(python-runtime-sandbox) manifest directly
  • Applies sandbox template and sandbox claim and creates a python runtime sandbox
  • Applies sandbox warmpool and creates a python runtime

Test cases -

  • Tests port forwarding to the sandbox - general health check
  • ​​executes “hello world”

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Nov 14, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: shrutiyam-glitch
Once this PR has been reviewed and has the lgtm label, please assign soltysh for approval. For more information see the Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@netlify
Copy link

netlify bot commented Nov 14, 2025

Deploy Preview for agent-sandbox canceled.

Name Link
🔨 Latest commit 59cbe6d
🔍 Latest deploy log https://app.netlify.com/projects/agent-sandbox/deploys/6925ff180ba91a000931ab72

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Nov 14, 2025
@k8s-ci-robot
Copy link
Contributor

Welcome @shrutiyam-glitch!

It looks like this is your first PR to kubernetes-sigs/agent-sandbox 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/agent-sandbox has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Nov 14, 2025
@k8s-ci-robot
Copy link
Contributor

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Nov 14, 2025
@shrutiyam-glitch shrutiyam-glitch marked this pull request as draft November 14, 2025 18:34
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 14, 2025
@tomergee
Copy link
Contributor

tomergee commented Nov 17, 2025

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)

@janetkuo
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 17, 2025
@janetkuo
Copy link
Member

@shrutiyam-glitch please sign the CLA, ref #161 (comment)

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Nov 17, 2025
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Nov 18, 2025
}

portForwardCtx, portForwardCancel := context.WithCancel(ctx)
h.PortForward(portForwardCtx, podID, 8888, 8888)
Copy link
Contributor

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

@shrutiyam-glitch shrutiyam-glitch marked this pull request as ready for review November 19, 2025 18:56
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 19, 2025
Copy link
Contributor

@igooch igooch left a 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 = `
Copy link
Contributor

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.

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)
Copy link
Contributor

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)

Comment on lines 332 to 333
for {
select {
Copy link
Contributor

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) {

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 24, 2025
@shrutiyam-glitch shrutiyam-glitch changed the title Python runtime sandbox and Python sdk e2e test Python runtime sandbox e2e test Nov 27, 2025
ctx, cancel := context.WithCancel(ctx)
defer cancel()

log := klog.FromContext(ctx)
Copy link
Contributor

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)

@k8s-ci-robot
Copy link
Contributor

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.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 2, 2025


if __name__ == "__main__":
sys.exit(main())
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants