Skip to content

Commit c2d832d

Browse files
author
VikramBedi
committed
fix unit test assertion to be deterministic
1 parent f5b3ab9 commit c2d832d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/gateway/model_build_lattice_service_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2071,7 +2071,12 @@ func Test_LatticeServiceModelBuild_FilterRejectedParentRefsForServiceNetworkAsso
20712071
svc, err := task.buildLatticeService(ctx)
20722072
assert.NoError(t, err, tt.description)
20732073
assert.NotNil(t, svc, tt.description)
2074-
assert.Equal(t, tt.expectedServiceNetworkNames, svc.Spec.ServiceNetworkNames, tt.description)
2074+
2075+
expectedNetworkNames := append([]string{}, tt.expectedServiceNetworkNames...)
2076+
actualNetworkNames := append([]string{}, svc.Spec.ServiceNetworkNames...)
2077+
sort.Strings(expectedNetworkNames)
2078+
sort.Strings(actualNetworkNames)
2079+
assert.Equal(t, expectedNetworkNames, actualNetworkNames, tt.description)
20752080
})
20762081
}
20772082
}

0 commit comments

Comments
 (0)