MCPcopy Create free account
hub / github.com/dagger/dagger / TestError

Method TestError

core/integration/container_test.go:200–252  ·  view source on GitHub ↗
(ctx context.Context, t *testctx.T)

Source from the content-addressed store, hash-verified

198}
199
200func (ContainerSuite) TestError(ctx context.Context, t *testctx.T) {
201 for _, tc := range []struct {
202 name string
203 query string
204 expectedErr *string
205 }{
206 {
207 "with error message",
208 `
209 {
210 container {
211 from(address: "` + alpineImage + `") {
212 withError(err: "error raised") {
213 sync
214 }
215 }
216 }
217 }`,
218 ptr("error raised"),
219 },
220 {
221 "with empty error message",
222 `
223 {
224 container {
225 from(address: "` + alpineImage + `") {
226 withError(err: "") {
227 sync
228 }
229 }
230 }
231 }`,
232 nil,
233 },
234 } {
235 t.Run(tc.name, func(ctx context.Context, t *testctx.T) {
236 _, err := testutil.Query[struct {
237 Container struct {
238 From struct {
239 WithError struct {
240 Sync string
241 }
242 }
243 }
244 }](t, tc.query, nil)
245 if tc.expectedErr == nil {
246 require.NoError(t, err)
247 } else {
248 require.ErrorContains(t, err, *tc.expectedErr)
249 }
250 })
251 }
252}
253
254func (ContainerSuite) TestExecStdoutStderr(ctx context.Context, t *testctx.T) {
255 c := connect(ctx, t)

Callers

nothing calls this directly

Calls 3

QueryFunction · 0.92
ptrFunction · 0.70
RunMethod · 0.65

Tested by

no test coverage detected