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

Method CurrentModule

core/telemetry_test.go:59–95  ·  view source on GitHub ↗
(_ context.Context)

Source from the content-addressed store, hash-verified

57}
58
59func (ms *mockServer) CurrentModule(_ context.Context) (dagql.ObjectResult[*Module], error) {
60 var zero dagql.ObjectResult[*Module]
61 if ms.moduleSource == nil {
62 return zero, nil
63 }
64 // This helper only builds test-only module results. Keep using
65 // context.Background here: passing the caller ctx would not change
66 // behavior, because dagql.NewServer ignores its context today and this
67 // path does not use the dagql cache.
68 dag, err := dagql.NewServer(context.Background(), &Query{})
69 if err != nil {
70 panic(err)
71 }
72 dag.InstallObject(dagql.NewClass(dag, dagql.ClassOpts[*ModuleSource]{Typed: &ModuleSource{}}))
73 dag.InstallObject(dagql.NewClass(dag, dagql.ClassOpts[*Module]{Typed: &Module{}}))
74
75 sourceRes, err := dagql.NewObjectResultForCall(ms.moduleSource, dag, &dagql.ResultCall{
76 Kind: dagql.ResultCallKindSynthetic,
77 SyntheticOp: "mock_module_source",
78 Type: dagql.NewResultCallType(ms.moduleSource.Type()),
79 })
80 if err != nil {
81 panic(err)
82 }
83
84 dn := dagql.Nullable[dagql.ObjectResult[*ModuleSource]]{
85 Valid: true,
86 Value: sourceRes,
87 }
88 return dagql.NewObjectResultForCall(&Module{
89 Source: dn,
90 }, dag, &dagql.ResultCall{
91 Kind: dagql.ResultCallKindSynthetic,
92 SyntheticOp: "mock_current_module",
93 Type: dagql.NewResultCallType((&Module{}).Type()),
94 })
95}
96
97func (ms *mockServer) ModuleParent(context.Context) (dagql.ObjectResult[*Module], error) {
98 return dagql.ObjectResult[*Module]{}, nil

Callers

nothing calls this directly

Calls 7

InstallObjectMethod · 0.95
NewServerFunction · 0.92
NewClassFunction · 0.92
NewObjectResultForCallFunction · 0.92
NewResultCallTypeFunction · 0.92
BackgroundMethod · 0.65
TypeMethod · 0.65

Tested by

no test coverage detected