MCPcopy Index your code
hub / github.com/coder/coder / TestWorkspaceWithMultiSelectFailure

Function TestWorkspaceWithMultiSelectFailure

coderd/workspaces_test.go:4464–4528  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

4462}
4463
4464func TestWorkspaceWithMultiSelectFailure(t *testing.T) {
4465 t.Parallel()
4466
4467 client := coderdtest.New(t, &coderdtest.Options{IncludeProvisionerDaemon: true})
4468 user := coderdtest.CreateFirstUser(t, client)
4469 version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{
4470 Parse: echo.ParseComplete,
4471 ProvisionGraph: []*proto.Response{
4472 {
4473 Type: &proto.Response_Graph{
4474 Graph: &proto.GraphComplete{
4475 Parameters: []*proto.RichParameter{
4476 {
4477 Name: "param",
4478 Type: provider.OptionTypeListString,
4479 DefaultValue: `["red"]`,
4480 Options: []*proto.RichParameterOption{
4481 {
4482 Name: "red",
4483 Value: "red",
4484 },
4485 },
4486 FormType: proto.ParameterFormType_MULTISELECT,
4487 },
4488 },
4489 },
4490 },
4491 },
4492 },
4493 ProvisionApply: []*proto.Response{{
4494 Type: &proto.Response_Apply{
4495 Apply: &proto.ApplyComplete{},
4496 },
4497 }},
4498 })
4499 coderdtest.AwaitTemplateVersionJobCompleted(t, client, version.ID)
4500
4501 ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
4502 defer cancel()
4503
4504 templateRichParameters, err := client.TemplateVersionRichParameters(ctx, version.ID)
4505 require.NoError(t, err)
4506 require.Len(t, templateRichParameters, 1)
4507
4508 expectedBuildParameters := []codersdk.WorkspaceBuildParameter{
4509 // purple is not in the response set
4510 {Name: "param", Value: `["red", "purple"]`},
4511 }
4512
4513 template := coderdtest.CreateTemplate(t, client, user.OrganizationID, version.ID)
4514 req := codersdk.CreateWorkspaceRequest{
4515 TemplateID: template.ID,
4516 Name: coderdtest.RandomUsername(t),
4517 AutostartSchedule: ptr.Ref("CRON_TZ=US/Central 30 9 * * 1-5"),
4518 TTLMillis: ptr.Ref((8 * time.Hour).Milliseconds()),
4519 AutomaticUpdates: codersdk.AutomaticUpdatesNever,
4520 RichParameterValues: expectedBuildParameters,
4521 }

Callers

nothing calls this directly

Calls 13

StatusCodeMethod · 0.95
NewFunction · 0.92
CreateFirstUserFunction · 0.92
CreateTemplateVersionFunction · 0.92
CreateTemplateFunction · 0.92
RandomUsernameFunction · 0.92
RefFunction · 0.92
CreateUserWorkspaceMethod · 0.65
LenMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected