-
Notifications
You must be signed in to change notification settings - Fork 100
Expand file tree
/
Copy pathproviderserver_test.go
More file actions
72 lines (52 loc) · 1.85 KB
/
providerserver_test.go
File metadata and controls
72 lines (52 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package providerserver
import (
"context"
"testing"
"github.com/hashicorp/terraform-plugin-framework/internal/testing/testprovider"
"github.com/hashicorp/terraform-plugin-go/tfprotov5"
"github.com/hashicorp/terraform-plugin-go/tfprotov6"
)
func TestNewProtocol5(t *testing.T) {
provider := &testprovider.Provider{}
providerServerFunc := NewProtocol5(provider)
providerServer := providerServerFunc()
// Simple verification
_, err := providerServer.GetProviderSchema(context.Background(), &tfprotov5.GetProviderSchemaRequest{})
if err != nil {
t.Fatalf("unexpected error calling ProviderServer: %s", err)
}
}
func TestNewProtocol5WithError(t *testing.T) {
provider := &testprovider.Provider{}
providerServer, err := NewProtocol5WithError(provider)()
if err != nil {
t.Fatalf("unexpected error creating ProviderServer: %s", err)
}
// Simple verification
_, err = providerServer.GetProviderSchema(context.Background(), &tfprotov5.GetProviderSchemaRequest{})
if err != nil {
t.Fatalf("unexpected error calling ProviderServer: %s", err)
}
}
func TestNewProtocol6(t *testing.T) {
provider := &testprovider.Provider{}
providerServerFunc := NewProtocol6(provider)
providerServer := providerServerFunc()
// Simple verification
_, err := providerServer.GetProviderSchema(context.Background(), &tfprotov6.GetProviderSchemaRequest{})
if err != nil {
t.Fatalf("unexpected error calling ProviderServer: %s", err)
}
}
func TestNewProtocol6WithError(t *testing.T) {
provider := &testprovider.Provider{}
providerServer, err := NewProtocol6WithError(provider)()
if err != nil {
t.Fatalf("unexpected error creating ProviderServer: %s", err)
}
// Simple verification
_, err = providerServer.GetProviderSchema(context.Background(), &tfprotov6.GetProviderSchemaRequest{})
if err != nil {
t.Fatalf("unexpected error calling ProviderServer: %s", err)
}
}