Skip to content

Commit 34ec361

Browse files
committed
internal: Implement fwserver PlanResourceChange testing and update proto6server testing
Reference: #215 Also removes the placeholder `internal/testing/emptyprovider` implementation in preference of the fully built out declarative one in `internal/testing/testprovider`. At this point we should hopefully feel pretty confident in the framework and protocol version 6 server unit testing focusing on their logic and data handoffs to other functions/methods. This also means we should be in a good spot to create a protocol version 5 implementation, very similar to the protocol version 6 implementation.
1 parent acdf2d7 commit 34ec361

21 files changed

+2397
-2847
lines changed

internal/fwserver/attribute_plan_modification.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
// TODO: Clean up this abstraction back into an internal Attribute type method.
1515
// The extra Attribute parameter is a carry-over of creating the proto6server
1616
// package from the tfsdk package and not wanting to export the method.
17-
// Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/215
17+
// Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/365
1818
func AttributeModifyPlan(ctx context.Context, a tfsdk.Attribute, req tfsdk.ModifyAttributePlanRequest, resp *ModifySchemaPlanResponse) {
1919
ctx = logging.FrameworkWithAttributePath(ctx, req.AttributePath.String())
2020

internal/fwserver/attribute_validation.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
// TODO: Clean up this abstraction back into an internal Attribute type method.
1515
// The extra Attribute parameter is a carry-over of creating the proto6server
1616
// package from the tfsdk package and not wanting to export the method.
17-
// Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/215
17+
// Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/365
1818
func AttributeValidate(ctx context.Context, a tfsdk.Attribute, req tfsdk.ValidateAttributeRequest, resp *tfsdk.ValidateAttributeResponse) {
1919
ctx = logging.FrameworkWithAttributePath(ctx, req.AttributePath.String())
2020

@@ -104,7 +104,7 @@ func AttributeValidate(ctx context.Context, a tfsdk.Attribute, req tfsdk.Validat
104104
// TODO: Clean up this abstraction back into an internal Attribute type method.
105105
// The extra Attribute parameter is a carry-over of creating the proto6server
106106
// package from the tfsdk package and not wanting to export the method.
107-
// Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/215
107+
// Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/365
108108
func AttributeValidateNestedAttributes(ctx context.Context, a tfsdk.Attribute, req tfsdk.ValidateAttributeRequest, resp *tfsdk.ValidateAttributeResponse) {
109109
if a.Attributes == nil || len(a.Attributes.GetAttributes()) == 0 {
110110
return

internal/fwserver/block_plan_modification.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
// TODO: Clean up this abstraction back into an internal Block type method.
1414
// The extra Block parameter is a carry-over of creating the proto6server
1515
// package from the tfsdk package and not wanting to export the method.
16-
// Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/215
16+
// Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/365
1717
func BlockModifyPlan(ctx context.Context, b tfsdk.Block, req tfsdk.ModifyAttributePlanRequest, resp *ModifySchemaPlanResponse) {
1818
attributeConfig, diags := ConfigGetAttributeValue(ctx, req.Config, req.AttributePath)
1919
resp.Diagnostics.Append(diags...)

internal/fwserver/block_validation.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
// TODO: Clean up this abstraction back into an internal Block type method.
1414
// The extra Block parameter is a carry-over of creating the proto6server
1515
// package from the tfsdk package and not wanting to export the method.
16-
// Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/215
16+
// Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/365
1717
func BlockValidate(ctx context.Context, b tfsdk.Block, req tfsdk.ValidateAttributeRequest, resp *tfsdk.ValidateAttributeResponse) {
1818
attributeConfig, diags := ConfigGetAttributeValue(ctx, req.Config, req.AttributePath)
1919
resp.Diagnostics.Append(diags...)

internal/fwserver/config.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
// TODO: Clean up this abstraction back into an internal Config type method.
2222
// The extra Config parameter is a carry-over of creating the proto6server
2323
// package from the tfsdk package and not wanting to export the method.
24-
// Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/215
24+
// Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/366
2525
func ConfigGetAttributeValue(ctx context.Context, c tfsdk.Config, path *tftypes.AttributePath) (attr.Value, diag.Diagnostics) {
2626
var diags diag.Diagnostics
2727

@@ -88,7 +88,7 @@ func ConfigGetAttributeValue(ctx context.Context, c tfsdk.Config, path *tftypes.
8888
// TODO: Clean up this abstraction back into an internal Config type method.
8989
// The extra Config parameter is a carry-over of creating the proto6server
9090
// package from the tfsdk package and not wanting to export the method.
91-
// Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/215
91+
// Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/366
9292
func ConfigTerraformValueAtPath(c tfsdk.Config, path *tftypes.AttributePath) (tftypes.Value, error) {
9393
rawValue, remaining, err := tftypes.WalkAttributePath(c.Raw, path)
9494
if err != nil {

internal/fwserver/plan.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
// TODO: Clean up this abstraction back into an internal Plan type method.
2222
// The extra Plan parameter is a carry-over of creating the proto6server
2323
// package from the tfsdk package and not wanting to export the method.
24-
// Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/215
24+
// Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/366
2525
func PlanGetAttributeValue(ctx context.Context, p tfsdk.Plan, path *tftypes.AttributePath) (attr.Value, diag.Diagnostics) {
2626
var diags diag.Diagnostics
2727

@@ -88,7 +88,7 @@ func PlanGetAttributeValue(ctx context.Context, p tfsdk.Plan, path *tftypes.Attr
8888
// TODO: Clean up this abstraction back into an internal Plan type method.
8989
// The extra Plan parameter is a carry-over of creating the proto6server
9090
// package from the tfsdk package and not wanting to export the method.
91-
// Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/215
91+
// Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/366
9292
func PlanTerraformValueAtPath(p tfsdk.Plan, path *tftypes.AttributePath) (tftypes.Value, error) {
9393
rawValue, remaining, err := tftypes.WalkAttributePath(p.Raw, path)
9494
if err != nil {

internal/fwserver/schema.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
// TODO: Clean up this abstraction back into an internal Schema type method.
1515
// The extra Schema parameter is a carry-over of creating the proto6server
1616
// package from the tfsdk package and not wanting to export the method.
17-
// Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/215
17+
// Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/365
1818
func SchemaBlockAtPath(s tfsdk.Schema, path *tftypes.AttributePath) (tfsdk.Block, error) {
1919
res, remaining, err := tftypes.WalkAttributePath(s, path)
2020
if err != nil {

internal/fwserver/schema_plan_modification.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ type ModifySchemaPlanResponse struct {
4747
// TODO: Clean up this abstraction back into an internal Schema type method.
4848
// The extra Schema parameter is a carry-over of creating the proto6server
4949
// package from the tfsdk package and not wanting to export the method.
50-
// Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/215
50+
// Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/365
5151
func SchemaModifyPlan(ctx context.Context, s tfsdk.Schema, req ModifySchemaPlanRequest, resp *ModifySchemaPlanResponse) {
5252
for name, attr := range s.Attributes {
5353
attrReq := tfsdk.ModifyAttributePlanRequest{

internal/fwserver/schema_validation.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ type ValidateSchemaResponse struct {
3131
// TODO: Clean up this abstraction back into an internal Schema type method.
3232
// The extra Schema parameter is a carry-over of creating the proto6server
3333
// package from the tfsdk package and not wanting to export the method.
34-
// Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/215
34+
// Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/365
3535
func SchemaValidate(ctx context.Context, s tfsdk.Schema, req ValidateSchemaRequest, resp *ValidateSchemaResponse) {
3636
for name, attribute := range s.Attributes {
3737

0 commit comments

Comments
 (0)