Skip to content

refactor(test): centralize shared test helpers#298

Merged
choufraise merged 4 commits into
mainfrom
test/testutil
May 13, 2026
Merged

refactor(test): centralize shared test helpers#298
choufraise merged 4 commits into
mainfrom
test/testutil

Conversation

@choufraise
Copy link
Copy Markdown
Collaborator

@choufraise choufraise commented May 12, 2026

Why

Controller and k8s adapter tests duplicated helper logic for scoped test names, short hashes, and envtest binary discovery.

This adds internal/testutil helpers for those shared concerns and rewires the existing tests to use them, keeping test setup consistent across packages.

Commits

  • refactor(test): centralize test name helpers
  • refactor(test): centralize NATS key helpers
  • refactor(test): move fixed NATS test keys to testutil
  • refactor(test): resolve project test resources from repo root

Add internal/testutil helpers for sanitizing, hashing, and scoping test resource names. Replace duplicated helper implementations across controller and k8s adapter tests.

Signed-off-by: Thobias Karlsson <thobias.karlsson@gmail.com>
@choufraise choufraise requested a review from a team as a code owner May 12, 2026 14:35
henriropp
henriropp previously approved these changes May 13, 2026
Copy link
Copy Markdown
Contributor

@henriropp henriropp left a comment

Choose a reason for hiding this comment

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

Nice! saw one Fixme comment, fix now or later?

Add shared testutil helpers for creating NATS operator, account, and user keys. Reuse them across controller, k8s adapter, nats, and core tests.

Signed-off-by: Thobias Karlsson <thobias.karlsson@gmail.com>
Add shared fixed NATS operator and account test keys in testutil and reuse them from core account tests. Replace the core-local test key helper with generic seed/value helpers in internal/testutil.

Signed-off-by: Thobias Karlsson <thobias.karlsson@gmail.com>
Add testutil helpers for locating project CRDs and envtest binaries from the discovered repository root. Replace hardcoded ../../../../ paths in envtest suites with shared project resource helpers.

Signed-off-by: Thobias Karlsson <thobias.karlsson@gmail.com>
@choufraise choufraise merged commit 1f7ebe7 into main May 13, 2026
7 checks passed
@choufraise choufraise deleted the test/testutil branch May 13, 2026 06:45
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