Skip to content

Commit

Permalink
fix(tests): Fix wasmer flaky sorts (#2643)
Browse files Browse the repository at this point in the history
  • Loading branch information
qdm12 committed Jul 5, 2022
1 parent d2c42b8 commit 7eede9a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/runtime/wasmer/imports_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,9 @@ func Test_ext_crypto_ed25519_public_keys_version_1(t *testing.T) {
copy(pubKeys[i][:], kp.Public().Encode())
}

sort.Slice(pubKeys, func(i int, j int) bool { return pubKeys[i][0] < pubKeys[j][0] })
sort.Slice(pubKeys, func(i int, j int) bool {
return bytes.Compare(pubKeys[i][:], pubKeys[j][:]) < 0
})

res, err := inst.Exec("rtm_ext_crypto_ed25519_public_keys_version_1", idData)
require.NoError(t, err)
Expand All @@ -771,7 +773,10 @@ func Test_ext_crypto_ed25519_public_keys_version_1(t *testing.T) {
err = scale.Unmarshal(out, &ret)
require.NoError(t, err)

sort.Slice(ret, func(i int, j int) bool { return ret[i][0] < ret[j][0] })
sort.Slice(ret, func(i int, j int) bool {
return bytes.Compare(ret[i][:], ret[j][:]) < 0
})

require.Equal(t, pubKeys, ret)
}

Expand Down

0 comments on commit 7eede9a

Please sign in to comment.