Skip to content

Commit 00ea9f1

Browse files
committed
feat: add confliction with subdomain
1 parent c822a5f commit 00ea9f1

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

provider/app.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ func appResource() *schema.Resource {
8585
Type: schema.TypeString,
8686
Description: "A command to run in a terminal opening this app. In the web, " +
8787
"this will open in a new tab. In the CLI, this will SSH and execute the command. " +
88-
"Either `command` or `url` may be specified, but not both.",
89-
ConflictsWith: []string{"url"},
88+
"Either `command` or `url` may be specified, but not both." +
89+
"If `command` is specified, `subdomain` must either be false or not specified.",
90+
ConflictsWith: []string{"url", "subdomain"},
9091
Optional: true,
9192
ForceNew: true,
9293
},

provider/app_test.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,4 +596,36 @@ func TestApp(t *testing.T) {
596596
})
597597
}
598598
})
599+
600+
// TODO: Find a better place for this?
601+
// TODO: Do we need to test this with the schema rules already existing?
602+
t.Run("Command", func(t *testing.T) {
603+
t.Parallel()
604+
605+
cases := []struct {
606+
name string
607+
command string
608+
subdomain bool
609+
expectError *regexp.Regexp
610+
}{
611+
{
612+
name: "Command",
613+
command: "read -p \"Workspace spawned. Press enter to continue...\"",
614+
},
615+
{
616+
name: "CommandAndURL",
617+
command: "read -p \"Workspace spawned. Press enter to continue...\"",
618+
subdomain: true,
619+
expectError: regexp.MustCompile("conflicts with subdomain"),
620+
},
621+
}
622+
623+
for _, c := range cases {
624+
c := c
625+
626+
t.Run(c.name, func(t *testing.T) {
627+
t.Parallel()
628+
})
629+
}
630+
})
599631
}

0 commit comments

Comments
 (0)