• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stacklok / toolhive / 25570268403

08 May 2026 05:40PM UTC coverage: 64.853% (+0.003%) from 64.85%
25570268403

push

github

web-flow
Wire persistent DCRCredentialStore into EmbeddedAuthServer (#5196)

* Wire persistent DCR store into EmbeddedAuthServer

Type EmbeddedAuthServer.dcrStore against storage.DCRCredentialStore and
derive it from the same storage.Storage value returned by createStorage
via a single type assertion, so a Redis-backed authserver reuses
already-registered RFC 7591 clients across replicas and restarts
instead of re-registering at every boot.

Phase 2 left two parallel DCR stores: a runner-side in-memory map in
dcr_store.go and the storage-level interface added in sub-issue 1. This
collapses the runner-side implementation into a thin storageBackedStore
adapter that delegates to storage.DCRCredentialStore, leaving exactly
one persistence implementation per backend (storage.MemoryStorage and
storage.RedisStorage).

NewInMemoryDCRCredentialStore is preserved as a test helper that wraps
storage.NewMemoryStorage so existing resolver tests compile unchanged;
the standalone inMemoryDCRCredentialStore type and its map / RWMutex
are deleted. buildPureOAuth2Config is unchanged — the wiring change
swaps the implementation passed to the resolver, not the call shape.

Add TestEmbeddedAuthServer_DCRSurvivesRestart in
embeddedauthserver_test.go (next to TestNewEmbeddedAuthServer_DCRBoot)
covering the durable-restart case: boot, close, rebuild against the
same storage.MemoryStorage instance, assert the second resolve makes
zero AS requests. The integration_test.go file under pkg/authserver
would otherwise be the natural home, but it is in package authserver
and importing runner from there would cycle (runner already imports
authserver); the test docstring records this constraint.

* Address code review feedback

Fixed issues from code review of #5185 wiring change:

- HIGH: Storage backend leaked on NewEmbeddedAuthServer error paths.
  Split the constructor into a public NewEmbeddedAuthServer that calls
  createStorage and an unexported newEmbeddedAuthServerWithStorage that
  o... (continued)

86 of 91 new or added lines in 3 files covered. (94.51%)

212 existing lines in 7 files now uncovered.

63497 of 97909 relevant lines covered (64.85%)

62.19 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.95
/pkg/authserver/server_impl.go


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc