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

Commit8fa0fbf

Browse files
authored
fix: add test case to validate empty provider (#206)
1 parent3cc9802 commit8fa0fbf

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

‎provider/provider_test.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ package provider_test
33
import (
44
"testing"
55

6+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
7+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
8+
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
69
"github.com/stretchr/testify/require"
710

811
"github.com/coder/terraform-provider-coder/provider"
@@ -14,3 +17,34 @@ func TestProvider(t *testing.T) {
1417
err:=tfProvider.InternalValidate()
1518
require.NoError(t,err)
1619
}
20+
21+
// TestProviderEmpty ensures that the provider can be configured without
22+
// any actual input data. This is important for adding new fields
23+
// with backwards compatibility guarantees.
24+
funcTestProviderEmpty(t*testing.T) {
25+
t.Parallel()
26+
resource.Test(t, resource.TestCase{
27+
Providers:map[string]*schema.Provider{
28+
"coder":provider.New(),
29+
},
30+
IsUnitTest:true,
31+
Steps: []resource.TestStep{{
32+
Config:`
33+
provider "coder" {}
34+
data "coder_provisioner" "me" {}
35+
data "coder_workspace" "me" {}
36+
data "coder_external_auth" "git" {
37+
id = "git"
38+
}
39+
data "coder_git_auth" "git" {
40+
id = "git"
41+
}
42+
data "coder_parameter" "param" {
43+
name = "hey"
44+
}`,
45+
Check:func(state*terraform.State)error {
46+
returnnil
47+
},
48+
}},
49+
})
50+
}

‎provider/provisioner_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
)
1313

1414
funcTestProvisioner(t*testing.T) {
15+
t.Parallel()
1516
resource.Test(t, resource.TestCase{
1617
Providers:map[string]*schema.Provider{
1718
"coder":provider.New(),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp