MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / seedMetadata

Function seedMetadata

internal/sidecar/metadata_handler_test.go:18–46  ·  view source on GitHub ↗

seedMetadata populates the metadata index directly so search/pagination tests do not depend on live GitHub downloads.

(t *testing.T, dbPath string, n int)

Source from the content-addressed store, hash-verified

16// seedMetadata populates the metadata index directly so search/pagination tests
17// do not depend on live GitHub downloads.
18func seedMetadata(t *testing.T, dbPath string, n int) {
19 t.Helper()
20 ctx := context.Background()
21 store := metadata.NewStore(dbPath)
22 if err := store.Init(ctx); err != nil {
23 t.Fatalf("init store: %v", err)
24 }
25 for i := range n {
26 kind := "skill"
27 itemPath := "skills/seed/SKILL.md"
28 if i%2 == 0 {
29 kind = "agent"
30 itemPath = "agents/seed.md"
31 }
32 if err := store.UpsertItem(ctx, metadata.Item{
33 Kind: kind,
34 Name: kindName(kind, i),
35 Description: "seeded item",
36 RepoOwner: "seed",
37 RepoName: "repo",
38 RepoBranch: "main",
39 ItemPath: itemPath,
40 InstallKey: kind + "-seed-" + itoa(i),
41 TargetApps: "claude,codex",
42 }); err != nil {
43 t.Fatalf("seed upsert: %v", err)
44 }
45 }
46}
47
48func kindName(kind string, i int) string { return kind + "-seed-" + itoa(i) }
49

Calls 5

InitMethod · 0.95
UpsertItemMethod · 0.95
NewStoreFunction · 0.92
kindNameFunction · 0.85
itoaFunction · 0.85

Tested by

no test coverage detected