@@ -299,8 +299,7 @@ func runDetailedDiffTest(
299
299
expected map [string ]* pulumirpc.PropertyDiff ,
300
300
) {
301
301
t .Helper ()
302
- differ := detailedDiffer {tfs : tfs , ps : ps , newInputs : new }
303
- actual := differ .makeDetailedDiffPropertyMap (old , new )
302
+ actual := MakeDetailedDiffV2 (context .Background (), tfs , ps , old , new , new )
304
303
305
304
require .Equal (t , expected , actual )
306
305
}
@@ -484,6 +483,33 @@ func TestBasicDetailedDiff(t *testing.T) {
484
483
"foo" : ComputedVal ,
485
484
},
486
485
)
486
+ propertyMapSecretValue1 := resource .NewPropertyMapFromMap (
487
+ map [string ]interface {}{
488
+ "foo" : tt .value1 ,
489
+ },
490
+ )
491
+ propertyMapSecretValue1 ["foo" ] = resource .NewSecretProperty (& resource.Secret {Element : propertyMapValue1 ["foo" ]})
492
+
493
+ propertyMapSecretValue2 := resource .NewPropertyMapFromMap (
494
+ map [string ]interface {}{
495
+ "foo" : tt .value2 ,
496
+ },
497
+ )
498
+ propertyMapSecretValue2 ["foo" ] = resource .NewSecretProperty (& resource.Secret {Element : propertyMapValue2 ["foo" ]})
499
+
500
+ propertyMapOutputValue1 := resource .NewPropertyMapFromMap (
501
+ map [string ]interface {}{
502
+ "foo" : tt .value1 ,
503
+ },
504
+ )
505
+ propertyMapOutputValue1 ["foo" ] = resource .NewOutputProperty (resource.Output {Element : propertyMapValue1 ["foo" ]})
506
+
507
+ propertyMapOutputValue2 := resource .NewPropertyMapFromMap (
508
+ map [string ]interface {}{
509
+ "foo" : tt .value2 ,
510
+ },
511
+ )
512
+ propertyMapOutputValue2 ["foo" ] = resource .NewOutputProperty (resource.Output {Element : propertyMapValue2 ["foo" ]})
487
513
488
514
t .Run ("unchanged" , func (t * testing.T ) {
489
515
runDetailedDiffTest (t , propertyMapValue1 , propertyMapValue1 , tfs , ps , map [string ]* pulumirpc.PropertyDiff {})
@@ -566,6 +592,50 @@ func TestBasicDetailedDiff(t *testing.T) {
566
592
runDetailedDiffTest (t , propertyMapNil , propertyMapEmpty , tfs , ps , added ())
567
593
})
568
594
}
595
+
596
+ t .Run ("secret unchanged" , func (t * testing.T ) {
597
+ runDetailedDiffTest (
598
+ t , propertyMapSecretValue1 , propertyMapSecretValue1 , tfs , ps , map [string ]* pulumirpc.PropertyDiff {})
599
+ })
600
+
601
+ t .Run ("value unchanged secretness changed" , func (t * testing.T ) {
602
+ runDetailedDiffTest (
603
+ t , propertyMapValue1 , propertyMapSecretValue1 , tfs , ps , map [string ]* pulumirpc.PropertyDiff {})
604
+ })
605
+
606
+ t .Run ("secret added" , func (t * testing.T ) {
607
+ runDetailedDiffTest (t , propertyMapNil , propertyMapSecretValue1 , tfs , ps , added ())
608
+ })
609
+
610
+ t .Run ("secret deleted" , func (t * testing.T ) {
611
+ runDetailedDiffTest (t , propertyMapSecretValue1 , propertyMapNil , tfs , ps , deleted ())
612
+ })
613
+
614
+ t .Run ("secret changed" , func (t * testing.T ) {
615
+ runDetailedDiffTest (t , propertyMapSecretValue1 , propertyMapSecretValue2 , tfs , ps , updated ())
616
+ })
617
+
618
+ t .Run ("output unchanged" , func (t * testing.T ) {
619
+ runDetailedDiffTest (
620
+ t , propertyMapOutputValue1 , propertyMapOutputValue1 , tfs , ps , map [string ]* pulumirpc.PropertyDiff {})
621
+ })
622
+
623
+ t .Run ("value unchanged outputness changed" , func (t * testing.T ) {
624
+ runDetailedDiffTest (
625
+ t , propertyMapValue1 , propertyMapOutputValue1 , tfs , ps , map [string ]* pulumirpc.PropertyDiff {})
626
+ })
627
+
628
+ t .Run ("output added" , func (t * testing.T ) {
629
+ runDetailedDiffTest (t , propertyMapNil , propertyMapOutputValue1 , tfs , ps , added ())
630
+ })
631
+
632
+ t .Run ("output deleted" , func (t * testing.T ) {
633
+ runDetailedDiffTest (t , propertyMapOutputValue1 , propertyMapNil , tfs , ps , deleted ())
634
+ })
635
+
636
+ t .Run ("output changed" , func (t * testing.T ) {
637
+ runDetailedDiffTest (t , propertyMapOutputValue1 , propertyMapOutputValue2 , tfs , ps , updated ())
638
+ })
569
639
})
570
640
}
571
641
}
0 commit comments