test(transport): add test hash

This commit is contained in:
bandl 2021-10-24 19:12:26 +08:00
parent e81124c7e6
commit fc60b2a779
1 changed files with 17 additions and 0 deletions

View File

@ -0,0 +1,17 @@
package transport
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestHashTransport_GetTargetAddr(t *testing.T) {
tran := NewHashTransport(3, nil, "127.0.0.1:5581", "127.0.0.1:5582", "127.0.0.1:5583")
key := "test"
target, err := tran.GetTargetAddr(key)
require.NoError(t, err)
require.Equal(t, target, "127.0.0.1:5582")
}