()
| 805 | } |
| 806 | |
| 807 | func (r *RootCmd) scaletestCreateWorkspaces() *serpent.Command { |
| 808 | var ( |
| 809 | count int64 |
| 810 | retry int64 |
| 811 | maxFailures int64 |
| 812 | template string |
| 813 | |
| 814 | noCleanup bool |
| 815 | // TODO: implement this flag |
| 816 | // noCleanupFailures bool |
| 817 | noWaitForAgents bool |
| 818 | |
| 819 | runCommand string |
| 820 | runTimeout time.Duration |
| 821 | runExpectTimeout bool |
| 822 | runExpectOutput string |
| 823 | runLogOutput bool |
| 824 | |
| 825 | // TODO: customizable agent, currently defaults to the first agent found |
| 826 | // if there are multiple |
| 827 | connectURL string // http://localhost:4/ |
| 828 | connectMode string // derp or direct |
| 829 | connectHold time.Duration |
| 830 | connectInterval time.Duration |
| 831 | connectTimeout time.Duration |
| 832 | |
| 833 | useHostUser bool |
| 834 | |
| 835 | parameterFlags workspaceParameterFlags |
| 836 | |
| 837 | tracingFlags = &scaletestTracingFlags{} |
| 838 | strategy = &scaletestStrategyFlags{} |
| 839 | cleanupStrategy = newScaletestCleanupStrategy() |
| 840 | output = &scaletestOutputFlags{} |
| 841 | ) |
| 842 | |
| 843 | cmd := &serpent.Command{ |
| 844 | Use: "create-workspaces", |
| 845 | Short: "Creates many users, then creates a workspace for each user and waits for them finish building and fully come online. Optionally runs a command inside each workspace, and connects to the workspace over WireGuard.", |
| 846 | Long: `It is recommended that all rate limits are disabled on the server before running this scaletest. This test generates many login events which will be rate limited against the (most likely single) IP.`, |
| 847 | Handler: func(inv *serpent.Invocation) error { |
| 848 | client, err := r.InitClient(inv) |
| 849 | if err != nil { |
| 850 | return err |
| 851 | } |
| 852 | |
| 853 | ctx := inv.Context() |
| 854 | |
| 855 | me, err := RequireAdmin(ctx, client) |
| 856 | if err != nil { |
| 857 | return err |
| 858 | } |
| 859 | |
| 860 | if count <= 0 { |
| 861 | return xerrors.Errorf("--count is required and must be greater than 0") |
| 862 | } |
| 863 | outputs, err := output.parse() |
| 864 | if err != nil { |
no test coverage detected