8
8
9
9
"github.com/kong/go-database-reconciler/pkg/utils"
10
10
"github.com/stretchr/testify/assert"
11
+ "github.com/stretchr/testify/require"
11
12
)
12
13
13
14
var (
@@ -484,7 +485,7 @@ func Test_Diff_Workspace_OlderThan3x(t *testing.T) {
484
485
setup (t )
485
486
486
487
_ , err := diff (tc .stateFile )
487
- assert .NoError (t , err )
488
+ require .NoError (t , err )
488
489
})
489
490
}
490
491
}
@@ -508,7 +509,7 @@ func Test_Diff_Workspace_NewerThan3x(t *testing.T) {
508
509
setup (t )
509
510
510
511
_ , err := diff (tc .stateFile )
511
- assert .NoError (t , err )
512
+ require .NoError (t , err )
512
513
})
513
514
}
514
515
}
@@ -539,10 +540,10 @@ func Test_Diff_Masked_OlderThan3x(t *testing.T) {
539
540
setup (t )
540
541
541
542
// initialize state
542
- assert .NoError (t , sync (context .Background (), tc .initialStateFile ))
543
+ require .NoError (t , sync (context .Background (), tc .initialStateFile ))
543
544
544
545
out , err := diff (tc .stateFile )
545
- assert .NoError (t , err )
546
+ require .NoError (t , err )
546
547
assert .Equal (t , expectedOutputMasked , out )
547
548
})
548
549
}
@@ -556,11 +557,11 @@ func Test_Diff_Masked_OlderThan3x(t *testing.T) {
556
557
setup (t )
557
558
558
559
// initialize state
559
- assert .NoError (t , sync (context .Background (), tc .initialStateFile ))
560
+ require .NoError (t , sync (context .Background (), tc .initialStateFile ))
560
561
561
562
out , err := diff (tc .stateFile , "--json-output" )
562
- assert .NoError (t , err )
563
- assert .Equal (t , expectedOutputMaskedJSON , out )
563
+ require .NoError (t , err )
564
+ assert .JSONEq (t , expectedOutputMaskedJSON , out )
564
565
})
565
566
}
566
567
}
@@ -591,10 +592,10 @@ func Test_Diff_Masked_NewerThan3x(t *testing.T) {
591
592
setup (t )
592
593
593
594
// initialize state
594
- assert .NoError (t , sync (context .Background (), tc .initialStateFile ))
595
+ require .NoError (t , sync (context .Background (), tc .initialStateFile ))
595
596
596
597
out , err := diff (tc .stateFile )
597
- assert .NoError (t , err )
598
+ require .NoError (t , err )
598
599
assert .Equal (t , expectedOutputMasked , out )
599
600
})
600
601
}
@@ -607,11 +608,11 @@ func Test_Diff_Masked_NewerThan3x(t *testing.T) {
607
608
setup (t )
608
609
609
610
// initialize state
610
- assert .NoError (t , sync (context .Background (), tc .initialStateFile ))
611
+ require .NoError (t , sync (context .Background (), tc .initialStateFile ))
611
612
612
613
out , err := diff (tc .stateFile , "--json-output" )
613
- assert .NoError (t , err )
614
- assert .Equal (t , expectedOutputMaskedJSON30x , out )
614
+ require .NoError (t , err )
615
+ assert .JSONEq (t , expectedOutputMaskedJSON30x , out )
615
616
})
616
617
}
617
618
for _ , tc := range tests {
@@ -623,11 +624,11 @@ func Test_Diff_Masked_NewerThan3x(t *testing.T) {
623
624
setup (t )
624
625
625
626
// initialize state
626
- assert .NoError (t , sync (context .Background (), tc .initialStateFile ))
627
+ require .NoError (t , sync (context .Background (), tc .initialStateFile ))
627
628
628
629
out , err := diff (tc .stateFile , "--json-output" )
629
- assert .NoError (t , err )
630
- assert .Equal (t , expectedOutputMaskedJSON , out )
630
+ require .NoError (t , err )
631
+ assert .JSONEq (t , expectedOutputMaskedJSON , out )
631
632
})
632
633
}
633
634
}
@@ -658,10 +659,10 @@ func Test_Diff_Unmasked_OlderThan3x(t *testing.T) {
658
659
setup (t )
659
660
660
661
// initialize state
661
- assert .NoError (t , sync (context .Background (), tc .initialStateFile ))
662
+ require .NoError (t , sync (context .Background (), tc .initialStateFile ))
662
663
663
664
out , err := diff (tc .stateFile , "--no-mask-deck-env-vars-value" )
664
- assert .NoError (t , err )
665
+ require .NoError (t , err )
665
666
assert .Equal (t , expectedOutputUnMasked , out )
666
667
})
667
668
}
@@ -674,11 +675,11 @@ func Test_Diff_Unmasked_OlderThan3x(t *testing.T) {
674
675
setup (t )
675
676
676
677
// initialize state
677
- assert .NoError (t , sync (context .Background (), tc .initialStateFile ))
678
+ require .NoError (t , sync (context .Background (), tc .initialStateFile ))
678
679
679
680
out , err := diff (tc .stateFile , "--no-mask-deck-env-vars-value" , "--json-output" )
680
- assert .NoError (t , err )
681
- assert .Equal (t , expectedOutputUnMaskedJSON , out )
681
+ require .NoError (t , err )
682
+ assert .JSONEq (t , expectedOutputUnMaskedJSON , out )
682
683
})
683
684
}
684
685
}
@@ -709,10 +710,10 @@ func Test_Diff_Unmasked_NewerThan3x(t *testing.T) {
709
710
setup (t )
710
711
711
712
// initialize state
712
- assert .NoError (t , sync (context .Background (), tc .initialStateFile ))
713
+ require .NoError (t , sync (context .Background (), tc .initialStateFile ))
713
714
714
715
out , err := diff (tc .stateFile , "--no-mask-deck-env-vars-value" )
715
- assert .NoError (t , err )
716
+ require .NoError (t , err )
716
717
assert .Equal (t , expectedOutputUnMasked , out )
717
718
})
718
719
}
@@ -725,11 +726,11 @@ func Test_Diff_Unmasked_NewerThan3x(t *testing.T) {
725
726
setup (t )
726
727
727
728
// initialize state
728
- assert .NoError (t , sync (context .Background (), tc .initialStateFile ))
729
+ require .NoError (t , sync (context .Background (), tc .initialStateFile ))
729
730
730
731
out , err := diff (tc .stateFile , "--no-mask-deck-env-vars-value" , "--json-output" )
731
- assert .NoError (t , err )
732
- assert .Equal (t , expectedOutputUnMaskedJSON30x , out )
732
+ require .NoError (t , err )
733
+ assert .JSONEq (t , expectedOutputUnMaskedJSON30x , out )
733
734
})
734
735
}
735
736
for _ , tc := range tests {
@@ -741,11 +742,11 @@ func Test_Diff_Unmasked_NewerThan3x(t *testing.T) {
741
742
setup (t )
742
743
743
744
// initialize state
744
- assert .NoError (t , sync (context .Background (), tc .initialStateFile ))
745
+ require .NoError (t , sync (context .Background (), tc .initialStateFile ))
745
746
746
747
out , err := diff (tc .stateFile , "--no-mask-deck-env-vars-value" , "--json-output" )
747
- assert .NoError (t , err )
748
- assert .Equal (t , expectedOutputUnMaskedJSON , out )
748
+ require .NoError (t , err )
749
+ assert .JSONEq (t , expectedOutputUnMaskedJSON , out )
749
750
})
750
751
}
751
752
}
@@ -776,10 +777,10 @@ func Test_Diff_NoDiffUnorderedArray(t *testing.T) {
776
777
777
778
// test that the diff command does not return any changes when
778
779
// array fields are not sorted.
779
- assert .NoError (t , sync (context .Background (), tc .stateFile , "--timeout" , "60" ))
780
+ require .NoError (t , sync (context .Background (), tc .stateFile , "--timeout" , "60" ))
780
781
781
782
out , err := diff (tc .stateFile )
782
- assert .NoError (t , err )
783
+ require .NoError (t , err )
783
784
assert .Equal (t , emptyOutput , out )
784
785
reset (t )
785
786
})
@@ -795,10 +796,10 @@ func Test_Diff_NoDiffCompressedTarget(t *testing.T) {
795
796
// test that the diff command does not return any changes when
796
797
// target is a compressed IPv6.
797
798
stateFile := "testdata/diff/005-no-diff-target/kong.yaml"
798
- assert .NoError (t , sync (context .Background (), stateFile ))
799
+ require .NoError (t , sync (context .Background (), stateFile ))
799
800
800
801
out , err := diff (stateFile )
801
- assert .NoError (t , err )
802
+ require .NoError (t , err )
802
803
assert .Equal (t , emptyOutput , out )
803
804
reset (t )
804
805
}
0 commit comments