Skip to content

test: verify api graceful shutdown ordering#274

Open
Goodnessoj wants to merge 1 commit into
Grainlify:mainfrom
Goodnessoj:test/api-shutdown-ordering
Open

test: verify api graceful shutdown ordering#274
Goodnessoj wants to merge 1 commit into
Grainlify:mainfrom
Goodnessoj:test/api-shutdown-ordering

Conversation

@Goodnessoj

Copy link
Copy Markdown

Closes #161

Summary

  • Extracted the API graceful shutdown sequence into a small testable helper.
  • Documented the intended order: stop HTTP listener first, cancel/wait workers, drain/close bus, close DB last.
  • Added tests for shutdown ordering, DB remaining open until HTTP drain completes, repeated shutdown invocation, dependency close errors, and non-fatal worker wait timeout handling.

Tests

  • go test ./cmd/api/... -v

Notes

  • Existing HTTP shutdown timeout behavior remains delegated to internal/shutdown.Wait for workers and internal/api.Shutdown for Fiber.
  • Current bus and DB close methods do not return errors, but the extracted helper preserves error reporting for close hooks so future close failures are not masked.

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.

Add graceful-shutdown ordering test for cmd/api/main.go

1 participant