Skip to content

test: allow override for postgres image in integration tests - #61

Merged
usman-muzaffar555 merged 2 commits into
mainfrom
feat/PLAT-638/test-execution-through-internal-images
Jun 12, 2026
Merged

test: allow override for postgres image in integration tests#61
usman-muzaffar555 merged 2 commits into
mainfrom
feat/PLAT-638/test-execution-through-internal-images

Conversation

@usman-muzaffar555

Copy link
Copy Markdown
Member

No description provided.

- Add POSTGRES_IMAGE variable to test/Makefile to allow overriding the
  postgres image at test runtime; defaults to chart default when not set
- Replace hardcoded pgedge-helm-utils:dev literals with $(INIT_SPOCK_IMAGE)
  variable throughout test/Makefile for consistency
- Log test configuration at startup (CHART_REF, CHART_VERSION, HELM_REPO,
  INIT_SPOCK_IMAGE, POSTGRES_IMAGE) for easier debugging
@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR introduces configurable Docker image support to the test infrastructure. Make variables for POSTGRES_IMAGE and refactored INIT_SPOCK_IMAGE are exported and used throughout test targets. The test harness reads these variables, logs them for debugging, and passes both image names to Helm install and upgrade operations during chart deployment.

Changes

Configurable Test Images

Layer / File(s) Summary
Makefile configuration and exports
test/Makefile
Define POSTGRES_IMAGE variable and export both POSTGRES_IMAGE and INIT_SPOCK_IMAGE; refactor kind-load-image, test-integration-kind, and test-ct targets to use variable references instead of hardcoded pgedge-helm-utils:dev.
Test harness configuration and logging
test/integration/suite_test.go
TestMain reads POSTGRES_IMAGE and INIT_SPOCK_IMAGE into package-level globals; print standardized test configuration summary including chart reference, version, Helm repo, and both image names.
Helm chart image overrides
test/integration/suite_test.go
installChart and tryUpgradeChart conditionally append pgEdge.initSpockImageName and pgEdge.clusterSpec.imageName into Helm SetValues when images are configured, replacing prior overwrite behavior.
User documentation
test/README.md
Document how to pass POSTGRES_IMAGE to make -C test test-all to override the default Postgres image, with example invocation and note about startup logging of effective image.

Poem

🐰 A rabbit hops through test machines,
With images now in between!
Variables dance where hardcodes lay,
Helm charts sing in every way—
Flexibility blooms today!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning No pull request description was provided by the author; the PR is missing this important context. Add a detailed description explaining the changes, why they were made, and how to test them, including the new POSTGRES_IMAGE and INIT_SPOCK_IMAGE variables.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title accurately summarizes the main change: enabling Postgres image override in integration tests, which is reflected in the documentation addition and configuration changes throughout the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/PLAT-638/test-execution-through-internal-images

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codacy-production

codacy-production Bot commented Jun 8, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 duplication

Metric Results
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
test/Makefile (1)

67-67: 💤 Low value

Consider documenting that POSTGRES_IMAGE is not loaded into kind.

The kind-load-image target loads only INIT_SPOCK_IMAGE into the kind cluster. Unlike INIT_SPOCK_IMAGE (which defaults to a local pgedge-helm-utils:dev image), POSTGRES_IMAGE is expected to be pulled from a registry. A brief comment explaining this asymmetry would help future maintainers understand why POSTGRES_IMAGE isn't loaded here.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/Makefile` at line 67, Add a brief comment in the kind-load-image target
explaining that only INIT_SPOCK_IMAGE is loaded into the kind cluster (via the
existing kind load docker-image $(INIT_SPOCK_IMAGE) --name $(KIND_CLUSTER_NAME))
while POSTGRES_IMAGE is intentionally not loaded and is expected to be pulled
from a registry; reference the variables INIT_SPOCK_IMAGE and POSTGRES_IMAGE and
mention the asymmetry so future maintainers understand why POSTGRES_IMAGE isn't
handled here.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/integration/suite_test.go`:
- Line 34: Remove the leftover debug print statement fmt.Fprintf(os.Stdout,
"DEBUG os.Getenv POSTGRES_IMAGE=%q\n", os.Getenv("POSTGRES_IMAGE")) from the
test file (suite_test.go) so the redundant output is gone; also update imports
(remove fmt if it becomes unused) to keep the test compile-clean and rely on the
existing "Test configuration" logging block instead.

---

Nitpick comments:
In `@test/Makefile`:
- Line 67: Add a brief comment in the kind-load-image target explaining that
only INIT_SPOCK_IMAGE is loaded into the kind cluster (via the existing kind
load docker-image $(INIT_SPOCK_IMAGE) --name $(KIND_CLUSTER_NAME)) while
POSTGRES_IMAGE is intentionally not loaded and is expected to be pulled from a
registry; reference the variables INIT_SPOCK_IMAGE and POSTGRES_IMAGE and
mention the asymmetry so future maintainers understand why POSTGRES_IMAGE isn't
handled here.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3d564b07-a6ad-44a3-b75e-5598103f2001

📥 Commits

Reviewing files that changed from the base of the PR and between f622fc8 and 2b40447.

📒 Files selected for processing (3)
  • test/Makefile
  • test/README.md
  • test/integration/suite_test.go


func TestMain(m *testing.M) {

fmt.Fprintf(os.Stdout, "DEBUG os.Getenv POSTGRES_IMAGE=%q\n", os.Getenv("POSTGRES_IMAGE"))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Remove the debug print statement.

This debug output is redundant with the cleaner "Test configuration" block at lines 56–61 and appears to be leftover debugging code.

🧹 Proposed fix
-
-	fmt.Fprintf(os.Stdout, "DEBUG os.Getenv POSTGRES_IMAGE=%q\n", os.Getenv("POSTGRES_IMAGE"))
-
 	kubeContext = envOrDefault("KUBECONTEXT", "kind-pgedge-test")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
fmt.Fprintf(os.Stdout, "DEBUG os.Getenv POSTGRES_IMAGE=%q\n", os.Getenv("POSTGRES_IMAGE"))
kubeContext = envOrDefault("KUBECONTEXT", "kind-pgedge-test")
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/integration/suite_test.go` at line 34, Remove the leftover debug print
statement fmt.Fprintf(os.Stdout, "DEBUG os.Getenv POSTGRES_IMAGE=%q\n",
os.Getenv("POSTGRES_IMAGE")) from the test file (suite_test.go) so the redundant
output is gone; also update imports (remove fmt if it becomes unused) to keep
the test compile-clean and rely on the existing "Test configuration" logging
block instead.

@mmols mmols changed the title Feat/plat 638/test execution through internal images feat(test): override postgres image in tests Jun 12, 2026

@mmols mmols left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Add a short PR description and address the one CR comment around the redundant log line before merging.

@mmols mmols changed the title feat(test): override postgres image in tests test: allow override for postgres image in integration tests Jun 12, 2026
@usman-muzaffar555
usman-muzaffar555 merged commit 2597874 into main Jun 12, 2026
7 of 8 checks passed
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