@@ -787,75 +787,6 @@ func TestTemplatePush(t *testing.T) {
787
787
assert .Equal (t , defaultTTL .Milliseconds (), updated .DefaultTTLMillis )
788
788
assert .Equal (t , allowUserCancelWorkspaceJobs , updated .AllowUserCancelWorkspaceJobs )
789
789
})
790
-
791
- t .Run ("EditMetadataNoSideEffects" , func (t * testing.T ) {
792
- t .Parallel ()
793
- client := coderdtest .New (t , & coderdtest.Options {IncludeProvisionerDaemon : true })
794
- owner := coderdtest .CreateFirstUser (t , client )
795
- templateAdmin , _ := coderdtest .CreateAnotherUser (t , client , owner .OrganizationID , rbac .RoleTemplateAdmin ())
796
- version := coderdtest .CreateTemplateVersion (t , client , owner .OrganizationID , nil )
797
- _ = coderdtest .AwaitTemplateVersionJobCompleted (t , client , version .ID )
798
-
799
- template := coderdtest .CreateTemplate (t , client , owner .OrganizationID , version .ID )
800
-
801
- // Test the cli command.
802
- source := clitest .CreateTemplateVersionSource (t , & echo.Responses {
803
- Parse : echo .ParseComplete ,
804
- ProvisionApply : echo .ApplyComplete ,
805
- })
806
-
807
- desc := "lorem ipsum dolor sit amet et cetera"
808
-
809
- inv , root := clitest .New (t ,
810
- "templates" ,
811
- "push" ,
812
- template .Name ,
813
- "--directory" , source ,
814
- "--test.provisioner" , string (database .ProvisionerTypeEcho ),
815
- "--description" , desc ,
816
- )
817
- clitest .SetupConfig (t , templateAdmin , root )
818
- pty := ptytest .New (t ).Attach (inv )
819
-
820
- execDone := make (chan error )
821
- go func () {
822
- execDone <- inv .Run ()
823
- }()
824
-
825
- matches := []struct {
826
- match string
827
- write string
828
- }{
829
- {match : "Upload" , write : "yes" },
830
- }
831
- for _ , m := range matches {
832
- pty .ExpectMatch (m .match )
833
- pty .WriteLine (m .write )
834
- }
835
-
836
- require .NoError (t , <- execDone )
837
-
838
- // Assert that the template version changed.
839
- templateVersions , err := client .TemplateVersionsByTemplate (context .Background (), codersdk.TemplateVersionsByTemplateRequest {
840
- TemplateID : template .ID ,
841
- })
842
- require .NoError (t , err )
843
- assert .Len (t , templateVersions , 2 )
844
- assert .NotEqual (t , template .ActiveVersionID , templateVersions [1 ].ID )
845
-
846
- // Assert that the template metadata changed.
847
- updated , err := client .Template (context .Background (), template .ID )
848
- require .NoError (t , err )
849
- // Changed
850
- assert .Equal (t , desc , updated .Description )
851
-
852
- // Should not change
853
- assert .Equal (t , template .Name , updated .Name )
854
- assert .Equal (t , template .DisplayName , updated .DisplayName )
855
- assert .Equal (t , template .Icon , updated .Icon )
856
- assert .Equal (t , template .DefaultTTLMillis , updated .DefaultTTLMillis )
857
- assert .Equal (t , template .AllowUserCancelWorkspaceJobs , updated .AllowUserCancelWorkspaceJobs )
858
- })
859
790
}
860
791
861
792
func createEchoResponsesWithTemplateVariables (templateVariables []* proto.TemplateVariable ) * echo.Responses {
0 commit comments