()
| 28 | ) |
| 29 | |
| 30 | func (r *RootCmd) scaletestTaskStatus() *serpent.Command { |
| 31 | var ( |
| 32 | count int64 |
| 33 | template string |
| 34 | workspaceNamePrefix string |
| 35 | appSlug string |
| 36 | reportStatusPeriod time.Duration |
| 37 | reportStatusDuration time.Duration |
| 38 | baselineDuration time.Duration |
| 39 | tracingFlags = &scaletestTracingFlags{} |
| 40 | prometheusFlags = &scaletestPrometheusFlags{} |
| 41 | timeoutStrategy = &timeoutFlags{} |
| 42 | cleanupStrategy = newScaletestCleanupStrategy() |
| 43 | output = &scaletestOutputFlags{} |
| 44 | ) |
| 45 | orgContext := NewOrganizationContext() |
| 46 | |
| 47 | cmd := &serpent.Command{ |
| 48 | Use: "task-status", |
| 49 | Short: "Generates load on the Coder server by simulating task status reporting", |
| 50 | Long: `This test creates external workspaces and simulates AI agents reporting task status. |
| 51 | After all runners connect, it waits for the baseline duration before triggering status reporting.`, |
| 52 | Handler: func(inv *serpent.Invocation) error { |
| 53 | ctx := inv.Context() |
| 54 | |
| 55 | outputs, err := output.parse() |
| 56 | if err != nil { |
| 57 | return xerrors.Errorf("could not parse --output flags: %w", err) |
| 58 | } |
| 59 | |
| 60 | client, err := r.InitClient(inv) |
| 61 | if err != nil { |
| 62 | return err |
| 63 | } |
| 64 | |
| 65 | org, err := orgContext.Selected(inv, client) |
| 66 | if err != nil { |
| 67 | return err |
| 68 | } |
| 69 | |
| 70 | _, err = RequireAdmin(ctx, client) |
| 71 | if err != nil { |
| 72 | return err |
| 73 | } |
| 74 | |
| 75 | // Disable rate limits for this test |
| 76 | client.HTTPClient = &http.Client{ |
| 77 | Transport: &codersdk.HeaderTransport{ |
| 78 | Transport: http.DefaultTransport, |
| 79 | Header: map[string][]string{ |
| 80 | codersdk.BypassRatelimitHeader: {"true"}, |
| 81 | }, |
| 82 | }, |
| 83 | } |
| 84 | |
| 85 | // Find the template |
| 86 | tpl, err := parseTemplate(ctx, client, []uuid.UUID{org.ID}, template) |
| 87 | if err != nil { |
no test coverage detected