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

Method TestCLIFunctions

core/integration/module_cli_test.go:1186–1348  ·  view source on GitHub ↗
(ctx context.Context, t *testctx.T)

Source from the content-addressed store, hash-verified

1184}
1185
1186func (CLISuite) TestCLIFunctions(ctx context.Context, t *testctx.T) {
1187 c := connect(ctx, t)
1188
1189 ctr := c.Container().From(golangImage).
1190 WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
1191 WithWorkdir("/work").
1192 With(daggerExec("init", "--source=.", "--name=test", "--sdk=go")).
1193 WithNewFile("main.go", `package main
1194
1195import (
1196 "context"
1197
1198 "dagger/test/internal/dagger"
1199)
1200
1201type Test struct{}
1202
1203// doc for FnA
1204func (m *Test) FnA() *dagger.Container {
1205 return nil
1206}
1207
1208// doc for FnB
1209func (m *Test) FnB() Duck {
1210 return nil
1211}
1212
1213type Duck interface {
1214 DaggerObject
1215 // quack that thang
1216 Quack(ctx context.Context) (string, error)
1217}
1218
1219// doc for FnC
1220func (m *Test) FnC() *Obj {
1221 return nil
1222}
1223
1224// doc for Prim
1225func (m *Test) Prim() string {
1226 return "yo"
1227}
1228
1229type Obj struct {
1230 // doc for FieldA
1231 FieldA *dagger.Container
1232 // doc for FieldB
1233 FieldB string
1234 // doc for FieldC
1235 FieldC *Obj
1236 // doc for FieldD
1237 FieldD *OtherObj
1238}
1239
1240// doc for FnD
1241func (m *Obj) FnD() *dagger.Container {
1242 return nil
1243}

Callers

nothing calls this directly

Calls 15

daggerCliFileFunction · 0.85
daggerExecFunction · 0.85
daggerFunctionsFunction · 0.85
requireErrOutFunction · 0.85
connectFunction · 0.70
RunMethod · 0.65
ContainsMethod · 0.65
WithNewFileMethod · 0.45
WithMethod · 0.45
WithWorkdirMethod · 0.45
WithMountedFileMethod · 0.45
FromMethod · 0.45

Tested by

no test coverage detected