MCPcopy
hub / github.com/docker/docker-agent / TestSourceLoader_Read_Error

Function TestSourceLoader_Read_Error

pkg/server/source_loader_test.go:108–126  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

106}
107
108func TestSourceLoader_Read_Error(t *testing.T) {
109 t.Parallel()
110 expectedErr := errors.New("read error")
111 inner := &mockSource{
112 name: "test.yaml",
113 err: expectedErr,
114 }
115 ctx := t.Context()
116 sl := newSourceLoader(ctx, inner, 0)
117
118 // Initial load failed
119 assert.Equal(t, 1, inner.getReadCount())
120
121 // Read should return the error from initial load
122 data, err := sl.Read(ctx)
123 require.Error(t, err)
124 assert.Equal(t, expectedErr, err)
125 assert.Nil(t, data)
126}
127
128func TestSourceLoader_Read_DataChanges(t *testing.T) {
129 t.Parallel()

Callers

nothing calls this directly

Calls 6

getReadCountMethod · 0.95
newSourceLoaderFunction · 0.85
ContextMethod · 0.80
ReadMethod · 0.65
NewMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected