Perform a benchmark of the given test run +cache="session"
( ctx context.Context, // Only run these benchmarks // +optional run string, // Skip these benchmarks // +optional skip string, // +optional // +default="./..." pkg string, // Abort bench run on first failure // +optional failfast bool, // How long before timing out the benchmark run // +optional timeout string, // +optional race bool, // +default=1 // +optional count int, // Enable verbose output // +optional testVerbose bool, // run benchmarks once with metrics tagged "prewarm" before running for real // +optional prewarm bool, // notify this discord webhook on failure // +optional discordWebhook *dagger.Secret, // Git repository to extract git metadata for discord notification // +defaultPath="/" repo *dagger.GitRepository, )
| 11 | // Perform a benchmark of the given test run |
| 12 | // +cache="session" |
| 13 | func (dev *EngineDev) Benchmark( |
| 14 | ctx context.Context, |
| 15 | // Only run these benchmarks |
| 16 | // +optional |
| 17 | run string, |
| 18 | // Skip these benchmarks |
| 19 | // +optional |
| 20 | skip string, |
| 21 | // +optional |
| 22 | // +default="./..." |
| 23 | pkg string, |
| 24 | // Abort bench run on first failure |
| 25 | // +optional |
| 26 | failfast bool, |
| 27 | // How long before timing out the benchmark run |
| 28 | // +optional |
| 29 | timeout string, |
| 30 | // +optional |
| 31 | race bool, |
| 32 | // +default=1 |
| 33 | // +optional |
| 34 | count int, |
| 35 | // Enable verbose output |
| 36 | // +optional |
| 37 | testVerbose bool, |
| 38 | // run benchmarks once with metrics tagged "prewarm" before running for real |
| 39 | // +optional |
| 40 | prewarm bool, |
| 41 | // notify this discord webhook on failure |
| 42 | // +optional |
| 43 | discordWebhook *dagger.Secret, |
| 44 | // Git repository to extract git metadata for discord notification |
| 45 | // +defaultPath="/" |
| 46 | repo *dagger.GitRepository, |
| 47 | ) error { |
| 48 | return dev.notifyOnFailure(ctx, repo, dev.bench( |
| 49 | ctx, |
| 50 | &benchOpts{ |
| 51 | runTestRegex: run, |
| 52 | skipTestRegex: skip, |
| 53 | pkg: pkg, |
| 54 | failfast: failfast, |
| 55 | timeout: timeout, |
| 56 | race: race, |
| 57 | count: count, |
| 58 | testVerbose: testVerbose, |
| 59 | prewarm: prewarm, |
| 60 | }, |
| 61 | ), discordWebhook) |
| 62 | } |
| 63 | |
| 64 | func (dev *EngineDev) notifyOnFailure(ctx context.Context, repo *dagger.GitRepository, err error, discordWebhook *dagger.Secret) error { |
| 65 | if err == nil { |
no test coverage detected