Skip to content

Commit

Permalink
fixed volumes test in cluster test (#1498) (#1534)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin85421 authored Oct 17, 2023
1 parent 8e16bfe commit eb3af49
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions apiserver/pkg/util/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,15 @@ func TestBuildVolumes(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
got, err := buildVols(tt.apiVolume)
assert.Nil(t, err)
if tt.name == "configmap test" {
// Sort items for comparison
sort.SliceStable(got[0].ConfigMap.Items, func(i, j int) bool {
return got[0].ConfigMap.Items[i].Key < got[0].ConfigMap.Items[j].Key
})
sort.SliceStable(tt.expect[0].ConfigMap.Items, func(i, j int) bool {
return tt.expect[0].ConfigMap.Items[i].Key < tt.expect[0].ConfigMap.Items[j].Key
})
}
if !reflect.DeepEqual(got, tt.expect) {
t.Errorf("failed for %s ..., got %v, expected %v", tt.name, got, tt.expect)
}
Expand Down

0 comments on commit eb3af49

Please sign in to comment.