@@ -502,16 +502,31 @@ func TestFromAttributeValue(t *testing.T) {
502
502
CreatedBy : testtypes.BoolType {},
503
503
},
504
504
},
505
+ "BoolTypable-BoolValue" : {
506
+ typ : testtypes.BoolTypeWithSemanticEquals {},
507
+ val : types .BoolNull (),
508
+ expected : types .BoolNull (),
509
+ },
505
510
"Float64Type-Float64Value" : {
506
511
typ : types .Float64Type ,
507
512
val : types .Float64Null (),
508
513
expected : types .Float64Null (),
509
514
},
515
+ "Float64Typable-Float64Value" : {
516
+ typ : testtypes.Float64TypeWithSemanticEquals {},
517
+ val : types .Float64Null (),
518
+ expected : types .Float64Null (),
519
+ },
510
520
"Int64Type-Int64Value" : {
511
521
typ : types .Int64Type ,
512
522
val : types .Int64Null (),
513
523
expected : types .Int64Null (),
514
524
},
525
+ "Int64Typable-Int64Value" : {
526
+ typ : testtypes.Int64TypeWithSemanticEquals {},
527
+ val : types .Int64Null (),
528
+ expected : types .Int64Null (),
529
+ },
515
530
"ListType-ListValue-matching-elements" : {
516
531
typ : types.ListType {ElemType : types .StringType },
517
532
val : types .ListNull (types .StringType ),
@@ -527,12 +542,19 @@ func TestFromAttributeValue(t *testing.T) {
527
542
"Value Conversion Error" ,
528
543
"An unexpected error was encountered while verifying an attribute value matched its expected type to prevent unexpected behavior or panics. " +
529
544
"This is always an error in the provider. Please report the following to the provider developer:\n \n " +
530
- "Expected type: types.ListType[basetypes.StringType]\n " +
531
- "Value type: types.ListType[basetypes.BoolType]\n " +
545
+ "Expected framework type from provider logic : types.ListType[basetypes.StringType] / underlying type: tftypes.List[tftypes.String ]\n " +
546
+ "Received framework type from provider logic : types.ListType[basetypes.BoolType] / underlying type: tftypes.List[tftypes.Bool ]\n " +
532
547
"Path: test" ,
533
548
),
534
549
},
535
550
},
551
+ "ListTypable-ListValue-matching-elements" : {
552
+ typ : testtypes.ListType {
553
+ ListType : types.ListType {ElemType : types .StringType },
554
+ },
555
+ val : types .ListNull (types .StringType ),
556
+ expected : types .ListNull (types .StringType ),
557
+ },
536
558
"MapType-MapValue-matching-elements" : {
537
559
typ : types.MapType {ElemType : types .StringType },
538
560
val : types .MapNull (types .StringType ),
@@ -548,12 +570,19 @@ func TestFromAttributeValue(t *testing.T) {
548
570
"Value Conversion Error" ,
549
571
"An unexpected error was encountered while verifying an attribute value matched its expected type to prevent unexpected behavior or panics. " +
550
572
"This is always an error in the provider. Please report the following to the provider developer:\n \n " +
551
- "Expected type: types.MapType[basetypes.StringType]\n " +
552
- "Value type: types.MapType[basetypes.BoolType]\n " +
573
+ "Expected framework type from provider logic : types.MapType[basetypes.StringType] / underlying type: tftypes.Map[tftypes.String ]\n " +
574
+ "Received framework type from provider logic : types.MapType[basetypes.BoolType] / underlying type: tftypes.Map[tftypes.Bool ]\n " +
553
575
"Path: test" ,
554
576
),
555
577
},
556
578
},
579
+ "MapTypable-MapValue-matching-elements" : {
580
+ typ : testtypes.MapType {
581
+ MapType : types.MapType {ElemType : types .StringType },
582
+ },
583
+ val : types .MapNull (types .StringType ),
584
+ expected : types .MapNull (types .StringType ),
585
+ },
557
586
"NumberType-NumberValue" : {
558
587
typ : types .NumberType ,
559
588
val : types .NumberNull (),
@@ -568,6 +597,11 @@ func TestFromAttributeValue(t *testing.T) {
568
597
CreatedBy : testtypes.NumberType {},
569
598
},
570
599
},
600
+ "NumberTypable-NumberValue" : {
601
+ typ : testtypes.NumberTypeWithSemanticEquals {},
602
+ val : types .NumberNull (),
603
+ expected : types .NumberNull (),
604
+ },
571
605
"ObjectType-ObjectValue-matching-attributes" : {
572
606
typ : types.ObjectType {AttrTypes : map [string ]attr.Type {"test_attr" : types .StringType }},
573
607
val : types .ObjectNull (map [string ]attr.Type {"test_attr" : types .StringType }),
@@ -583,8 +617,8 @@ func TestFromAttributeValue(t *testing.T) {
583
617
"Value Conversion Error" ,
584
618
"An unexpected error was encountered while verifying an attribute value matched its expected type to prevent unexpected behavior or panics. " +
585
619
"This is always an error in the provider. Please report the following to the provider developer:\n \n " +
586
- "Expected type: types.ObjectType[\" test_attr\" :basetypes.StringType]\n " +
587
- "Value type: types.ObjectType[\" not_test_attr\" :basetypes.StringType]\n " +
620
+ "Expected framework type from provider logic : types.ObjectType[\" test_attr\" :basetypes.StringType] / underlying type: tftypes.Object[ \" test_attr \" :tftypes.String ]\n " +
621
+ "Received framework type from provider logic : types.ObjectType[\" not_test_attr\" :basetypes.StringType] / underlying type: tftypes.Object[ \" not_test_attr \" :tftypes.String ]\n " +
588
622
"Path: test" ,
589
623
),
590
624
},
@@ -599,12 +633,19 @@ func TestFromAttributeValue(t *testing.T) {
599
633
"Value Conversion Error" ,
600
634
"An unexpected error was encountered while verifying an attribute value matched its expected type to prevent unexpected behavior or panics. " +
601
635
"This is always an error in the provider. Please report the following to the provider developer:\n \n " +
602
- "Expected type: types.ObjectType[\" test_attr\" :basetypes.StringType]\n " +
603
- "Value type: types.ObjectType[\" test_attr\" :basetypes.BoolType]\n " +
636
+ "Expected framework type from provider logic : types.ObjectType[\" test_attr\" :basetypes.StringType] / underlying type: tftypes.Object[ \" test_attr \" :tftypes.String ]\n " +
637
+ "Received framework type from provider logic : types.ObjectType[\" test_attr\" :basetypes.BoolType] / underlying type: tftypes.Object[ \" test_attr \" :tftypes.Bool ]\n " +
604
638
"Path: test" ,
605
639
),
606
640
},
607
641
},
642
+ "ObjectTypable-ObjectValue-matching-attributes" : {
643
+ typ : testtypes.ObjectType {
644
+ ObjectType : types.ObjectType {AttrTypes : map [string ]attr.Type {"test_attr" : types .StringType }},
645
+ },
646
+ val : types .ObjectNull (map [string ]attr.Type {"test_attr" : types .StringType }),
647
+ expected : types .ObjectNull (map [string ]attr.Type {"test_attr" : types .StringType }),
648
+ },
608
649
"SetType-SetValue-matching-elements" : {
609
650
typ : types.SetType {ElemType : types .StringType },
610
651
val : types .SetNull (types .StringType ),
@@ -620,12 +661,19 @@ func TestFromAttributeValue(t *testing.T) {
620
661
"Value Conversion Error" ,
621
662
"An unexpected error was encountered while verifying an attribute value matched its expected type to prevent unexpected behavior or panics. " +
622
663
"This is always an error in the provider. Please report the following to the provider developer:\n \n " +
623
- "Expected type: types.SetType[basetypes.StringType]\n " +
624
- "Value type: types.SetType[basetypes.BoolType]\n " +
664
+ "Expected framework type from provider logic : types.SetType[basetypes.StringType] / underlying type: tftypes.Set[tftypes.String ]\n " +
665
+ "Received framework type from provider logic : types.SetType[basetypes.BoolType] / underlying type: tftypes.Set[tftypes.Bool ]\n " +
625
666
"Path: test" ,
626
667
),
627
668
},
628
669
},
670
+ "SetTypable-SetValue-matching-elements" : {
671
+ typ : testtypes.SetType {
672
+ SetType : types.SetType {ElemType : types .StringType },
673
+ },
674
+ val : types .SetNull (types .StringType ),
675
+ expected : types .SetNull (types .StringType ),
676
+ },
629
677
"StringType-StringValue-null" : {
630
678
typ : types .StringType ,
631
679
val : types .StringNull (),
@@ -650,6 +698,11 @@ func TestFromAttributeValue(t *testing.T) {
650
698
CreatedBy : testtypes.StringType {},
651
699
},
652
700
},
701
+ "StringTypable-StringValue" : {
702
+ typ : testtypes.StringTypeWithSemanticEquals {},
703
+ val : types .StringNull (),
704
+ expected : types .StringNull (),
705
+ },
653
706
}
654
707
655
708
for name , tc := range testCases {
0 commit comments