Skip to content

tests: add a test to validate pause and resume feature#351

Open
darthsuburbus wants to merge 4 commits intokubernetes-sigs:mainfrom
darthsuburbus:topic/as/pvc-pers-e2e
Open

tests: add a test to validate pause and resume feature#351
darthsuburbus wants to merge 4 commits intokubernetes-sigs:mainfrom
darthsuburbus:topic/as/pvc-pers-e2e

Conversation

@darthsuburbus
Copy link

@darthsuburbus darthsuburbus commented Feb 27, 2026

Description

Fixes #248
Add a e2e test that tests out the pause and resume functionality implemented in #82:

  1. Create a Pod with a PVC and some generated data.
  2. Scale the replicas to 0, controller should delete the pod associated with the sandbox.
  3. Sandbox CR should remain consistent.
  4. Scale the replicas to 1, the controller will recreate the pod. Verify that the data is intact on the PVC.

This test addresses the request made in #248.

Testing Done

   pvc_persistence_test.go:68: WaitForObjectNotFound *v1.Namespace (/pvc-persistence-test-1772168327331581080) took 43.463444028s
--- PASS: TestPVCPersistenceAcrossReplicas (89.90s)

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

The full list of commands accepted by this bot can be found here.

Details 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

@k8s-ci-robot
Copy link
Contributor

Welcome @darthsuburbus!

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 Feb 27, 2026
@k8s-ci-robot
Copy link
Contributor

Hi @darthsuburbus. Thanks for your PR.

I'm waiting for a kubernetes-sigs 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.

Details

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 size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Feb 27, 2026
@netlify
Copy link

netlify bot commented Feb 27, 2026

Deploy Preview for agent-sandbox canceled.

Name Link
🔨 Latest commit 88fed88
🔍 Latest deploy log https://app.netlify.com/projects/agent-sandbox/deploys/69ad62f392a498000815ac9b

@janetkuo janetkuo 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 Feb 27, 2026
Copy link
Member

@vicentefb vicentefb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This is a very valuable test that was missing. Overall, the logic is very solid. You're correctly simulating the exact behavior the controller executes when Replicas hits 0 (where it deletes the pod but retains the Sandbox CR and PVCs ), and then successfully validating the recovery. Left some comments.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 3, 2026
@darthsuburbus darthsuburbus force-pushed the topic/as/pvc-pers-e2e branch from 8f8720b to 7103823 Compare March 3, 2026 12:08
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 3, 2026
@darthsuburbus
Copy link
Author

Thanks! This is a very valuable test that was missing. Overall, the logic is very solid. You're correctly simulating the exact behavior the controller executes when Replicas hits 0 (where it deletes the pod but retains the Sandbox CR and PVCs ), and then successfully validating the recovery. Left some comments.

Thanks for the thoughtful feedback, I've addressed all comments. I can squash the commits before merging but keeping them for ease of review for now.

@darthsuburbus darthsuburbus requested a review from vicentefb March 3, 2026 12:28
}
opts := []cmp.Option{
cmpopts.IgnoreFields(metav1.Condition{}, "LastTransitionTime"),
cmpopts.IgnoreFields(metav1.Condition{}, "LastTransitionTime", "Message", "ObservedGeneration"),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why ignore observedGeneration? Seems that it may be a useful thing to check?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would be the reasoning around checking this? My assumption here was that we don't want the tests to rely on intermediate state changes or updates that the controller might be making to the resource, rather on just the end state that the test cares about validating. Happy to reinstate this though if there is something I am missing :-)

Copy link

@natasha41575 natasha41575 Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new to this repo / project so I may well be wrong, but I was originally under the assumption that the test is in full control over the state changes and updates, and therefore should be able to reliably know what observedGeneration should be. If that's not accurate though, feel free to ignore this comment!

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 6, 2026
@darthsuburbus darthsuburbus force-pushed the topic/as/pvc-pers-e2e branch from 790488b to 88fed88 Compare March 8, 2026 11:52
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 8, 2026
@k8s-ci-robot
Copy link
Contributor

@darthsuburbus: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
presubmit-agent-sandbox-lint-api 88fed88 link true /test presubmit-agent-sandbox-lint-api

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Details

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. I understand the commands that are listed here.

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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test and verify pause resume feature works correctly

5 participants