feat: wire up MusicBrainz provider in application entry point

- Add App struct with Config, DB, and MusicBrainz client dependencies
- NewApp() initializes database and MusicBrainz client from config
- App.Close() cleans up resources (MB client + DB) on shutdown
- App.run() blocks until context cancelled (goroutine-ready for future tasks)
- Config validation already requires musicbrainz.user_agent
- Add 6 tests: graceful shutdown, config integration, NewApp creation,
  shutdown cleanup, app.run shutdown, UserAgent validation
- All tests pass (6/6 in cmd, full suite green)
This commit is contained in:
2026-05-26 13:14:47 +03:00
parent 15b05b57fb
commit da49d12bb6
3 changed files with 207 additions and 16 deletions

View File

@@ -84,12 +84,12 @@ Implement a MusicBrainz API provider with strict 1 request/second rate limiting,
- [x] run tests - must pass before next task
### Task 5: Wire up provider in application entry point
- [ ] update `cmd/naviwatcher/main.go` to initialize MusicBrainz client
- [ ] add MusicBrainz client to application context/dependencies
- [ ] ensure graceful shutdown includes closing HTTP client connections
- [ ] update config validation to ensure MusicBrainz.UserAgent is set
- [ ] write tests for main.go integration (startup/shutdown)
- [ ] run tests - must pass before next task
- [x] update `cmd/naviwatcher/main.go` to initialize MusicBrainz client
- [x] add MusicBrainz client to application context/dependencies
- [x] ensure graceful shutdown includes closing HTTP client connections
- [x] update config validation to ensure MusicBrainz.UserAgent is set
- [x] write tests for main.go integration (startup/shutdown)
- [x] run tests - must pass before next task
### Task 6: Verify acceptance criteria and run full test suite
- [ ] verify all requirements from Overview are implemented