MCPcopy Create free account
hub / github.com/easyp-tech/server / newTestCommitHandler

Function newTestCommitHandler

internal/connect/api_test.go:1340–1355  ·  view source on GitHub ↗

newTestCommitHandler builds a commitServiceHandler wired to a provider with minimal state, for direct unit testing of prewarmHeads / probeCommitID without the HTTP layer. Enhancements are off by default; tests flip the knobs they exercise.

(repo provider)

Source from the content-addressed store, hash-verified

1338// without the HTTP layer. Enhancements are off by default; tests flip the
1339// knobs they exercise.
1340func newTestCommitHandler(repo provider) *commitServiceHandler {
1341 return &commitServiceHandler{ //nolint:exhaustruct
1342 api: &api{ //nolint:exhaustruct
1343 log: slog.New(slog.NewTextHandler(io.Discard, nil)),
1344 repo: repo,
1345 },
1346 commitMap: make(map[string]moduleRef),
1347 infoCache: make(map[string]commitInfoCache),
1348 filesMap: make(map[string][]content.File),
1349 missCache: make(map[string]time.Time),
1350 prewarmTimeout: time.Second,
1351 probeTimeout: time.Second,
1352 probeNegativeTTL: time.Minute,
1353 probeSem: make(chan struct{}, maxConcurrentProbes),
1354 }
1355}
1356
1357// TestPrewarmHeads_PopulatesCommitMap verifies the startup sweep resolves the
1358// HEAD commit of each configured source and registers it so a later Download

Calls

no outgoing calls

Tested by

no test coverage detected