99
1010 "github.com/google/go-cmp/cmp"
1111 "github.com/hashicorp/terraform-plugin-go/tfprotov5"
12- "github.com/hashicorp/terraform-plugin-go/tftypes"
1312
1413 "github.com/hashicorp/terraform-plugin-framework/diag"
1514 "github.com/hashicorp/terraform-plugin-framework/ephemeral"
@@ -18,28 +17,11 @@ import (
1817 "github.com/hashicorp/terraform-plugin-framework/internal/fwschema"
1918 "github.com/hashicorp/terraform-plugin-framework/internal/fwserver"
2019 "github.com/hashicorp/terraform-plugin-framework/internal/privatestate"
21- "github.com/hashicorp/terraform-plugin-framework/tfsdk"
2220)
2321
2422func TestCloseEphemeralResourceRequest (t * testing.T ) {
2523 t .Parallel ()
2624
27- testProto5Type := tftypes.Object {
28- AttributeTypes : map [string ]tftypes.Type {
29- "test_attribute" : tftypes .String ,
30- },
31- }
32-
33- testProto5Value := tftypes .NewValue (testProto5Type , map [string ]tftypes.Value {
34- "test_attribute" : tftypes .NewValue (tftypes .String , "test-value" ),
35- })
36-
37- testProto5DynamicValue , err := tfprotov5 .NewDynamicValue (testProto5Type , testProto5Value )
38-
39- if err != nil {
40- t .Fatalf ("unexpected error calling tfprotov5.NewDynamicValue(): %s" , err )
41- }
42-
4325 testFwSchema := schema.Schema {
4426 Attributes : map [string ]schema.Attribute {
4527 "test_attribute" : schema.StringAttribute {
@@ -97,34 +79,6 @@ func TestCloseEphemeralResourceRequest(t *testing.T) {
9779 EphemeralResourceSchema : testFwSchema ,
9880 },
9981 },
100- "state-missing-schema" : {
101- input : & tfprotov5.CloseEphemeralResourceRequest {
102- State : & testProto5DynamicValue ,
103- },
104- expected : nil ,
105- expectedDiagnostics : diag.Diagnostics {
106- diag .NewErrorDiagnostic (
107- "Missing EphemeralResource Schema" ,
108- "An unexpected error was encountered when handling the request. " +
109- "This is always an issue in terraform-plugin-framework used to implement the provider and should be reported to the provider developers.\n \n " +
110- "Please report this to the provider developer:\n \n " +
111- "Missing schema." ,
112- ),
113- },
114- },
115- "state" : {
116- input : & tfprotov5.CloseEphemeralResourceRequest {
117- State : & testProto5DynamicValue ,
118- },
119- ephemeralResourceSchema : testFwSchema ,
120- expected : & fwserver.CloseEphemeralResourceRequest {
121- State : & tfsdk.EphemeralState {
122- Raw : testProto5Value ,
123- Schema : testFwSchema ,
124- },
125- EphemeralResourceSchema : testFwSchema ,
126- },
127- },
12882 }
12983
13084 for name , testCase := range testCases {
0 commit comments