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

Method TestDump

toolchains/engine-dev/pprof.go:20–96  ·  view source on GitHub ↗

Run specific tests while curling (pprof) dumps from their associated dev engine: defaults to heap dumps, eg: take a heap dump every second and one after the tests complete: `dagger call test dump --run=TestCache/TestVolume --pkg=./core/integration --interval=1s export --path=/tmp/dump-$(date +"%Y%m%

(
	ctx context.Context,
	// Only run these tests
	// +optional
	run string,
	// Skip these tests
	// +optional
	skip string,
	// +optional
	// +default="./..."
	pkg string,
	// Abort test run on first failure
	// +optional
	failfast bool,
	// How many tests to run in parallel - defaults to the number of CPUs
	// +optional
	parallel int,
	// How long before timing out the test run
	// +optional
	timeout string,
	// +optional
	race bool,
	// +default=1
	// +optional
	count int,
	// Enable verbose output
	// +optional
	testVerbose bool,
	// debug subroute to dump, like pprof/profile, pprof/heap, or requests
	// +optional
	// +default="pprof/heap"
	route string,
	// when set, don't take a final dump after the tests have completed. usually good with --route="pprof/profile".
	// +optional'
	// +default=false
	noFinal bool,
	// wait this long before starting to take dumps. delay does not include engine startup.
	// +optional
	// +default="1s"
	delay string,
	// wait this long between dumps. negative values will fetch exactly 1 dump excluding the one controlled by "final"
	// +optional
	// +default="-1s"
	interval string,
)

Source from the content-addressed store, hash-verified

18// `dagger call test dump --run=TestCache/TestVolume --pkg=./core/integration --route=pprof/profile --no-final export --path=/tmp/dump-$(date +"%Y%m%d_%H%M%S")`
19// +cache="session"
20func (dev *EngineDev) TestDump(
21 ctx context.Context,
22 // Only run these tests
23 // +optional
24 run string,
25 // Skip these tests
26 // +optional
27 skip string,
28 // +optional
29 // +default="./..."
30 pkg string,
31 // Abort test run on first failure
32 // +optional
33 failfast bool,
34 // How many tests to run in parallel - defaults to the number of CPUs
35 // +optional
36 parallel int,
37 // How long before timing out the test run
38 // +optional
39 timeout string,
40 // +optional
41 race bool,
42 // +default=1
43 // +optional
44 count int,
45 // Enable verbose output
46 // +optional
47 testVerbose bool,
48 // debug subroute to dump, like pprof/profile, pprof/heap, or requests
49 // +optional
50 // +default="pprof/heap"
51 route string,
52 // when set, don't take a final dump after the tests have completed. usually good with --route="pprof/profile".
53 // +optional'
54 // +default=false
55 noFinal bool,
56 // wait this long before starting to take dumps. delay does not include engine startup.
57 // +optional
58 // +default="1s"
59 delay string,
60 // wait this long between dumps. negative values will fetch exactly 1 dump excluding the one controlled by "final"
61 // +optional
62 // +default="-1s"
63 interval string,
64) (*dagger.Directory, error) {
65 d, err := time.ParseDuration(delay)
66 if err != nil {
67 return nil, err
68 }
69 i, err := time.ParseDuration(interval)
70 if err != nil {
71 return nil, err
72 }
73 ctr, debugEndpoint, err := dev.testContainer(ctx, nil)
74 if err != nil {
75 return nil, err
76 }
77 ctr = dev.test(ctx, ctr, &testOpts{

Callers 1

invokeFunction · 0.45

Calls 3

testContainerMethod · 0.95
testMethod · 0.95
pprofDumpMethod · 0.95

Tested by

no test coverage detected