Skill: Opt-in to Strict Testing
This skill guides an automated agent through the process of opting a resource (or all resources in an API group) into strict testing. Strict testing enables server-side apply for creates and re-reconciliation tests to ensure the controllers are 100% correct in differencing detection.
Steps
Remove from Ratcheting Exclusions
- Open
tests/e2e/ratcheting.go. - Locate the function
ShouldTestRereconiliation. - Find the
switchstatement that checksprimaryResource.GroupVersionKind(). - Remove the
caseline(s) corresponding to theschema.GroupKindof the resource(s) being opted in.
- Open
Regenerate Golden Output
- Because strict testing enables server-side apply, the expected requests and generated objects will change in the tests. You must regenerate the golden test output (
_generated_object_*.golden.yamland_http.log). - Run the relevant presubmit script for the service with the
WRITE_GOLDEN_OUTPUT=1environment variable. For example:WRITE_GOLDEN_OUTPUT=1 dev/ci/presubmits/tests-e2e-fixtures-<servicename> - Alternatively, you can use the
hack/compare-mockorrun-e2escripts if you are targeting specific tests.
- Because strict testing enables server-side apply, the expected requests and generated objects will change in the tests. You must regenerate the golden test output (
Verify the Tests Pass
- After regenerating the golden files, verify that the tests actually pass.
- Run the tests again without
WRITE_GOLDEN_OUTPUT=1. For example:dev/ci/presubmits/tests-e2e-fixtures-<servicename> - If a test fails during the
TestRereconciliationphase, the controller might have a bug in differencing detection.
Investigate Re-reconciliation Bugs (If Any)
- If the re-reconciliation test fails, it means the controller thinks the resource needs an update even when its state matches the desired state, or the observed state doesn't match after creation.
- You might need to add/fix logic in the controller or mappers to properly normalize the field, handle server-generated values, or ignore specific fields in diffs.
Commit the Changes
- Create a commit that includes the change to
tests/e2e/ratcheting.goand the updated golden files (_generated_object_*.golden.yaml,_http.log).
- Create a commit that includes the change to