fix: service slot test failure - regression (#1062)

This commit is contained in:
Roman Zajic 2024-03-20 12:11:06 +08:00 committed by GitHub
parent afa124e1ca
commit 7d767c0105
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 3 deletions

View File

@ -1,12 +1,11 @@
package peermanager package peermanager
import ( import (
"testing"
"github.com/libp2p/go-libp2p/core/peer" "github.com/libp2p/go-libp2p/core/peer"
libp2pProtocol "github.com/libp2p/go-libp2p/core/protocol" libp2pProtocol "github.com/libp2p/go-libp2p/core/protocol"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"golang.org/x/exp/maps" "golang.org/x/exp/maps"
"testing"
) )
func TestServiceSlot(t *testing.T) { func TestServiceSlot(t *testing.T) {
@ -41,8 +40,10 @@ func TestServiceSlot(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, 2, len(maps.Keys(fetchedPeers))) require.Equal(t, 2, len(maps.Keys(fetchedPeers)))
fetchedPeersSerialized := maps.Keys(fetchedPeers)
// Check for uniqueness // Check for uniqueness
require.NotEqual(t, maps.Keys(fetchedPeers)[0], maps.Keys(fetchedPeers)[1]) require.NotEqual(t, fetchedPeersSerialized[0], fetchedPeersSerialized[1])
slots.getPeers(protocol).remove(peerID2) slots.getPeers(protocol).remove(peerID2)