Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add confliction withsubdomain#469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
jakehwll merged 13 commits intomainfromjakehwll/conflict-command-subdomain
Nov 29, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
13 commits
Select commitHold shift + click to select a range
00ea9f1
feat: add confliction with `subdomain`
jakehwllNov 24, 2025
31fc7f8
fix: provide correct error
jakehwllNov 24, 2025
0619061
feat: implement testing suite
jakehwllNov 24, 2025
3d63e36
chore: remove unnecessary test suite
jakehwllNov 24, 2025
e1377f5
fix: resolve `app.md` lint
jakehwllNov 24, 2025
7fec6cf
chore: resolve `app.go` description
jakehwllNov 24, 2025
291d926
Revert "chore: remove unnecessary test suite"
jakehwllNov 24, 2025
ea9ea65
chore: remove unused comments
jakehwllNov 24, 2025
5c3e18c
chore: rename `Command` to `ConflictsWith`
jakehwllNov 24, 2025
63c5cdc
feat: implement extensive test case
jakehwllNov 24, 2025
0750f37
fix: convert to using dummy values
jakehwllNov 24, 2025
1f0ced1
chore: remove duplicate testcase
jakehwllNov 29, 2025
c536b4b
chore: update wording to `Conflicts with subdomain.`
jakehwllNov 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletiondocs/resources/app.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -61,7 +61,7 @@ resource "coder_app" "vim" {

### Optional

- `command` (String) A command to run in a terminal opening this app. In the web, this will open in a new tab. In the CLI, this will SSH and execute the command. Either `command` or `url` may be specified, but not both.
- `command` (String) A command to run in a terminal opening this app. In the web, this will open in a new tab. In the CLI, this will SSH and execute the command. Either `command` or `url` may be specified, but not both. Conflicts with `subdomain`.
- `display_name` (String) A display name to identify the app. Defaults to the slug.
- `external` (Boolean) Specifies whether `url` is opened on the client machine instead of proxied through the workspace.
- `group` (String) The name of a group that this app belongs to.
Expand Down
5 changes: 3 additions & 2 deletionsprovider/app.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -85,8 +85,9 @@ func appResource() *schema.Resource {
Type: schema.TypeString,
Description: "A command to run in a terminal opening this app. In the web, " +
"this will open in a new tab. In the CLI, this will SSH and execute the command. " +
"Either `command` or `url` may be specified, but not both.",
ConflictsWith: []string{"url"},
"Either `command` or `url` may be specified, but not both. " +
"Conflicts with `subdomain`.",
ConflictsWith: []string{"url", "subdomain"},
Optional: true,
ForceNew: true,
},
Expand Down
150 changes: 129 additions & 21 deletionsprovider/app_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -109,25 +109,6 @@ func TestApp(t *testing.T) {
}
`,
external: true,
}, {
name: "ConflictsWithSubdomain",
config: `
provider "coder" {}
resource "coder_agent" "dev" {
os = "linux"
arch = "amd64"
}
resource "coder_app" "test" {
agent_id = coder_agent.dev.id
slug = "test"
display_name = "Testing"
url = "https://google.com"
external = true
subdomain = true
open_in = "slim-window"
}
`,
expectError: regexp.MustCompile("conflicts with subdomain"),
}}
for _, tc := range cases {
tc := tc
Expand DownExpand Up@@ -564,8 +545,6 @@ func TestApp(t *testing.T) {
}

for _, c := range cases {
c := c

t.Run(c.name, func(t *testing.T) {
t.Parallel()

Expand DownExpand Up@@ -596,4 +575,133 @@ func TestApp(t *testing.T) {
})
}
})

t.Run("ConflictsWith", func(t *testing.T) {
t.Parallel()

type healthcheck struct {
url string
interval int
threshold int
}

dummyURL := "https://google.com"
dummyCommand := "read -p \\\"Workspace spawned. Press enter to continue...\\\""
dummyExternal := true
dummySubdomain := true
dummyHealthcheck := healthcheck{
url: "https://google.com",
interval: 5,
threshold: 6,
}
dummyShare := "owner"

cases := []struct {
name string
url string
command string
subdomain bool
healthcheck healthcheck
external bool
share string
expectError *regexp.Regexp
}{
{
name: "CommandAndSubdomain",
command: dummyCommand,
subdomain: dummySubdomain,
expectError: regexp.MustCompile("conflicts with subdomain"),
},
{
name: "URLAndCommand",
url: dummyURL,
command: dummyCommand,
expectError: regexp.MustCompile("conflicts with command"),
},
{
name: "HealthcheckAndCommand",
healthcheck: dummyHealthcheck,
command: dummyCommand,
expectError: regexp.MustCompile("conflicts with command"),
},
{
name: "ExternalAndHealthcheck",
external: dummyExternal,
healthcheck: dummyHealthcheck,
expectError: regexp.MustCompile("conflicts with healthcheck"),
},
{
name: "ExternalAndCommand",
external: dummyExternal,
command: dummyCommand,
expectError: regexp.MustCompile("conflicts with command"),
},
{
name: "ExternalAndSubdomain",
external: dummyExternal,
subdomain: dummySubdomain,
expectError: regexp.MustCompile("conflicts with subdomain"),
},
{
name: "ExternalAndShare",
external: dummyExternal,
share: dummyShare,
expectError: regexp.MustCompile("conflicts with share"),
},
}

for _, c := range cases {
t.Run(c.name, func(t *testing.T) {
t.Parallel()

extraLines := []string{}
if c.command != "" {
extraLines = append(extraLines, fmt.Sprintf("command = %q", c.command))
}
if c.subdomain {
extraLines = append(extraLines, "subdomain = true")
}
if c.external {
extraLines = append(extraLines, "external = true")
}
if c.url != "" {
extraLines = append(extraLines, fmt.Sprintf("url = %q", c.url))
}
if c.healthcheck != (healthcheck{}) {
extraLines = append(extraLines, fmt.Sprintf(`healthcheck {
url = %q
interval = %d
threshold = %d
}`, c.healthcheck.url, c.healthcheck.interval, c.healthcheck.threshold))
}
if c.share != "" {
extraLines = append(extraLines, fmt.Sprintf("share = %q", c.share))
}

config := fmt.Sprintf(`
provider "coder" {}
resource "coder_agent" "dev" {
os = "linux"
arch = "amd64"
}
resource "coder_app" "code-server" {
agent_id = coder_agent.dev.id
slug = "code-server"
display_name = "Testing"
open_in = "slim-window"
%s
}
`, strings.Join(extraLines, "\n"))

resource.Test(t, resource.TestCase{
ProviderFactories: coderFactory(),
IsUnitTest: true,
Steps: []resource.TestStep{{
Config: config,
ExpectError: c.expectError,
}},
})
})
}
})
}

[8]ページ先頭

©2009-2025 Movatter.jp