498b235461
Build and test / Build and test AMD64 Ubuntu 22.04 (push) Failing after 0s
Publish Builder / amazonlinux2023 (push) Failing after 1s
Build and test / UT for Go (push) Has been skipped
Publish KRTE Images / KRTE (push) Failing after 1s
Build and test / Integration Test (push) Has been skipped
Build and test / Upload Code Coverage (push) Has been skipped
Publish Builder / rockylinux9 (push) Failing after 1s
Publish Builder / ubuntu22.04 (push) Failing after 0s
Publish Builder / ubuntu24.04 (push) Failing after 0s
Publish Gpu Builder / publish-gpu-builder (push) Failing after 1s
Publish Test Images / PyTest (push) Failing after 0s
Build and test / UT for Cpp (push) Has been cancelled
34 lines
1.1 KiB
Go
34 lines
1.1 KiB
Go
package status
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/mock"
|
|
|
|
"github.com/milvus-io/milvus/internal/mocks/google.golang.org/mock_grpc"
|
|
"github.com/milvus-io/milvus/pkg/v3/proto/streamingpb"
|
|
)
|
|
|
|
func TestClientStreamWrapper(t *testing.T) {
|
|
s := mock_grpc.NewMockClientStream(t)
|
|
s.EXPECT().SendMsg(mock.Anything).Return(NewGRPCStatusFromStreamingError(NewOnShutdownError("test")).Err())
|
|
s.EXPECT().RecvMsg(mock.Anything).Return(NewGRPCStatusFromStreamingError(NewOnShutdownError("test")).Err())
|
|
w := NewClientStreamWrapper("method", s)
|
|
|
|
err := w.SendMsg(context.Background())
|
|
assert.NotNil(t, err)
|
|
streamingErr := AsStreamingError(err)
|
|
assert.Equal(t, streamingpb.StreamingCode_STREAMING_CODE_ON_SHUTDOWN, streamingErr.Code)
|
|
assert.Contains(t, streamingErr.Cause, "test")
|
|
|
|
err = w.RecvMsg(context.Background())
|
|
assert.NotNil(t, err)
|
|
streamingErr = AsStreamingError(err)
|
|
assert.Equal(t, streamingpb.StreamingCode_STREAMING_CODE_ON_SHUTDOWN, streamingErr.Code)
|
|
assert.Contains(t, streamingErr.Cause, "test")
|
|
|
|
assert.Nil(t, NewClientStreamWrapper("method", nil))
|
|
}
|