hashicorp / terraform-plugin-go

A low-level Go binding for the Terraform protocol for integrations to be built on top of.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consider Unit Testing tf5server/tf6server ServeOpt to ServeConfig Conversion

bflad opened this issue · comments

terraform-plugin-go version

v0.7.0

Use cases

The Serve functions of tfprotov5/tf5server and tfprotov6/tf6server introduce non-trivial conversion of ServeOpt into the ServeConfig and go-plugin plugin.ServeConfig, which is not currently unit tested. To prevent regressions, unit testing should be introduced with any necessary refactoring.

Proposal

Potentially refactor the server configuration preparation of Serve into its own function, then introduce unit testing against that logic.

Another option may be to refactor out ServeConfig usage, which currently implements unexported fields.

References