diff --git a/pkg/innerring/processors/governance/list_test.go b/pkg/innerring/processors/governance/list_test.go index 06c3c84fa8..3b41372042 100644 --- a/pkg/innerring/processors/governance/list_test.go +++ b/pkg/innerring/processors/governance/list_test.go @@ -55,6 +55,19 @@ func TestNewAlphabetList(t *testing.T) { require.True(t, equalPublicKeyLists(list, rounds[i])) } }) + + t.Run("unsorted keys", func(t *testing.T) { + orig := keys.PublicKeys{k[1], k[2], k[3], k[4]} + main := keys.PublicKeys{k[1], k[2], k[5], k[4]} + + exp := make(keys.PublicKeys, len(main)) + copy(exp, main) + sort.Sort(exp) + + got, err := newAlphabetList(orig, main) + require.NoError(t, err) + require.True(t, equalPublicKeyLists(exp, got)) // expect {1, 2, 4, 5}, not {1, 2, 3, 5} + }) } func TestUpdateInnerRing(t *testing.T) {