Skip to content

test(planner): extract repeated literals to satisfy goconst#381

Merged
bdchatham merged 1 commit into
mainfrom
fix/planner-test-goconst
Jun 2, 2026
Merged

test(planner): extract repeated literals to satisfy goconst#381
bdchatham merged 1 commit into
mainfrom
fix/planner-test-goconst

Conversation

@bdchatham
Copy link
Copy Markdown
Collaborator

Follow-up to #380. The buildRunningPlan-guard tests added new occurrences of validator-0-key, validator-0-nodekey, and 1000000usei that pushed those literals over goconst's threshold on the new lines, so the lint job went red on main (test / test-integration / verify-generated were green and #380 auto-merged on the required checks).

Fix: hoist the key-secret names to package-level test constants (testSigningKeySecret, testNodeKeySecret), reuse the existing testAccountBalance, and name the RolloutComplete reason in the envtest (reasonRolloutComplete). No behavior change; planner unit tests and the BYO-validator envtest still pass.

The buildRunningPlan-guard tests pushed "validator-0-key",
"validator-0-nodekey", and "1000000usei" over goconst's occurrence
threshold on the new lines. Hoist the key-secret names to package-level
test constants, reuse the existing testAccountBalance, and name the
RolloutComplete reason in the envtest. No behavior change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@bdchatham bdchatham merged commit 5804945 into main Jun 2, 2026
4 checks passed
@cursor
Copy link
Copy Markdown

cursor Bot commented Jun 2, 2026

PR Summary

Low Risk
Test-only constant extraction and assertion renames; no production code paths touched.

Overview
Fixes goconst failures on main by deduplicating repeated string literals in planner and envtest code—no runtime or test-behavior changes.

In internal/planner/node_update_test.go, adds package constants testSigningKeySecret and testNodeKeySecret for validator secret names used in image-drift planner tests, and uses the existing testAccountBalance for genesis ceremony account balance instead of inline "1000000usei".

In internal/controller/nodedeployment/envtest/inplace_rollout_validator_test.go, introduces reasonRolloutComplete (documented as matching the SND controller’s finished-rollout reason) and asserts against that constant instead of a raw "RolloutComplete" string.

Reviewed by Cursor Bugbot for commit f112105. Bugbot is set up for automated code reviews on this repo. Configure here.

@bdchatham bdchatham deleted the fix/planner-test-goconst branch June 2, 2026 22:28
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.

1 participant