Skip to content

test: add more tests verifying actions on reconciliation#1890

Merged
AndrewChubatiuk merged 39 commits intomasterfrom
tests-actions
Feb 26, 2026
Merged

test: add more tests verifying actions on reconciliation#1890
AndrewChubatiuk merged 39 commits intomasterfrom
tests-actions

Conversation

@vrutkovs
Copy link
Collaborator

This adds tests, which check that actions are performed in the expected order on the expected objects

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

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

@cubic-dev-ai cubic-dev-ai bot Feb 26, 2026

Choose a reason for hiding this comment

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

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)
Fix with Cubic

vmservicescrape fix

vmservicescrape
@AndrewChubatiuk AndrewChubatiuk merged commit a0a8c16 into master Feb 26, 2026
7 checks passed
@AndrewChubatiuk AndrewChubatiuk deleted the tests-actions branch February 26, 2026 20:15
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants