@@ -564,8 +564,6 @@ func TestApp(t *testing.T) {
564564}
565565
566566for _ ,c := range cases {
567- c := c
568-
569567t .Run (c .name ,func (t * testing.T ) {
570568t .Parallel ()
571569
@@ -600,33 +598,100 @@ func TestApp(t *testing.T) {
600598t .Run ("ConflictsWith" ,func (t * testing.T ) {
601599t .Parallel ()
602600
601+ type healthcheck struct {
602+ url string
603+ interval int
604+ threshold int
605+ }
606+
603607cases := []struct {
604608name string
609+ url string
605610command string
606611subdomain bool
612+ healthcheck healthcheck
613+ external bool
614+ share string
607615expectError * regexp.Regexp
608616}{
609617{
610- name :"Command" ,
611- command :"read -p\\ \" Workspace spawned. Press enter to continue...\\ \" " ,
618+ name :"CommandAndSubdomain" ,
619+ command :"read -p\\ \" Workspace spawned. Press enter to continue...\\ \" " ,
620+ subdomain :true ,
621+ expectError :regexp .MustCompile ("conflicts with subdomain" ),
612622},
613623{
614- name :"CommandAndURL" ,
624+ name :"URLAndCommand" ,
625+ url :"https://google.com" ,
615626command :"read -p\\ \" Workspace spawned. Press enter to continue...\\ \" " ,
627+ expectError :regexp .MustCompile ("conflicts with command" ),
628+ },
629+ {
630+ name :"HealthcheckAndCommand" ,
631+ healthcheck :healthcheck {
632+ url :"https://google.com" ,
633+ interval :5 ,
634+ threshold :6 ,
635+ },
636+ command :"read -p\\ \" Workspace spawned. Press enter to continue...\\ \" " ,
637+ expectError :regexp .MustCompile ("conflicts with command" ),
638+ },
639+ {
640+ name :"ExternalAndHealthcheck" ,
641+ external :true ,
642+ healthcheck :healthcheck {
643+ url :"https://google.com" ,
644+ interval :5 ,
645+ threshold :6 ,
646+ },
647+ expectError :regexp .MustCompile ("conflicts with healthcheck" ),
648+ },
649+ {
650+ name :"ExternalAndCommand" ,
651+ external :true ,
652+ command :"read -p\\ \" Workspace spawned. Press enter to continue...\\ \" " ,
653+ expectError :regexp .MustCompile ("conflicts with command" ),
654+ },
655+ {
656+ name :"ExternalAndSubdomain" ,
657+ external :true ,
616658subdomain :true ,
617659expectError :regexp .MustCompile ("conflicts with subdomain" ),
618660},
661+ {
662+ name :"ExternalAndShare" ,
663+ external :true ,
664+ share :"https://google.com" ,
665+ expectError :regexp .MustCompile ("conflicts with share" ),
666+ },
619667}
620668
621669for _ ,c := range cases {
622- c := c
623-
624670t .Run (c .name ,func (t * testing.T ) {
625671t .Parallel ()
626672
627- subdomainLine := ""
673+ extraLines := []string {}
674+ if c .command != "" {
675+ extraLines = append (extraLines ,fmt .Sprintf ("command = %q" ,c .command ))
676+ }
628677if c .subdomain {
629- subdomainLine = "subdomain = true"
678+ extraLines = append (extraLines ,"subdomain = true" )
679+ }
680+ if c .external {
681+ extraLines = append (extraLines ,"external = true" )
682+ }
683+ if c .url != "" {
684+ extraLines = append (extraLines ,fmt .Sprintf ("url = %q" ,c .url ))
685+ }
686+ if c .healthcheck != (healthcheck {}) {
687+ extraLines = append (extraLines ,fmt .Sprintf (`healthcheck {
688+ url = %q
689+ interval = %d
690+ threshold = %d
691+ }` ,c .healthcheck .url ,c .healthcheck .interval ,c .healthcheck .threshold ))
692+ }
693+ if c .share != "" {
694+ extraLines = append (extraLines ,fmt .Sprintf ("share = %q" ,c .share ))
630695}
631696
632697config := fmt .Sprintf (`
@@ -640,10 +705,9 @@ func TestApp(t *testing.T) {
640705slug = "code-server"
641706display_name = "Testing"
642707open_in = "slim-window"
643- command = "%s"
644708%s
645709}
646- ` ,c . command , subdomainLine )
710+ ` ,strings . Join ( extraLines , " \n " ) )
647711
648712resource .Test (t , resource.TestCase {
649713ProviderFactories :coderFactory (),