Skip to content

Commit

Permalink
tfsdk: correct NewProtocol6ProviderServerWithError to match the sdkv2…
Browse files Browse the repository at this point in the history
… definition for ProtoV6ProviderFactories (#303)
  • Loading branch information
iwarapter committed Apr 25, 2022
1 parent 6e12435 commit 11730ba
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
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

0 comments on commit 11730ba

Please sign in to comment.