Skip to content

Commit

Permalink
remove non-determinism from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mpoke committed Jul 19, 2024
1 parent 0e69580 commit d2a3f22
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions x/ccv/provider/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"encoding/binary"
"fmt"
"sort"
"time"

sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -299,9 +300,14 @@ func MustGetKeyPrefix(key string) byte {
// Only used for testing
func GetAllKeyPrefixes() []byte {
prefixMap := getKeyPrefixes()
keys := make([]string, 0, len(prefixMap))
for k := range prefixMap {
keys = append(keys, k)
}
sort.Strings(keys)
prefixList := make([]byte, 0, len(prefixMap))
for _, prefix := range prefixMap {
prefixList = append(prefixList, prefix)
for _, k := range keys {
prefixList = append(prefixList, prefixMap[k])
}
return prefixList
}
Expand All @@ -310,11 +316,12 @@ func GetAllKeyPrefixes() []byte {
// Only used for testing
func GetAllKeyNames() []string {
prefixMap := getKeyPrefixes()
keyList := make([]string, 0, len(prefixMap))
for key := range prefixMap {
keyList = append(keyList, key)
keys := make([]string, 0, len(prefixMap))
for k := range prefixMap {
keys = append(keys, k)
}
return keyList
sort.Strings(keys)
return keys
}

//
Expand Down

0 comments on commit d2a3f22

Please sign in to comment.