Skip to content

Commit 2cf755b

Browse files
authored
Merge pull request #4 from pulumi/pgavlin/test-cleanup
2 parents 59d2425 + 0d2bcbf commit 2cf755b

File tree

4 files changed

+1
-165
lines changed

4 files changed

+1
-165
lines changed

helper/resource/testing_new_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,6 @@ func TestShimState(t *testing.T) {
10861086
for i, tc := range testCases {
10871087
t.Run(fmt.Sprintf("%d-%s", i, tc.Name), func(t *testing.T) {
10881088
var rawState tfjson.State
1089-
rawState.UseJSONNumber(true)
10901089

10911090
err := json.Unmarshal([]byte(tc.RawState), &rawState)
10921091
if err != nil {

helper/schema/grpc_provider_test.go

Lines changed: 0 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -688,121 +688,6 @@ func TestApplyResourceChange(t *testing.T) {
688688
}
689689
}
690690

691-
func TestApplyResourceChange_bigint(t *testing.T) {
692-
testCases := []struct {
693-
Description string
694-
TestResource *Resource
695-
}{
696-
{
697-
Description: "Create",
698-
TestResource: &Resource{
699-
UseJSONNumber: true,
700-
Schema: map[string]*Schema{
701-
"foo": {
702-
Type: TypeInt,
703-
Required: true,
704-
},
705-
},
706-
Create: func(rd *ResourceData, _ interface{}) error {
707-
rd.SetId("bar")
708-
return nil
709-
},
710-
},
711-
},
712-
{
713-
Description: "CreateContext",
714-
TestResource: &Resource{
715-
UseJSONNumber: true,
716-
Schema: map[string]*Schema{
717-
"foo": {
718-
Type: TypeInt,
719-
Required: true,
720-
},
721-
},
722-
CreateContext: func(_ context.Context, rd *ResourceData, _ interface{}) diag.Diagnostics {
723-
rd.SetId("bar")
724-
return nil
725-
},
726-
},
727-
},
728-
{
729-
Description: "CreateWithoutTimeout",
730-
TestResource: &Resource{
731-
UseJSONNumber: true,
732-
Schema: map[string]*Schema{
733-
"foo": {
734-
Type: TypeInt,
735-
Required: true,
736-
},
737-
},
738-
CreateWithoutTimeout: func(_ context.Context, rd *ResourceData, _ interface{}) diag.Diagnostics {
739-
rd.SetId("bar")
740-
return nil
741-
},
742-
},
743-
},
744-
}
745-
746-
for _, testCase := range testCases {
747-
testCase := testCase
748-
t.Run(testCase.Description, func(t *testing.T) {
749-
server := NewGRPCProviderServer(&Provider{
750-
ResourcesMap: map[string]*Resource{
751-
"test": testCase.TestResource,
752-
},
753-
})
754-
755-
schema := testCase.TestResource.CoreConfigSchema()
756-
priorState, err := msgpack.Marshal(cty.NullVal(schema.ImpliedType()), schema.ImpliedType())
757-
if err != nil {
758-
t.Fatal(err)
759-
}
760-
761-
plannedVal := cty.ObjectVal(map[string]cty.Value{
762-
"id": cty.UnknownVal(cty.String),
763-
"foo": cty.MustParseNumberVal("7227701560655103598"),
764-
})
765-
plannedState, err := msgpack.Marshal(plannedVal, schema.ImpliedType())
766-
if err != nil {
767-
t.Fatal(err)
768-
}
769-
770-
testReq := &tfprotov5.ApplyResourceChangeRequest{
771-
TypeName: "test",
772-
PriorState: &tfprotov5.DynamicValue{
773-
MsgPack: priorState,
774-
},
775-
PlannedState: &tfprotov5.DynamicValue{
776-
MsgPack: plannedState,
777-
},
778-
}
779-
780-
resp, err := server.ApplyResourceChange(context.Background(), testReq)
781-
if err != nil {
782-
t.Fatal(err)
783-
}
784-
785-
newStateVal, err := msgpack.Unmarshal(resp.NewState.MsgPack, schema.ImpliedType())
786-
if err != nil {
787-
t.Fatal(err)
788-
}
789-
790-
id := newStateVal.GetAttr("id").AsString()
791-
if id != "bar" {
792-
t.Fatalf("incorrect final state: %#v\n", newStateVal)
793-
}
794-
795-
foo, acc := newStateVal.GetAttr("foo").AsBigFloat().Int64()
796-
if acc != big.Exact {
797-
t.Fatalf("Expected exact accuracy, got %s", acc)
798-
}
799-
if foo != 7227701560655103598 {
800-
t.Fatalf("Expected %d, got %d, this represents a loss of precision in applying large numbers", 7227701560655103598, foo)
801-
}
802-
})
803-
}
804-
}
805-
806691
func TestPrepareProviderConfig(t *testing.T) {
807692
for _, tc := range []struct {
808693
Name string

helper/schema/provider_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ func TestProviderDiff_timeoutInvalidValue(t *testing.T) {
566566
if err == nil {
567567
t.Fatal("Expected provider.Diff to fail with invalid timeout value")
568568
}
569-
expectedErrMsg := "time: invalid duration invalid"
569+
expectedErrMsg := "time: invalid duration \"invalid\""
570570
if !strings.Contains(err.Error(), expectedErrMsg) {
571571
t.Fatalf("Unexpected error message: %q\nExpected message to contain %q",
572572
err.Error(),

internal/tfdiags/rpc_friendly_test.go

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)