Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correct NewProtocol6ProviderServerWithError to match the sdkv2 defini… #303

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/303.txt
@@ -0,0 +1,3 @@
```release-note:bug
tfsdk: Correct `NewProtocol6ProviderServerWithError` function signature to align to sdk v2 `TestCase.ProtoV6ProviderFactories`
```
8 changes: 4 additions & 4 deletions tfsdk/serve.go
Expand Up @@ -50,12 +50,12 @@ func NewProtocol6ProviderServer(p Provider) func() tfprotov6.ProviderServer {
// acceptance testing helper/resource.TestCase.ProtoV6ProviderFactories.
//
// The error return is not currently used, but it may be in the future.
func NewProtocol6ProviderServerWithError(p Provider) (func() tfprotov6.ProviderServer, error) {
return func() tfprotov6.ProviderServer {
func NewProtocol6ProviderServerWithError(p Provider) func() (tfprotov6.ProviderServer, error) {
return func() (tfprotov6.ProviderServer, error) {
return &server{
p: p,
}
}, nil
}, nil
}
}

// Serve serves a provider, blocking until the context is canceled.
Expand Down
4 changes: 1 addition & 3 deletions tfsdk/serve_test.go
Expand Up @@ -33,14 +33,12 @@ func TestNewProtocol6ProviderServer(t *testing.T) {
func TestNewProtocol6ProviderServerWithError(t *testing.T) {
provider := &testServeProvider{}

providerServerFunc, err := NewProtocol6ProviderServerWithError(provider)
providerServer, err := NewProtocol6ProviderServerWithError(provider)()

if err != nil {
t.Fatalf("unexpected error creating ProviderServer: %s", err)
}

providerServer := providerServerFunc()

// Simple verification
_, err = providerServer.GetProviderSchema(context.Background(), &tfprotov6.GetProviderSchemaRequest{})

Expand Down