core/session: fix flaky test (#4730)

This commit is contained in:
Caleb Doxsey 2023-11-09 12:36:08 -07:00 committed by GitHub
parent d21cdb3678
commit 6de9f12ac1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -48,9 +48,6 @@ func TestDelete(t *testing.T) {
func TestGet(t *testing.T) {
t.Parallel()
ctrl := gomock.NewController(t)
client := mock_databroker.NewMockDataBrokerServiceClient(ctrl)
ctx := context.Background()
t.Run("ok", func(t *testing.T) {
@ -60,6 +57,8 @@ func TestGet(t *testing.T) {
Id: "session-id",
UserId: "user-id",
}
ctrl := gomock.NewController(t)
client := mock_databroker.NewMockDataBrokerServiceClient(ctrl)
client.EXPECT().Get(ctx, gomock.Any(), []grpc.CallOption{}).DoAndReturn(
func(_ context.Context, r *databroker.GetRequest, _ ...grpc.CallOption) (*databroker.GetResponse, error) {
assert.Equal(t, "type.googleapis.com/session.Session", r.Type)
@ -77,6 +76,8 @@ func TestGet(t *testing.T) {
t.Parallel()
rpcErr := status.Error(codes.Unavailable, "dummy error for testing")
ctrl := gomock.NewController(t)
client := mock_databroker.NewMockDataBrokerServiceClient(ctrl)
client.EXPECT().Get(ctx, gomock.Any(), []grpc.CallOption{}).DoAndReturn(
func(_ context.Context, r *databroker.GetRequest, _ ...grpc.CallOption) (*databroker.GetResponse, error) {
assert.Equal(t, "type.googleapis.com/session.Session", r.Type)
@ -91,6 +92,8 @@ func TestGet(t *testing.T) {
t.Run("unmarshal error", func(t *testing.T) {
t.Parallel()
ctrl := gomock.NewController(t)
client := mock_databroker.NewMockDataBrokerServiceClient(ctrl)
client.EXPECT().Get(ctx, gomock.Any(), []grpc.CallOption{}).DoAndReturn(
func(_ context.Context, r *databroker.GetRequest, _ ...grpc.CallOption) (*databroker.GetResponse, error) {
assert.Equal(t, "type.googleapis.com/session.Session", r.Type)