mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-06-27 22:41:03 +08:00
@@ -43,4 +43,32 @@ func TestBlockingNode(t *testing.T) {
|
||||
_, err = CreateBlockingNode(New(r.Addr(), badType()))
|
||||
assert.Error(t, err)
|
||||
})
|
||||
|
||||
t.Run("test blocking node with protocol and identity", func(t *testing.T) {
|
||||
r, err := miniredis.Run()
|
||||
assert.NoError(t, err)
|
||||
defer r.Close()
|
||||
|
||||
node, err := CreateBlockingNode(New(r.Addr(), WithProtocol(2), WithIdentity()))
|
||||
assert.NoError(t, err)
|
||||
bridge, ok := node.(*clientBridge)
|
||||
assert.True(t, ok)
|
||||
assert.Equal(t, 2, bridge.Options().Protocol)
|
||||
assert.True(t, bridge.Options().DisableIdentity)
|
||||
node.Close()
|
||||
})
|
||||
|
||||
t.Run("test blocking node with cluster, protocol and identity", func(t *testing.T) {
|
||||
r, err := miniredis.Run()
|
||||
assert.NoError(t, err)
|
||||
defer r.Close()
|
||||
|
||||
node, err := CreateBlockingNode(New(r.Addr(), Cluster(), WithProtocol(2), WithIdentity()))
|
||||
assert.NoError(t, err)
|
||||
bridge, ok := node.(*clusterBridge)
|
||||
assert.True(t, ok)
|
||||
assert.Equal(t, 2, bridge.Options().Protocol)
|
||||
assert.True(t, bridge.Options().DisableIdentity)
|
||||
node.Close()
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user