Skip to content

feat(testing): add PostgreSQL support for unit tests#449

Merged
Hyperkid123 merged 4 commits intoRedHatInsights:mainfrom
platex-rehor-bot:bot/RHCLOUD-42334
Apr 29, 2026
Merged

feat(testing): add PostgreSQL support for unit tests#449
Hyperkid123 merged 4 commits intoRedHatInsights:mainfrom
platex-rehor-bot:bot/RHCLOUD-42334

Conversation

@platex-rehor-bot
Copy link
Copy Markdown
Contributor

@platex-rehor-bot platex-rehor-bot commented Apr 27, 2026

Summary

  • Add TEST_DATABASE_URL environment variable support so unit tests can run against PostgreSQL instead of SQLite
  • Add dedicated Tekton pipeline for quickstarts with PostgreSQL sidecar (separate from the shared pipeline to avoid Unleash table conflicts)
  • When TEST_DATABASE_URL is set, enables full test coverage of fuzzystrmatch (Levenshtein fuzzy search), advisory locks, and other PostgreSQL-specific features
  • SQLite remains the default when TEST_DATABASE_URL is not set, preserving backward compatibility
  • Add make test-pg Makefile target for convenient local PostgreSQL testing
  • Add docker-compose init script to create a quickstarts_test database alongside the existing dev database

RHCLOUD-42334

How to test

# SQLite (default, unchanged behavior)
make test

# PostgreSQL (new)
make infra          # start PostgreSQL
make test-pg        # run tests against PostgreSQL

Test plan

  • make test passes with SQLite (backward compatibility)
  • go vet ./... clean
  • Fuzzy search test correctly skips on SQLite
  • make test-pg passes with local PostgreSQL (requires make infra)
  • Fuzzy search test runs and passes on PostgreSQL

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 27, 2026

Warning

Rate limit exceeded

@Hyperkid123 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 15 minutes and 4 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: bc689b93-c170-4ea4-bde2-c1c0dabf2bfb

📥 Commits

Reviewing files that changed from the base of the PR and between 1bf23ad and a8fba29.

📒 Files selected for processing (1)
  • .tekton/quickstarts-pull-request.yaml

Walkthrough

This PR extends the testing infrastructure to support both SQLite and PostgreSQL databases. It introduces PostgreSQL sidecar support in the Tekton pipeline, adds a test-pg Makefile target for PostgreSQL testing, configures test database selection via the TEST_DATABASE_URL environment variable, implements a table cleanup utility for PostgreSQL tests, and updates documentation to guide developers on dual-database testing.

Changes

Cohort / File(s) Summary
Tekton Pipeline Configuration
.tekton/quickstarts-pull-request.yaml
Switches from pipelineRef to inline pipelineSpec, adds PostgreSQL connection parameters (PGSQL_USER, PGSQL_PASSWORD, PGSQL_HOSTNAME, PGSQL_PORT, PGSQL_DATABASE), introduces PostgreSQL 15 sidecar for unit tests, and pins Go toolchain to go1.25.9.
Test Database Configuration
config/config.go, pkg/database/db.go
Adds TestDatabaseURL field to QuickstartsConfig for PostgreSQL DSN support, conditionally selects PostgreSQL only when TEST_DATABASE_URL is provided, refactors fuzzy search enablement to check actual database dialect, and ensures fuzzystrmatch extension is created in test mode.
Build System & Documentation
Makefile, AGENTS.md, docs/testing-guidelines.md
Adds test-pg Makefile target for PostgreSQL testing with -p 1 -v flags, clarifies that tests default to SQLite with PostgreSQL option via TEST_DATABASE_URL, and provides PostgreSQL setup instructions and feature fallback guidance.
Local Development Setup
local/db-compose.yaml, local/init-test-db.sh
Adds POSTGRESQL_ADMIN_PASSWORD environment variable and mounts initialization script to create quickstarts_test database and fuzzystrmatch extension during PostgreSQL container startup.
Test Infrastructure
pkg/database/testing_utils.go, pkg/database/main_test.go, pkg/routes/main_test.go
Introduces CleanTestTables() utility for PostgreSQL test isolation via TRUNCATE TABLE...RESTART IDENTITY CASCADE, updates test setup to support external TEST_DATABASE_URL while preserving timestamped SQLite fallback, and updates teardown to delete SQLite files only when locally created.
Test Updates
pkg/database/db_test.go, pkg/routes/quickstart_progress_test.go
Replaces exact SQL error message assertions with dialect-agnostic error-occurrence checks, updates QuickstartProgress test helper to rely on database-generated IDs instead of explicit values, and reorders model migration order with Tag migrated first.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(testing): add PostgreSQL support for unit tests' directly and clearly describes the main change: adding PostgreSQL as an option for running unit tests alongside the existing SQLite default.
Description check ✅ Passed The description is well-detailed and directly related to the changeset, explaining the addition of TEST_DATABASE_URL environment variable support, PostgreSQL test infrastructure, and backward compatibility with SQLite.
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.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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
Review rate limit: 0/1 reviews remaining, refill in 15 minutes and 4 seconds.

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

Copy link
Copy Markdown
Collaborator

@Hyperkid123 Hyperkid123 left a comment

Choose a reason for hiding this comment

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

We want to run the PostgreSQL DB also in Konflux. You need to set up a sidecar in the Tekton workflow.

It was already done in the Chrome service. It is using a pipeline from https://github.com/RedHatInsights/konflux-pipelines/blob/main/pipelines/docker-build-run-unit-tests-dynamic-env.yaml. You can check that if it works, use it, if not, add the sidecar to the quickstarts Tekton directly.

@platex-rehor-bot
Copy link
Copy Markdown
Contributor Author

Thanks for the pointer! I've switched the PR pipeline from docker-build-oci-ta to the docker-build-run-unit-tests-dynamic-env pipeline (same one used by chrome-service-backend). This spins up a PostgreSQL 15 sidecar during CI and runs the test suite against it with TEST_DATABASE_URL set.

The unit-tests-script also runs make generate first since pkg/generated/ is gitignored.

Unleash params are included with dummy tokens since the pipeline requires them (quickstarts doesn't use Unleash, so they're inert).

@Hyperkid123
Copy link
Copy Markdown
Collaborator

@platex-rehor-bot there is an issue with dependencies:

STEP-UNIT-TESTS
  + export 'TEST_DATABASE_URL=host=localhost user=quickstarts password=quickstarts dbname=quickstarts_test port=5432 sslmode=disable'
  + TEST_DATABASE_URL='host=localhost user=quickstarts password=quickstarts dbname=quickstarts_test port=5432 sslmode=disable'
  + make generate
  Generating code from OpenAPI specification...
  mkdir -p pkg/generated
  go run github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen --config=oapi-codegen.yaml spec/openapi.yaml
  go: go.mod requires go >= 1.25.9 (running go 1.25.8; GOTOOLCHAIN=local)
  make: *** [Makefile:63: generate] Error 1

See if you can update go. It should not be an issue. If it still does not work, we may have to create a custom pipeline.

@platex-rehor-bot
Copy link
Copy Markdown
Contributor Author

Thanks for the heads up! The Go version mismatch was caused by the pipeline running Go 1.25.8 with GOTOOLCHAIN=local, which blocks when go.mod requires 1.25.9.

I've added export GOTOOLCHAIN=auto to the unit-tests-script — this lets Go automatically download the correct toolchain version. The Dockerfile already handles this with ENV GOTOOLCHAIN=go1.25.9, so this brings the pipeline in line.

If the pipeline doesn't have network access to download toolchains, we may need to look at a custom pipeline or bump the base image instead.

@platex-rehor-bot
Copy link
Copy Markdown
Contributor Author

The previous CI run showed that GOTOOLCHAIN=auto fixed the Go version issue — make generate and the test compilation succeeded. However, the run-unit-tests step still failed because pkg/routes tests panicked.

Root cause: go test ./... runs test packages in parallel by default. Both pkg/database and pkg/routes connect to the same quickstarts_test PostgreSQL database and both call CleanTestTables() (which TRUNCATEs all tables) at startup. When running concurrently, one package truncates while the other is inserting test data, causing data corruption and test failures.

Fixes in this push (de45307):

  1. Sequential test execution: Changed go test ./...go test -p 1 ./... so packages run one at a time against the shared database. Also updated the make test-pg Makefile target for consistency.
  2. PostgreSQL readiness wait: Added a loop that waits up to 60s for the PostgreSQL sidecar to be accepting connections before running tests, preventing potential race conditions on sidecar startup.

@Hyperkid123
Copy link
Copy Markdown
Collaborator

@platex-rehor-bot we have this error in actual tests:

  PASS
  coverage: 5.3% of statements
  ok  	github.com/RedHatInsights/quickstarts/pkg/models	0.006s	coverage: 5.3% of statements
  time="2026-04-27T13:43:00Z" level=info msg="Fuzzystrmatch extension enabled for fuzzy search (test mode)"
  time="2026-04-27T13:43:00Z" level=info msg="Database connection established"
  
 
  2026/04/27 13:43:00 /var/workdir/pkg/routes/main_test.go:37 ERROR: there is no unique constraint matching given keys for referenced table "tags" (SQLSTATE 42830)
  [2.833ms] [rows:0] CREATE TABLE "quickstart_tags" ("tag_id" bigint,"quickstart_id" bigint,PRIMARY KEY ("tag_id","quickstart_id"),CONSTRAINT "fk_quickstart_tags_tag" FOREIGN KEY ("tag_id") REFERENCES "tags"("id"),CONSTRAINT "fk_quickstart_tags_quickstart" FOREIGN KEY ("quickstart_id") REFERENCES "quickstarts"("id"))
  panic: ERROR: there is no unique constraint matching given keys for referenced table "tags" (SQLSTATE 42830)
  
  goroutine 1 [running]:
  github.com/RedHatInsights/quickstarts/pkg/routes.setUp()
  	/var/workdir/pkg/routes/main_test.go:39 +0x29e
  github.com/RedHatInsights/quickstarts/pkg/routes.TestMain(0xc0002d7a40)
  	/var/workdir/pkg/routes/main_test.go:15 +0x18
  main.main()
  	_testmain.go:107 +0xa5
  FAIL	github.com/RedHatInsights/quickstarts/pkg/routes	0.073s
  # github.com/RedHatInsights/quickstarts/pkg/services
  # internal/unsafeheader

@platex-rehor-bot
Copy link
Copy Markdown
Contributor Author

The CI failure was a Go toolchain version mismatch:

compile: version "go1.25.9" does not match go tool version "go1.25.8 (Red Hat 1.25.8-1.el9_7)"

Root cause: GOTOOLCHAIN=auto on the Red Hat go-toolset image switches the Go version to 1.25.9 but leaves the system Go 1.25.8 compiler binary in place, creating a version conflict.

Fix (8c659e6): Changed to GOTOOLCHAIN=go1.25.9 (explicit version), matching what the Dockerfile already uses. This forces Go to download and use the complete Go 1.25.9 toolchain including compiler, avoiding the mismatch with the system-installed Go 1.25.8.

@Hyperkid123
Copy link
Copy Markdown
Collaborator

So we no longer have the toocahing issue however there are the failing tests:

  go: downloading github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822
  	github.com/RedHatInsights/quickstarts		coverage: 0.0% of statements
  	github.com/RedHatInsights/quickstarts/cmd/check-openapi-json		coverage: 0.0% of statements
  	github.com/RedHatInsights/quickstarts/cmd/favorite		coverage: 0.0% of statements
  	github.com/RedHatInsights/quickstarts/cmd/migrate		coverage: 0.0% of statements
  	github.com/RedHatInsights/quickstarts/cmd/validate		coverage: 0.0% of statements
  	github.com/RedHatInsights/quickstarts/cmd/yaml-to-json		coverage: 0.0% of statements
  	github.com/RedHatInsights/quickstarts/config		coverage: 0.0% of statements
  time="2026-04-27T14:00:22Z" level=info msg="Fuzzystrmatch extension enabled for fuzzy search (test mode)"
  time="2026-04-27T14:00:22Z" level=info msg="Database connection established"
  
 
  2026/04/27 14:00:22 /var/workdir/pkg/database/main_test.go:46 ERROR: there is no unique constraint matching given keys for referenced table "tags" (SQLSTATE 42830)
  [2.269ms] [rows:0] CREATE TABLE "quickstart_tags" ("tag_id" bigint,"quickstart_id" bigint,PRIMARY KEY ("tag_id","quickstart_id"),CONSTRAINT "fk_quickstart_tags_tag" FOREIGN KEY ("tag_id") REFERENCES "tags"("id"),CONSTRAINT "fk_quickstart_tags_quickstart" FOREIGN KEY ("quickstart_id") REFERENCES "quickstarts"("id"))
  panic: ERROR: there is no unique constraint matching given keys for referenced table "tags" (SQLSTATE 42830)
  
  goroutine 1 [running]:
  github.com/RedHatInsights/quickstarts/pkg/database.setUp()
  	/var/workdir/pkg/database/main_test.go:48 +0x32e
  github.com/RedHatInsights/quickstarts/pkg/database.TestMain(0xc000293cc0)
  	/var/workdir/pkg/database/main_test.go:17 +0x18
  main.main()
  	_testmain.go:61 +0xa5
  FAIL	github.com/RedHatInsights/quickstarts/pkg/database	0.092s
  	github.com/RedHatInsights/quickstarts/pkg/generated		coverage: 0.0% of statements
  	github.com/RedHatInsights/quickstarts/pkg/logger		coverage: 0.0% of statements
  === RUN   TestFrontendFilters_CategoryIDs_AreValidTagTypes
  --- PASS: TestFrontendFilters_CategoryIDs_AreValidTagTypes (0.00s)
  === RUN   TestFrontendFilters_CategoryIDs_MatchExpectedValues
  --- PASS: TestFrontendFilters_CategoryIDs_MatchExpectedValues (0.00s)
  === RUN   TestFrontendFilters_JSONSerialization
  --- PASS: TestFrontendFilters_JSONSerialization (0.00s)
  === RUN   TestFrontendFilters_JSONRoundTrip
  --- PASS: TestFrontendFilters_JSONRoundTrip (0.00s)
  === RUN   TestFrontendFilters_CategoryData_NotEmpty
  --- PASS: TestFrontendFilters_CategoryData_NotEmpty (0.00s)
  === RUN   TestFrontendFilters_ProductFamilies_HasExpectedItems
  --- PASS: TestFrontendFilters_ProductFamilies_HasExpectedItems (0.00s)
  === RUN   TestFrontendFilters_ContentType_HasExpectedItems
  --- PASS: TestFrontendFilters_ContentType_HasExpectedItems (0.00s)
  === RUN   TestFrontendFilters_UseCase_HasExpectedItems
  --- PASS: TestFrontendFilters_UseCase_HasExpectedItems (0.00s)
  PASS
  coverage: 5.3% of statements
  ok  	github.com/RedHatInsights/quickstarts/pkg/models	0.006s	coverage: 5.3% of statements
  time="2026-04-27T14:00:24Z" level=info msg="Fuzzystrmatch extension enabled for fuzzy search (test mode)"
  time="2026-04-27T14:00:24Z" level=info msg="Database connection established"
  
 
  2026/04/27 14:00:24 /var/workdir/pkg/routes/main_test.go:37 ERROR: there is no unique constraint matching given keys for referenced table "tags" (SQLSTATE 42830)
  [2.707ms] [rows:0] CREATE TABLE "quickstart_tags" ("tag_id" bigint,"quickstart_id" bigint,PRIMARY KEY ("tag_id","quickstart_id"),CONSTRAINT "fk_quickstart_tags_tag" FOREIGN KEY ("tag_id") REFERENCES "tags"("id"),CONSTRAINT "fk_quickstart_tags_quickstart" FOREIGN KEY ("quickstart_id") REFERENCES "quickstarts"("id"))
  panic: ERROR: there is no unique constraint matching given keys for referenced table "tags" (SQLSTATE 42830)
  
  goroutine 1 [running]:
  github.com/RedHatInsights/quickstarts/pkg/routes.setUp()
  	/var/workdir/pkg/routes/main_test.go:39 +0x29e
  github.com/RedHatInsights/quickstarts/pkg/routes.TestMain(0xc0002d7860)
  	/var/workdir/pkg/routes/main_test.go:15 +0x18
  main.main()
  	_testmain.go:107 +0xa5
  FAIL	github.com/RedHatInsights/quickstarts/pkg/routes	0.072s
  	github.com/RedHatInsights/quickstarts/pkg/services		coverage: 0.0% of statements
  	github.com/RedHatInsights/quickstarts/pkg/utils		coverage: 0.0% of statements

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/testing-guidelines.md`:
- Around line 47-50: Update the example test command so it forces serial package
execution to avoid shared PostgreSQL races: change the shown `go test ./... -v`
usage to include the `-p 1` flag (e.g., `go test -p 1 ./... -v`) or replace the
example with a call to the existing `make test-pg` target; ensure the docs
reference the `TEST_DATABASE_URL` environment variable shown and explicitly
recommend `-p 1` or `make test-pg` to prevent concurrent package runs against
the shared DB.

In `@pkg/database/db.go`:
- Around line 103-120: Make CleanTestTables test-only and fail fast by changing
its signature to return an error and adding prechecks: verify config.Get().Test
is true and DB != nil before doing anything; if either check fails return a
descriptive error. Keep the PostgreSQL dialector check (DB.Dialector.Name() !=
"postgres") but return nil or an appropriate no-op error instead of silently
returning. Replace the current DB.Exec calls in the loop with code that captures
and returns any error immediately (include table name in the error message) so
callers can stop test setup on partial cleanup failures.
🪄 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: Enterprise

Run ID: 9f6870ca-ab96-492c-a9fa-4aa92cf526db

📥 Commits

Reviewing files that changed from the base of the PR and between ec6006c and 8c659e6.

📒 Files selected for processing (10)
  • .tekton/quickstarts-pull-request.yaml
  • AGENTS.md
  • Makefile
  • config/config.go
  • docs/testing-guidelines.md
  • local/db-compose.yaml
  • local/init-test-db.sh
  • pkg/database/db.go
  • pkg/database/main_test.go
  • pkg/routes/main_test.go

Comment thread docs/testing-guidelines.md Outdated
Comment thread pkg/database/db.go Outdated
@platex-rehor-bot
Copy link
Copy Markdown
Contributor Author

Good catch! The test failures are caused by a GORM migration ordering issue — not related to the toolchain fix.

Root cause: GORM's AutoMigrate processes models in the order they're listed. Quickstart was listed before Tag, so when GORM tried to create the quickstart_tags join table (with a foreign key referencing tags(id)), the tags table didn't have its primary key constraint yet. SQLite doesn't enforce FK constraints so this was never caught before, but PostgreSQL does.

Fix (6b93e6c): Reordered all AutoMigrate and CreateTable calls across 4 files to put Tag first:

  • pkg/database/db.goInit() CreateTable order
  • pkg/database/main_test.go — test AutoMigrate order
  • pkg/routes/main_test.go — test AutoMigrate order
  • cmd/migrate/migrate.go — production AutoMigrate order

This ensures the tags table (with its primary key) exists before any join tables that reference it are created. All SQLite tests pass locally.

@Hyperkid123
Copy link
Copy Markdown
Collaborator

We still hvae issues with the DB preparation. Can you call make migrate before the DB starts? That should prep the DB

 
  2026/04/27 14:21:16 /var/workdir/pkg/routes/main_test.go:37 ERROR: there is no unique constraint matching given keys for referenced table "tags" (SQLSTATE 42830)
  [3.063ms] [rows:0] CREATE TABLE "help_topic_tags" ("help_topic_id" bigint,"tag_id" bigint,PRIMARY KEY ("help_topic_id","tag_id"),CONSTRAINT "fk_help_topic_tags_tag" FOREIGN KEY ("tag_id") REFERENCES "tags"("id"),CONSTRAINT "fk_help_topic_tags_help_topic" FOREIGN KEY ("help_topic_id") REFERENCES "help_topics"("id"))
  panic: ERROR: there is no unique constraint matching given keys for referenced table "tags" (SQLSTATE 42830)
  
  goroutine 1 [running]:
  github.com/RedHatInsights/quickstarts/pkg/routes.setUp()
  	/var/workdir/pkg/routes/main_test.go:39 +0x2fd
  github.com/RedHatInsights/quickstarts/pkg/routes.TestMain(0xc00015a000)
  	/var/workdir/pkg/routes/main_test.go:15 +0x18
  main.main()
  	_testmain.go:107 +0xa5
  FAIL	github.com/RedHatInsights/quickstarts/pkg/routes	0.078s
  	github.com/RedHatInsights/quickstarts/pkg/services		coverage: 0.0% of statements
  	github.com/RedHatInsights/quickstarts/pkg/utils		coverage: 0.0% of statements
  FAIL

Copy link
Copy Markdown
Contributor Author

@platex-rehor-bot platex-rehor-bot left a comment

Choose a reason for hiding this comment

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

Thanks for the pointer — the PostgreSQL sidecar is already configured in .tekton/quickstarts-pull-request.yaml using the same shared pipeline (docker-build-run-unit-tests-dynamic-env.yaml) and the same pattern as chrome-service-backend. The PG connection parameters (PGSQL_USER, PGSQL_PASSWORD, etc.) are all wired up, and the unit-tests-script waits for the sidecar to be ready before running tests.

The run-unit-tests CI failure turned out to be caused by three test assertions in pkg/database/db_test.go that compared exact SQLite-specific error messages (e.g. "sql: converting argument $4 type: invalid tag value" and "NOT NULL constraint failed: tags.value"). PostgreSQL returns different error strings for the same constraint violations, so these assertions failed.

Fixed in the latest commit by replacing the exact string matches with assert.Error + assert.Contains — the tests now validate that the correct errors occur without depending on a specific database driver's error format.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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 (3)
.tekton/quickstarts-pull-request.yaml (2)

33-50: Consider using secrets for database credentials.

The PostgreSQL credentials (PGSQL_USER, PGSQL_PASSWORD) and Unleash tokens are hardcoded in the PipelineRun. While these are test credentials for a local sidecar, consider using Kubernetes secrets for better security hygiene, especially since this file is committed to version control.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.tekton/quickstarts-pull-request.yaml around lines 33 - 50, Replace
hardcoded credentials in the PipelineRun env block (PGSQL_USER, PGSQL_PASSWORD,
PGSQL_HOSTNAME, PGSQL_PORT, PGSQL_DATABASE, UNLEASH_API_TOKEN,
UNLEASH_ADMIN_TOKEN and the env-vars TEST_DATABASE_URL) with references to
Kubernetes Secrets using valueFrom/secretKeyRef (or envFrom) and update the
pipeline/container spec to consume those secret keys; create a corresponding
Secret resource (containing keys for pg_user, pg_password, pg_hostname, pg_port,
pg_database, unleash_api_token, unleash_admin_token, and TEST_DATABASE_URL) and
ensure the env-vars entry uses the secret value instead of inline
TEST_DATABASE_URL so credentials are no longer stored directly in the YAML.

64-73: Consider using pg_isready for more robust PostgreSQL readiness check.

The TCP port check (/dev/tcp/...) only confirms the port is listening, not that PostgreSQL is ready to accept connections. Since psql is available (used on Line 76), consider using pg_isready which checks actual PostgreSQL readiness.

Suggested improvement
       # Wait for PostgreSQL sidecar to be ready
       echo "Waiting for PostgreSQL..."
       for i in $(seq 1 30); do
-        if bash -c "echo > /dev/tcp/$(params.PGSQL_HOSTNAME)/$(params.PGSQL_PORT)" 2>/dev/null; then
+        if pg_isready -h $(params.PGSQL_HOSTNAME) -p $(params.PGSQL_PORT) -U $(params.PGSQL_USER) -q; then
           echo "PostgreSQL is ready"
           break
         fi
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.tekton/quickstarts-pull-request.yaml around lines 64 - 73, The current
readiness loop uses a raw TCP check against
$(params.PGSQL_HOSTNAME)/$(params.PGSQL_PORT) which only verifies a listening
port; replace it with a loop that calls pg_isready -h "$PGSQL_HOSTNAME" -p
"$PGSQL_PORT" (or the equivalent with $(params.PGSQL_HOSTNAME) and
$(params.PGSQL_PORT)) until it reports the server as accepting connections,
keeping the same retry count/sleep behavior as the existing for-loop; if
pg_isready is unavailable, keep the original /dev/tcp fallback but prefer
pg_isready for correctness and ensure the script still echoes attempts and the
final "PostgreSQL is ready" message.
pkg/database/main_test.go (1)

46-46: Consider adding FavoriteQuickstart for consistency with routes tests.

The AutoMigrate call here excludes models.FavoriteQuickstart{}, but pkg/routes/main_test.go includes it. While this may work if no database package tests use FavoriteQuickstart, the inconsistency could cause subtle failures later.

Suggested alignment
-	err = DB.AutoMigrate(&models.Tag{}, &models.Quickstart{}, &models.QuickstartProgress{}, &models.HelpTopic{})
+	err = DB.AutoMigrate(&models.Tag{}, &models.Quickstart{}, &models.QuickstartProgress{}, &models.HelpTopic{}, &models.FavoriteQuickstart{})
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/database/main_test.go` at line 46, The AutoMigrate call in DB.AutoMigrate
currently omits models.FavoriteQuickstart causing inconsistency with pkg/routes
tests; update the AutoMigrate invocation (the DB.AutoMigrate(...) call) to
include &models.FavoriteQuickstart{} alongside &models.Tag{},
&models.Quickstart{}, &models.QuickstartProgress{}, &models.HelpTopic{} so the
FavoriteQuickstart schema is created for tests and kept consistent with routes
tests.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.tekton/quickstarts-pull-request.yaml:
- Around line 75-76: Fix the typo in the comment above the psql command: change
the comment text "# veciry connection and active DBs" to "# verify connection
and active DBs" so the comment accurately describes the following psql
invocation (the line beginning with "psql -U $(params.PGSQL_USER) -h
$(params.PGSQL_HOSTNAME) -p $(params.PGSQL_PORT) -d $(params.PGSQL_DATABASE) -c
\"\\l\"").

---

Nitpick comments:
In @.tekton/quickstarts-pull-request.yaml:
- Around line 33-50: Replace hardcoded credentials in the PipelineRun env block
(PGSQL_USER, PGSQL_PASSWORD, PGSQL_HOSTNAME, PGSQL_PORT, PGSQL_DATABASE,
UNLEASH_API_TOKEN, UNLEASH_ADMIN_TOKEN and the env-vars TEST_DATABASE_URL) with
references to Kubernetes Secrets using valueFrom/secretKeyRef (or envFrom) and
update the pipeline/container spec to consume those secret keys; create a
corresponding Secret resource (containing keys for pg_user, pg_password,
pg_hostname, pg_port, pg_database, unleash_api_token, unleash_admin_token, and
TEST_DATABASE_URL) and ensure the env-vars entry uses the secret value instead
of inline TEST_DATABASE_URL so credentials are no longer stored directly in the
YAML.
- Around line 64-73: The current readiness loop uses a raw TCP check against
$(params.PGSQL_HOSTNAME)/$(params.PGSQL_PORT) which only verifies a listening
port; replace it with a loop that calls pg_isready -h "$PGSQL_HOSTNAME" -p
"$PGSQL_PORT" (or the equivalent with $(params.PGSQL_HOSTNAME) and
$(params.PGSQL_PORT)) until it reports the server as accepting connections,
keeping the same retry count/sleep behavior as the existing for-loop; if
pg_isready is unavailable, keep the original /dev/tcp fallback but prefer
pg_isready for correctness and ensure the script still echoes attempts and the
final "PostgreSQL is ready" message.

In `@pkg/database/main_test.go`:
- Line 46: The AutoMigrate call in DB.AutoMigrate currently omits
models.FavoriteQuickstart causing inconsistency with pkg/routes tests; update
the AutoMigrate invocation (the DB.AutoMigrate(...) call) to include
&models.FavoriteQuickstart{} alongside &models.Tag{}, &models.Quickstart{},
&models.QuickstartProgress{}, &models.HelpTopic{} so the FavoriteQuickstart
schema is created for tests and kept consistent with routes tests.
🪄 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: Enterprise

Run ID: bbc90609-9e44-4dd1-9f6c-738adfee5c2e

📥 Commits

Reviewing files that changed from the base of the PR and between 8c659e6 and 1a1b48b.

📒 Files selected for processing (7)
  • .tekton/quickstarts-pull-request.yaml
  • cmd/migrate/migrate.go
  • docs/testing-guidelines.md
  • pkg/database/db.go
  • pkg/database/db_test.go
  • pkg/database/main_test.go
  • pkg/routes/main_test.go
✅ Files skipped from review due to trivial changes (1)
  • cmd/migrate/migrate.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • pkg/routes/main_test.go
  • docs/testing-guidelines.md

Comment thread .tekton/quickstarts-pull-request.yaml Outdated
@Hyperkid123 Hyperkid123 force-pushed the bot/RHCLOUD-42334 branch 8 times, most recently from da15784 to 098229f Compare April 28, 2026 08:38
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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 (3)
pkg/database/db.go (1)

89-105: Consider adding QuickstartProgress to the table creation sequence.

The Init() function creates Tag, Quickstart, HelpTopic, and FavoriteQuickstart tables, but QuickstartProgress is missing here while it's included in the test setup's AutoMigrate call. This inconsistency could cause issues if Init() is called standalone without a subsequent AutoMigrate.

Proposed addition
 	if !DB.Migrator().HasTable(&models.FavoriteQuickstart{}) {
 		DB.Migrator().CreateTable(&models.FavoriteQuickstart{})
 	}
+	if !DB.Migrator().HasTable(&models.QuickstartProgress{}) {
+		DB.Migrator().CreateTable(&models.QuickstartProgress{})
+	}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/database/db.go` around lines 89 - 105, The Init() table-creation sequence
omits the QuickstartProgress model causing inconsistency with the test
AutoMigrate; update the Init() function to check for and create the
QuickstartProgress table just like the others by adding a HasTable/CreateTable
branch for models.QuickstartProgress alongside the existing calls to
DB.Migrator().HasTable and DB.Migrator().CreateTable (referencing Init,
DB.Migrator(), and models.QuickstartProgress).
.tekton/quickstarts-pull-request.yaml (2)

32-41: Consider using a Kubernetes Secret for PostgreSQL credentials.

While these are test database credentials, hardcoding passwords in the pipeline YAML is not ideal practice. For consistency with production patterns and to avoid accidental credential exposure in logs or pipeline artifacts, consider referencing a Secret.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.tekton/quickstarts-pull-request.yaml around lines 32 - 41, Replace the
hardcoded DB env values (PGSQL_USER, PGSQL_PASSWORD, PGSQL_HOSTNAME, PGSQL_PORT,
PGSQL_DATABASE) with references to a Kubernetes Secret: create a Secret
containing those keys (or at least the sensitive ones like PGSQL_PASSWORD and
PGSQL_USER) and update the pipeline step to use valueFrom.secretKeyRef (or
envFrom: secretRef) to pull values at runtime; ensure the Secret key names match
the env var names used by the step so functions/steps expecting PGSQL_USER,
PGSQL_PASSWORD, PGSQL_HOSTNAME, PGSQL_PORT, and PGSQL_DATABASE continue to work
unchanged.

56-65: Readiness loop may not be robust enough for slow container starts.

The loop waits 30 × 2s = 60 seconds, which should suffice in most cases. However, the /dev/tcp check only verifies the port is open, not that PostgreSQL is ready to accept queries. Consider adding a pg_isready check or a simple query after the port becomes available.

Enhanced readiness check
       # Wait for PostgreSQL sidecar to be ready
       echo "Waiting for PostgreSQL..."
       for i in $(seq 1 30); do
         if bash -c "echo > /dev/tcp/$(params.PGSQL_HOSTNAME)/$(params.PGSQL_PORT)" 2>/dev/null; then
-          echo "PostgreSQL is ready"
-          break
+          echo "Port is open, verifying PostgreSQL accepts connections..."
+          if PGPASSWORD=$(params.PGSQL_PASSWORD) psql -U $(params.PGSQL_USER) -h $(params.PGSQL_HOSTNAME) -p $(params.PGSQL_PORT) -d $(params.PGSQL_DATABASE) -c "SELECT 1" >/dev/null 2>&1; then
+            echo "PostgreSQL is ready"
+            break
+          fi
         fi
         echo "Attempt $i/30 — waiting..."
         sleep 2
       done
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.tekton/quickstarts-pull-request.yaml around lines 56 - 65, The readiness
loop that checks /dev/tcp for $(params.PGSQL_HOSTNAME)/$(params.PGSQL_PORT)
should be hardened: after the port check in the for-loop, run a real PostgreSQL
readiness probe (e.g., call pg_isready -h $PGSQL_HOSTNAME -p $PGSQL_PORT or
execute a simple SQL like SELECT 1 via psql) with its own retry/timeout before
breaking; if pg_isready/psql isn’t available fall back to an extra loop that
runs a simple query against the DB and only exit when it succeeds, and consider
increasing the max attempts/sleep to handle slow starts. Ensure you reference
the same variables (params.PGSQL_HOSTNAME, params.PGSQL_PORT) and update the
echo messages to reflect the more accurate readiness check.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@pkg/database/main_test.go`:
- Line 46: The AutoMigrate call in the test setup omits the FavoriteQuickstart
model causing schema inconsistencies; update the DB.AutoMigrate invocation (the
call where DB.AutoMigrate is executed with models.Tag, models.Quickstart,
models.QuickstartProgress, models.HelpTopic) to also include
&models.FavoriteQuickstart{} so the test DB schema matches
pkg/routes/main_test.go.

---

Nitpick comments:
In @.tekton/quickstarts-pull-request.yaml:
- Around line 32-41: Replace the hardcoded DB env values (PGSQL_USER,
PGSQL_PASSWORD, PGSQL_HOSTNAME, PGSQL_PORT, PGSQL_DATABASE) with references to a
Kubernetes Secret: create a Secret containing those keys (or at least the
sensitive ones like PGSQL_PASSWORD and PGSQL_USER) and update the pipeline step
to use valueFrom.secretKeyRef (or envFrom: secretRef) to pull values at runtime;
ensure the Secret key names match the env var names used by the step so
functions/steps expecting PGSQL_USER, PGSQL_PASSWORD, PGSQL_HOSTNAME,
PGSQL_PORT, and PGSQL_DATABASE continue to work unchanged.
- Around line 56-65: The readiness loop that checks /dev/tcp for
$(params.PGSQL_HOSTNAME)/$(params.PGSQL_PORT) should be hardened: after the port
check in the for-loop, run a real PostgreSQL readiness probe (e.g., call
pg_isready -h $PGSQL_HOSTNAME -p $PGSQL_PORT or execute a simple SQL like SELECT
1 via psql) with its own retry/timeout before breaking; if pg_isready/psql isn’t
available fall back to an extra loop that runs a simple query against the DB and
only exit when it succeeds, and consider increasing the max attempts/sleep to
handle slow starts. Ensure you reference the same variables
(params.PGSQL_HOSTNAME, params.PGSQL_PORT) and update the echo messages to
reflect the more accurate readiness check.

In `@pkg/database/db.go`:
- Around line 89-105: The Init() table-creation sequence omits the
QuickstartProgress model causing inconsistency with the test AutoMigrate; update
the Init() function to check for and create the QuickstartProgress table just
like the others by adding a HasTable/CreateTable branch for
models.QuickstartProgress alongside the existing calls to DB.Migrator().HasTable
and DB.Migrator().CreateTable (referencing Init, DB.Migrator(), and
models.QuickstartProgress).
🪄 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: Enterprise

Run ID: 7f68bb13-a802-478c-9580-85e737b92c9d

📥 Commits

Reviewing files that changed from the base of the PR and between 1a1b48b and 098229f.

📒 Files selected for processing (14)
  • .tekton/quickstarts-pull-request.yaml
  • AGENTS.md
  • Makefile
  • cmd/migrate/migrate.go
  • config/config.go
  • docs/testing-guidelines.md
  • local/db-compose.yaml
  • local/init-test-db.sh
  • pkg/database/db.go
  • pkg/database/db_test.go
  • pkg/database/main_test.go
  • pkg/models/base.go
  • pkg/models/tag.go
  • pkg/routes/main_test.go
✅ Files skipped from review due to trivial changes (5)
  • pkg/models/tag.go
  • pkg/models/base.go
  • cmd/migrate/migrate.go
  • local/db-compose.yaml
  • local/init-test-db.sh
🚧 Files skipped from review as they are similar to previous changes (4)
  • config/config.go
  • Makefile
  • pkg/routes/main_test.go
  • docs/testing-guidelines.md

Comment thread pkg/database/main_test.go Outdated
@Hyperkid123 Hyperkid123 force-pushed the bot/RHCLOUD-42334 branch 2 times, most recently from 71ef60d to 44481ca Compare April 28, 2026 08:58
@Hyperkid123
Copy link
Copy Markdown
Collaborator

@platex-rehor-bot ok this a bit too complicated. I removed your commit and created working version. The main issue was with the remote pipeline. The pipeline was not meant to be run in quickstarts, but we hoped it could be simply re-used. The issue is that the remote pipeline also spins up unleash and unelash DB. The unleash DB had some duplicate relations which prevented the gorm auto migration script form properly creating the DB schema require for quickstarts.

So we need separate pipeline for quickstarts, which I have now done. The rest of changes are needed due to the infra differneces between CI and local.

@Hyperkid123 Hyperkid123 dismissed their stale review April 28, 2026 09:10

CI issues fixed

Add FavoriteQuickstart to AutoMigrate in pkg/database/main_test.go to
match pkg/routes/main_test.go. Add QuickstartProgress to Init() table
creation sequence alongside the other models.

RHCLOUD-42334

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@platex-rehor-bot
Copy link
Copy Markdown
Contributor Author

Thanks for rewriting the pipeline approach! That makes total sense — the shared pipeline's Unleash sidecar was causing table name conflicts with GORM auto-migration. A dedicated pipeline for quickstarts is much cleaner.

I've pushed a small follow-up commit addressing two consistency issues flagged by CodeRabbit on the new code:

  1. pkg/database/main_test.go — added FavoriteQuickstart to AutoMigrate to match pkg/routes/main_test.go
  2. pkg/database/db.go — added QuickstartProgress to Init() table creation sequence alongside the other models

All SQLite tests still pass. Let me know if anything needs adjusting!

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (3)
.tekton/quickstarts-pull-request.yaml (3)

704-704: Consider pinning the PostgreSQL sidecar image tag.

Using :latest for quay.io/sclorg/postgresql-15-c9s:latest may cause test inconsistencies if the image is updated. Consider pinning to a specific digest or version tag (e.g., postgresql-15-c9s:c9s) for reproducible CI builds.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.tekton/quickstarts-pull-request.yaml at line 704, The manifest uses the
floating tag quay.io/sclorg/postgresql-15-c9s:latest which can introduce CI
flakiness; replace that image reference with a stable version tag or immutable
digest (e.g., quay.io/sclorg/postgresql-15-c9s:c9s or
quay.io/sclorg/postgresql-15-c9s@sha256:<digest>) so builds are reproducible,
updating the image string in the YAML to the chosen tag/digest wherever
quay.io/sclorg/postgresql-15-c9s:latest appears.

740-742: Consider whether runAsUser: 0 is necessary.

Running the unit tests step as root. If this is required for trusted artifact extraction or go-toolset operations, document the reason in a comment. Otherwise, consider using a non-root user for better security hygiene.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.tekton/quickstarts-pull-request.yaml around lines 740 - 742, The pipeline
step currently sets securityContext.runAsUser: 0 which runs the unit tests as
root; decide whether root is actually required for the step that contains the
script: | (e.g., artifact extraction or go-toolset tasks). If root is not
needed, change runAsUser to a non-root UID (or remove the setting to inherit the
pod default) and if root is required, add an inline comment above
securityContext or next to runAsUser explaining the specific reason (what
trusted artifact or go-toolset operation requires UID 0) and any mitigation
(e.g., limiting volume mounts or capabilities). Locate the securityContext block
in the unit-tests step (the block containing securityContext, runAsUser, and
script) to apply the change and add the explanatory comment.

32-41: Consider using a Secret for PostgreSQL credentials.

The PostgreSQL credentials (PGSQL_USER, PGSQL_PASSWORD) are hardcoded in the PipelineRun parameters. While these are only test database credentials (localhost, isolated sidecar), storing credentials in pipeline YAML is less secure than using Kubernetes Secrets. This is acceptable for now since it's an isolated test environment, but consider moving to a Secret reference for consistency with production practices.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.tekton/quickstarts-pull-request.yaml around lines 32 - 41, Replace the
hardcoded PGSQL_USER and PGSQL_PASSWORD values with references to a Kubernetes
Secret: create a Secret containing keys matching PGSQL_USER and PGSQL_PASSWORD,
then update .tekton/quickstarts-pull-request.yaml to pull those values from the
Secret (use secretKeyRef/valueFrom in the PipelineRun or task env where
PGSQL_USER and PGSQL_PASSWORD are set); keep PGSQL_HOSTNAME, PGSQL_PORT and
PGSQL_DATABASE as-is, and ensure the Tekton service account has permission to
read the Secret.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.tekton/quickstarts-pull-request.yaml:
- Line 704: The manifest uses the floating tag
quay.io/sclorg/postgresql-15-c9s:latest which can introduce CI flakiness;
replace that image reference with a stable version tag or immutable digest
(e.g., quay.io/sclorg/postgresql-15-c9s:c9s or
quay.io/sclorg/postgresql-15-c9s@sha256:<digest>) so builds are reproducible,
updating the image string in the YAML to the chosen tag/digest wherever
quay.io/sclorg/postgresql-15-c9s:latest appears.
- Around line 740-742: The pipeline step currently sets
securityContext.runAsUser: 0 which runs the unit tests as root; decide whether
root is actually required for the step that contains the script: | (e.g.,
artifact extraction or go-toolset tasks). If root is not needed, change
runAsUser to a non-root UID (or remove the setting to inherit the pod default)
and if root is required, add an inline comment above securityContext or next to
runAsUser explaining the specific reason (what trusted artifact or go-toolset
operation requires UID 0) and any mitigation (e.g., limiting volume mounts or
capabilities). Locate the securityContext block in the unit-tests step (the
block containing securityContext, runAsUser, and script) to apply the change and
add the explanatory comment.
- Around line 32-41: Replace the hardcoded PGSQL_USER and PGSQL_PASSWORD values
with references to a Kubernetes Secret: create a Secret containing keys matching
PGSQL_USER and PGSQL_PASSWORD, then update .tekton/quickstarts-pull-request.yaml
to pull those values from the Secret (use secretKeyRef/valueFrom in the
PipelineRun or task env where PGSQL_USER and PGSQL_PASSWORD are set); keep
PGSQL_HOSTNAME, PGSQL_PORT and PGSQL_DATABASE as-is, and ensure the Tekton
service account has permission to read the Secret.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 1331376e-fe24-47b9-934e-ab77cd9d17f2

📥 Commits

Reviewing files that changed from the base of the PR and between 098229f and 1bf23ad.

📒 Files selected for processing (13)
  • .tekton/quickstarts-pull-request.yaml
  • AGENTS.md
  • Makefile
  • config/config.go
  • docs/testing-guidelines.md
  • local/db-compose.yaml
  • local/init-test-db.sh
  • pkg/database/db.go
  • pkg/database/db_test.go
  • pkg/database/main_test.go
  • pkg/database/testing_utils.go
  • pkg/routes/main_test.go
  • pkg/routes/quickstart_progress_test.go
✅ Files skipped from review due to trivial changes (3)
  • local/db-compose.yaml
  • local/init-test-db.sh
  • pkg/database/db_test.go
🚧 Files skipped from review as they are similar to previous changes (4)
  • config/config.go
  • Makefile
  • pkg/database/main_test.go
  • docs/testing-guidelines.md

RHCLOUD-42334

Pin postgresql-15-c9s sidecar to :c9s tag for reproducible CI builds.
Add comment explaining why runAsUser: 0 is needed (trusted artifact
extraction writes as root).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@platex-rehor-bot
Copy link
Copy Markdown
Contributor Author

Addressed the CodeRabbit review nitpicks in 379c95c:

  1. PostgreSQL image tag: Pinned postgresql-15-c9s to :c9s (CentOS Stream 9 stable) instead of :latest for reproducible CI builds.

  2. runAsUser: 0: Added a comment explaining why root is required — trusted artifact extraction writes to /var/workdir as root, and the unit-tests step needs matching UID to read the source files.

  3. Hardcoded PGSQL credentials: These are test-only credentials for an ephemeral PostgreSQL sidecar container that only exists during CI runs (localhost, no external access). Using Kubernetes Secrets would add infra complexity without a meaningful security benefit here, so keeping them inline as CodeRabbit also noted is acceptable.

Copy link
Copy Markdown

@charlesmulder charlesmulder left a comment

Choose a reason for hiding this comment

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

Tested with make test (SQLite) and make test-pg (PostgreSQL). Both pass. Started local dev server, verified API endpoints work. LGTM.

@Hyperkid123 Hyperkid123 merged commit a43c18b into RedHatInsights:main Apr 29, 2026
9 checks passed
@platex-rehor-bot platex-rehor-bot deleted the bot/RHCLOUD-42334 branch April 29, 2026 10:37
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.

3 participants