MCPcopy
hub / github.com/karol-broda/snitch / LoadFixtureFile

Function LoadFixtureFile

internal/testutil/testutil.go:77–89  ·  view source on GitHub ↗

LoadFixtureFile loads connections from a JSON fixture file

(t *testing.T, filePath string)

Source from the content-addressed store, hash-verified

75
76// LoadFixtureFile loads connections from a JSON fixture file
77func LoadFixtureFile(t *testing.T, filePath string) []collector.Connection {
78 mock, err := collector.NewMockCollectorFromFile(filePath)
79 if err != nil {
80 t.Fatalf("Failed to load fixture file %s: %v", filePath, err)
81 }
82
83 connections, err := mock.GetConnections()
84 if err != nil {
85 t.Fatalf("Failed to get connections from fixture: %v", err)
86 }
87
88 return connections
89}
90
91// AssertConnectionsEqual compares two slices of connections for equality
92func AssertConnectionsEqual(t *testing.T, expected, actual []collector.Connection) {

Callers

nothing calls this directly

Calls 2

NewMockCollectorFromFileFunction · 0.92
GetConnectionsMethod · 0.65

Tested by

no test coverage detected