mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-06 17:18:35 +08:00
issue: #33285 - add two grpc resolver (by session and by streaming coord assignment service) - add one grpc balancer (by serverID and roundrobin) - add lazy conn to avoid block by first service discovery - add some utility function for streaming service Signed-off-by: chyezh <chyezh@outlook.com>
26 lines
513 B
Go
26 lines
513 B
Go
package contextutil
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestWithPickServerID(t *testing.T) {
|
|
ctx := context.Background()
|
|
ctx = WithPickServerID(ctx, 1)
|
|
serverID, ok := GetPickServerID(ctx)
|
|
assert.True(t, ok)
|
|
assert.EqualValues(t, 1, serverID)
|
|
}
|
|
|
|
func TestGetPickServerID(t *testing.T) {
|
|
ctx := context.Background()
|
|
serverID, ok := GetPickServerID(ctx)
|
|
assert.False(t, ok)
|
|
assert.EqualValues(t, -1, serverID)
|
|
|
|
// normal case is tested in TestWithPickServerID
|
|
}
|