MCPcopy Index your code
hub / github.com/dagger/dagger / bench

Method bench

toolchains/engine-dev/bench.go:209–244  ·  view source on GitHub ↗
(
	ctx context.Context,
	opts *benchOpts,
)

Source from the content-addressed store, hash-verified

207}
208
209func (dev *EngineDev) bench(
210 ctx context.Context,
211 opts *benchOpts,
212) error {
213 run := func(cmd *dagger.Container) *dagger.Container {
214 return dev.test(ctx, cmd, &testOpts{
215 runTestRegex: opts.runTestRegex,
216 skipTestRegex: opts.skipTestRegex,
217 pkg: opts.pkg,
218 failfast: opts.failfast,
219 parallel: 0,
220 timeout: opts.timeout,
221 race: opts.race,
222 count: opts.count,
223 update: false,
224 testVerbose: opts.testVerbose,
225 bench: true,
226 },
227 )
228 }
229
230 ctr, _, err := dev.testContainer(ctx, nil)
231 if err != nil {
232 return err
233 }
234
235 if opts.prewarm {
236 _, err = run(ctr.WithEnvVariable("DAGGER_BENCH_PREWARM", "true")).Sync(ctx)
237 if err != nil {
238 return fmt.Errorf("failed during prewarm run: %w", err)
239 }
240 }
241 _, err = run(ctr).Sync(ctx)
242
243 return err
244}

Callers 1

BenchmarkMethod · 0.95

Calls 5

testMethod · 0.95
testContainerMethod · 0.95
SyncMethod · 0.65
runFunction · 0.50
WithEnvVariableMethod · 0.45

Tested by

no test coverage detected