Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
FZambia committed Oct 20, 2024
1 parent 371b0fa commit fe73421
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
10 changes: 9 additions & 1 deletion internal/proxy/connect_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import (

"github.com/centrifugal/centrifuge"
"github.com/stretchr/testify/require"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)

type grpcConnHandleTestCase struct {
Expand Down Expand Up @@ -227,7 +229,13 @@ func TestHandleConnectWithoutProxyServerStart(t *testing.T) {
cases := newConnHandleTestCases(httpTestCase, grpcTestCase)
for _, c := range cases {
reply, err := c.invokeHandle(context.Background())
require.ErrorIs(t, centrifuge.ErrorInternal, err, c.protocol)
if c.protocol == "grpc" {
st, ok := status.FromError(err)
require.True(t, ok, c.protocol)
require.Equal(t, codes.Unavailable, st.Code(), c.protocol)
} else {
require.Error(t, err, c.protocol)
}
require.Equal(t, centrifuge.ConnectReply{}, reply, c.protocol)
}
}
Expand Down
2 changes: 1 addition & 1 deletion internal/unihttpstream/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ import (
type Config struct {
// MaxRequestBodySize limits request body size.
MaxRequestBodySize int
ConnectCodeTranslates tools.ConnectCodeToHTTPStatusTranslates
ConnectCodeTranslates tools.ConnectCodeToHTTPStatus
centrifuge.PingPongConfig
}
2 changes: 1 addition & 1 deletion internal/unisse/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ import (
type Config struct {
// MaxRequestBodySize for POST requests when used.
MaxRequestBodySize int
ConnectCodeTranslates tools.ConnectCodeToHTTPStatusTranslates
ConnectCodeTranslates tools.ConnectCodeToHTTPStatus
centrifuge.PingPongConfig
}

0 comments on commit fe73421

Please sign in to comment.