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

Struct mockSource

internal/connect/api_test.go:78–86  ·  view source on GitHub ↗

mockSource is a source.Source that returns canned metadata for OwnerService tests. It only implements the methods needed for buildKnownOwners (Owner, RepoName) plus the Source interface contract that the rest of the package relies on. For pre-warm/probe tests, GetMeta is sha-aware: it owns exactly

Source from the content-addressed store, hash-verified

76// is reported as not-owned (error). getMetaCalls counts calls so tests can
77// assert the negative cache suppresses repeat probes.
78type mockSource struct {
79 owner string
80 repoName string
81 typ string
82 commit string
83
84 getMetaCalls *atomic.Int32
85 getMetaErr error // when set, GetMeta always returns this error
86}
87
88func (s *mockSource) GetMeta(_ context.Context, commit string) (content.Meta, error) {
89 if s.getMetaCalls != nil {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected