Run specific benchmarks 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 +"
( 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 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, )
| 99 | // `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")` |
| 100 | // +cache="session" |
| 101 | func (dev *EngineDev) BenchmarkDump( |
| 102 | ctx context.Context, |
| 103 | // Only run these tests |
| 104 | // +optional |
| 105 | run string, |
| 106 | // Skip these tests |
| 107 | // +optional |
| 108 | skip string, |
| 109 | // +optional |
| 110 | // +default="./..." |
| 111 | pkg string, |
| 112 | // Abort test run on first failure |
| 113 | // +optional |
| 114 | failfast bool, |
| 115 | // How long before timing out the test run |
| 116 | // +optional |
| 117 | timeout string, |
| 118 | // +optional |
| 119 | race bool, |
| 120 | // +default=1 |
| 121 | // +optional |
| 122 | count int, |
| 123 | // Enable verbose output |
| 124 | // +optional |
| 125 | testVerbose bool, |
| 126 | // debug subroute to dump, like pprof/profile, pprof/heap, or requests |
| 127 | // +optional |
| 128 | // +default="pprof/heap" |
| 129 | route string, |
| 130 | // when set, don't take a final dump after the tests have completed. usually good with --route="pprof/profile". |
| 131 | // +optional' |
| 132 | // +default=false |
| 133 | noFinal bool, |
| 134 | // wait this long before starting to take dumps. delay does not include engine startup. |
| 135 | // +optional |
| 136 | // +default="1s" |
| 137 | delay string, |
| 138 | // wait this long between dumps. negative values will fetch exactly 1 dump excluding the one controlled by "final" |
| 139 | // +optional |
| 140 | // +default="-1s" |
| 141 | interval string, |
| 142 | ) (*dagger.Directory, error) { |
| 143 | d, err := time.ParseDuration(delay) |
| 144 | if err != nil { |
| 145 | return nil, err |
| 146 | } |
| 147 | i, err := time.ParseDuration(interval) |
| 148 | if err != nil { |
| 149 | return nil, err |
| 150 | } |
| 151 | return dev.benchDump( |
| 152 | ctx, |
| 153 | &benchOpts{ |
| 154 | runTestRegex: run, |
| 155 | skipTestRegex: skip, |
| 156 | pkg: pkg, |
| 157 | failfast: failfast, |
| 158 | timeout: timeout, |