test: add more tests verifying actions on reconciliation#1890
Merged
AndrewChubatiuk merged 39 commits intomasterfrom Feb 26, 2026
Merged
test: add more tests verifying actions on reconciliation#1890AndrewChubatiuk merged 39 commits intomasterfrom
AndrewChubatiuk merged 39 commits intomasterfrom
Conversation
Contributor
There was a problem hiding this comment.
1 issue found across 52 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="internal/controller/operator/factory/reconcile/statefulset_pvc_expand_test.go">
<violation number="1" location="internal/controller/operator/factory/reconcile/statefulset_pvc_expand_test.go:221">
P3: The new action assertion depends on a deterministic List order, but updateSTSPVC iterates PVCs in whatever order client.List returns. That can make the test flaky when the list order changes. Consider comparing actions without ordering or sorting before asserting order.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| assert.NoError(t, err) | ||
| } | ||
| if o.actions != nil { | ||
| assert.Equal(t, o.actions, cl.Actions) |
Contributor
There was a problem hiding this comment.
P3: The new action assertion depends on a deterministic List order, but updateSTSPVC iterates PVCs in whatever order client.List returns. That can make the test flaky when the list order changes. Consider comparing actions without ordering or sorting before asserting order.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At internal/controller/operator/factory/reconcile/statefulset_pvc_expand_test.go, line 221:
<comment>The new action assertion depends on a deterministic List order, but updateSTSPVC iterates PVCs in whatever order client.List returns. That can make the test flaky when the list order changes. Consider comparing actions without ordering or sorting before asserting order.</comment>
<file context>
@@ -204,17 +205,21 @@ func Test_updateSTSPVC(t *testing.T) {
assert.NoError(t, err)
}
+ if o.actions != nil {
+ assert.Equal(t, o.actions, cl.Actions)
+ }
var pvcs corev1.PersistentVolumeClaimList
</file context>
Suggested change
| assert.Equal(t, o.actions, cl.Actions) | |
| assert.ElementsMatch(t, o.actions, cl.Actions) |
httproute fix httproute
vmservicescrape fix vmservicescrape
…created or updated
2ba3c2a to
c14030c
Compare
AndrewChubatiuk
approved these changes
Feb 26, 2026
AndrewChubatiuk
added a commit
that referenced
this pull request
Mar 3, 2026
* tests: update clientWithActions to record changes for all objects * tests: update tests to use new getTestClient * tests: move ClientWithActions to k8stools * tests: add data update configmap case * test: add daemonset reconcile tests * test: add HPA check case for deployment * test: add tests for HPA actions hpa * test: add tests for httproute reconciliation actions httproute fix httproute * test: add ests for ingress reconciliation action ingress * test: add tests for pdb reconciliation actions pdb * test: add tests for pvc reconciliation acitons * test: add tests for rbac reconciliation * test: add tests for secret reconciliation actions * test: add patch / delete actions * test: add tests for service reconciliation actions service * test: add tests for statefulset reconciliation actions * test: add tests for vmagent reconciliation actions * test: add tests for vmcluster reconciliation actions * test: add tests for vmauth reconciliation vmauth * test: status changes should not cause reconciliation * tests: add vmservicescrape reconcile tests vmservicescrape fix vmservicescrape * comment out tests * test: reduce timeouts and intervals for faster tests * test: add Kind to ClientAction * test: add reconcile tests checking actions and kinds when vmagent is created or updated * fix: sort asserts before creating to make CreateOrUpdate deterministic * test: add reconcile tests for vmalert is created or updated * test: add reconcile tests for vmalertmanager * test: add reconcile tests for vmanomaly * test: add reconcile tests for vmauth * test: add reconcile tests for vmcluster vmcluster * test: vmdistributed reconcile tests * test: vmsingle reconcile tests * test: vtcluster reconcile tests * test: add vtsingle reconcile tests * test: add reconciliation test case for deployment deploy * VMServiceScrape -> VMServiceScrapeForCRD * fix: make updateSTSPVC deterministi * undo vmservicescrape reconcile function renaming --------- Co-authored-by: Andrii Chubatiuk <andrew.chubatiuk@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds tests, which check that actions are performed in the expected order on the expected objects