Skip to content

Test status reader in SPRM#21

Merged
testetson22 merged 7 commits into
dcm-project:mainfrom
testetson22:FLPATH-3426-test-status-reader-api
Jun 18, 2026
Merged

Test status reader in SPRM#21
testetson22 merged 7 commits into
dcm-project:mainfrom
testetson22:FLPATH-3426-test-status-reader-api

Conversation

@testetson22

@testetson22 testetson22 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor
  • Add E2E tests for FLPATH-3426/FLPATH-3427 (status reader in SPRM) verifying the full round-trip: SP publishes CloudEvent → NATS → SPRM consumer updates DB → gateway API reflects status
  • Covers happy-path RUNNING propagation, error status for bad images (PENDING via ImagePullBackOff), independent status tracking across concurrent instances, and status visibility in both GET and list endpoints
  • Tests consumer resilience: fake instance IDs and malformed NATS payloads (empty bytes, invalid JSON, missing fields) don't crash the consumer or block subsequent real events
  • Validates implementation edge cases: arbitrary status pass-through, last-write-wins ordering, and GORM zero-value protection (empty status string is a no-op)
  • Confirms deleted instances return 404 with no ghost status records
  • Each test context is fully self-contained; creates and cleans up its own routing policy, catalog items, and instances
  • Soft-deleted instance scenario noted as untestable via gateway (requires internal SPRM API)
  • Address review feedback: replace time.Sleep with Eventually/Consistently matchers, close response bodies in all It blocks, use explicit instanceDeleted flag, and add NATS ordering clarification comment
  • Add code quality patterns to .cursor/rules/e2e-tests.mdc codifying the review fixes as project conventions

Test plan

  • All 19 Status Reader specs pass locally (--ginkgo.focus="Status Reader")
  • go build -tags e2e and go vet -tags e2e clean
  • No remaining time.Sleep in the test file
  • Full E2E suite passes (excluding pre-existing api_instances_test.go routing policy issue on fresh deploys)

Verify the SPRM's NATS status consumer propagates status updates to the
gateway API. Covers happy-path RUNNING propagation, error status for bad
images (PENDING from ImagePullBackOff), independent status tracking
across concurrent instances, and status visibility in both GET and list
endpoints.

Signed-off-by: Thomas Stetson <tstetson@redhat.com>
Tests were failing with 424 (Failed Dependency) on fresh deployments
because no routing policy existed. Each test context now creates and
cleans up its own policy, making the tests fully self-contained.

Signed-off-by: Thomas Stetson <tstetson@redhat.com>
Publish fake instance IDs and malformed payloads directly to NATS and
verify the SPRM consumer stays healthy. Add status stability check and
confirm deleted instances return 404 with no ghost records.

Signed-off-by: Thomas Stetson <tstetson@redhat.com>
Signed-off-by: Thomas Stetson <tstetson@redhat.com>
Signed-off-by: Thomas Stetson <tstetson@redhat.com>
…ency

- Replace static sleep with Eventually and Consistently checks to improve test reliability for health endpoint and status preservation.
- Clarify test descriptions for ordered delivery within a single NATS publisher connection.

Signed-off-by: Thomas Stetson <tstetson@redhat.com>
Replace time.Sleep calls with Eventually/Consistently matchers to
eliminate flakiness, add defer resp.Body.Close() to prevent FD leaks
on assertion failures, and use explicit boolean flag for deletion
tracking. Add code quality patterns to .cursor/rules/e2e-tests.mdc.

Signed-off-by: Thomas Stetson <tstetson@redhat.com>
@testetson22 testetson22 merged commit 539f5ad into dcm-project:main Jun 18, 2026
3 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.

3 participants