@@ -597,73 +597,6 @@ func TestUpdateValidateRichParameters(t *testing.T) {
597
597
<- doneChan
598
598
})
599
599
600
- t .Run ("RequiredImmutableParameterAdded" , func (t * testing.T ) {
601
- t .Parallel ()
602
-
603
- // Create template and workspace
604
- client := coderdtest .New (t , & coderdtest.Options {IncludeProvisionerDaemon : true })
605
- user := coderdtest .CreateFirstUser (t , client )
606
-
607
- templateParameters := []* proto.RichParameter {
608
- {Name : stringParameterName , Type : "string" , Mutable : true , Required : true , Options : []* proto.RichParameterOption {
609
- {Name : "First option" , Description : "This is first option" , Value : "1st" },
610
- {Name : "Second option" , Description : "This is second option" , Value : "2nd" },
611
- {Name : "Third option" , Description : "This is third option" , Value : "3rd" },
612
- }},
613
- }
614
- version := coderdtest .CreateTemplateVersion (t , client , user .OrganizationID , prepareEchoResponses (templateParameters ))
615
- coderdtest .AwaitTemplateVersionJob (t , client , version .ID )
616
- template := coderdtest .CreateTemplate (t , client , user .OrganizationID , version .ID )
617
-
618
- inv , root := clitest .New (t , "create" , "my-workspace" , "--yes" , "--template" , template .Name , "--parameter" , fmt .Sprintf ("%s=%s" , stringParameterName , "2nd" ))
619
- clitest .SetupConfig (t , client , root )
620
- err := inv .Run ()
621
- require .NoError (t , err )
622
-
623
- // Update template: add required, immutable parameter
624
- updatedTemplateParameters := []* proto.RichParameter {
625
- templateParameters [0 ],
626
- {Name : immutableParameterName , Type : "string" , Mutable : false , Required : true , Options : []* proto.RichParameterOption {
627
- {Name : "fir" , Description : "This is first option for immutable parameter" , Value : "I" },
628
- {Name : "sec" , Description : "This is second option for immutable parameter" , Value : "II" },
629
- {Name : "thi" , Description : "This is third option for immutable parameter" , Value : "III" },
630
- }},
631
- }
632
-
633
- updatedVersion := coderdtest .UpdateTemplateVersion (t , client , user .OrganizationID , prepareEchoResponses (updatedTemplateParameters ), template .ID )
634
- coderdtest .AwaitTemplateVersionJob (t , client , updatedVersion .ID )
635
- err = client .UpdateActiveTemplateVersion (context .Background (), template .ID , codersdk.UpdateActiveTemplateVersion {
636
- ID : updatedVersion .ID ,
637
- })
638
- require .NoError (t , err )
639
-
640
- // Update the workspace
641
- inv , root = clitest .New (t , "update" , "my-workspace" )
642
- clitest .SetupConfig (t , client , root )
643
- doneChan := make (chan struct {})
644
- pty := ptytest .New (t ).Attach (inv )
645
- go func () {
646
- defer close (doneChan )
647
- err := inv .Run ()
648
- assert .NoError (t , err )
649
- }()
650
-
651
- matches := []string {
652
- immutableParameterName , "thi" ,
653
- "Planning workspace..." , "" ,
654
- }
655
- for i := 0 ; i < len (matches ); i += 2 {
656
- match := matches [i ]
657
- value := matches [i + 1 ]
658
- pty .ExpectMatch (match )
659
-
660
- if value != "" {
661
- pty .WriteLine (value )
662
- }
663
- }
664
- <- doneChan
665
- })
666
-
667
600
t .Run ("ParameterOptionChanged" , func (t * testing.T ) {
668
601
t .Parallel ()
669
602
0 commit comments