Skip to content

Commit 0619061

Browse files
committed
feat: implement testing suite
1 parent 31fc7f8 commit 0619061

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

provider/app_test.go

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,11 +610,11 @@ func TestApp(t *testing.T) {
610610
}{
611611
{
612612
name: "Command",
613-
command: "read -p \"Workspace spawned. Press enter to continue...\"",
613+
command: "read -p \\\"Workspace spawned. Press enter to continue...\\\"",
614614
},
615615
{
616616
name: "CommandAndURL",
617-
command: "read -p \"Workspace spawned. Press enter to continue...\"",
617+
command: "read -p \\\"Workspace spawned. Press enter to continue...\\\"",
618618
subdomain: true,
619619
expectError: regexp.MustCompile("conflicts with subdomain"),
620620
},
@@ -625,6 +625,36 @@ func TestApp(t *testing.T) {
625625

626626
t.Run(c.name, func(t *testing.T) {
627627
t.Parallel()
628+
629+
subdomainLine := ""
630+
if c.subdomain {
631+
subdomainLine = "subdomain = true"
632+
}
633+
634+
config := fmt.Sprintf(`
635+
provider "coder" {}
636+
resource "coder_agent" "dev" {
637+
os = "linux"
638+
arch = "amd64"
639+
}
640+
resource "coder_app" "code-server" {
641+
agent_id = coder_agent.dev.id
642+
slug = "code-server"
643+
display_name = "Testing"
644+
open_in = "slim-window"
645+
command = "%s"
646+
%s
647+
}
648+
`, c.command, subdomainLine)
649+
650+
resource.Test(t, resource.TestCase{
651+
ProviderFactories: coderFactory(),
652+
IsUnitTest: true,
653+
Steps: []resource.TestStep{{
654+
Config: config,
655+
ExpectError: c.expectError,
656+
}},
657+
})
628658
})
629659
}
630660
})

0 commit comments

Comments
 (0)