File tree 1 file changed +13
-3
lines changed
1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 9
9
"os"
10
10
"path/filepath"
11
11
"reflect"
12
+ "sort"
12
13
"testing"
13
14
14
15
"helm.sh/helm/v3/pkg/chart"
@@ -714,12 +715,21 @@ func TestGroupChangesByChart(t *testing.T) {
714
715
want := make (map [* chart.Chart ][]* internal.RewriteAction )
715
716
// parent chart
716
717
want [rootChart ] = []* internal.RewriteAction {r1 }
718
+
719
+ firstLevelDeps := rootChart .Dependencies ()
720
+ // Sort dependencies since they come in arbitrary order
721
+ sort .Slice (firstLevelDeps , func (i , j int ) bool {
722
+ return firstLevelDeps [i ].Name () < firstLevelDeps [j ].Name ()
723
+ })
724
+
717
725
// Subchart1
718
- want [rootChart .Dependencies ()[0 ]] = []* internal.RewriteAction {subchart1R1 , subchart1R2 }
726
+ want [firstLevelDeps [0 ]] = []* internal.RewriteAction {subchart1R1 , subchart1R2 }
727
+
719
728
// Subchart2
720
- want [rootChart .Dependencies ()[1 ]] = []* internal.RewriteAction {subchart2R1 }
729
+ want [firstLevelDeps [1 ]] = []* internal.RewriteAction {subchart2R1 }
730
+
721
731
// Subchart1.Subchart3
722
- want [rootChart . Dependencies () [0 ].Dependencies ()[0 ]] = []* internal.RewriteAction {subchart1Subchart3 }
732
+ want [firstLevelDeps [0 ].Dependencies ()[0 ]] = []* internal.RewriteAction {subchart1Subchart3 }
723
733
724
734
// Compare output
725
735
if got := groupChangesByChart (rewrites , rootChart ); ! reflect .DeepEqual (got , want ) {
You can’t perform that action at this time.
0 commit comments