diff options
author | Paul Okstad <pokstad@gitlab.com> | 2019-10-17 22:35:45 +0300 |
---|---|---|
committer | Paul Okstad <pokstad@gitlab.com> | 2019-10-17 22:35:45 +0300 |
commit | 95edabecd90fe7b97cd2d3e9fbf9b69a21430937 (patch) | |
tree | c640cf0db92395ecfef02d6dffab1fd34393f61b /internal/praefect/auth_test.go | |
parent | b558b78a7b8e6da798a7ddd476bd8fb1085b856f (diff) |
Refactor praefect server tests
Diffstat (limited to 'internal/praefect/auth_test.go')
-rw-r--r-- | internal/praefect/auth_test.go | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/internal/praefect/auth_test.go b/internal/praefect/auth_test.go index f7b27394b..25fe7e4a0 100644 --- a/internal/praefect/auth_test.go +++ b/internal/praefect/auth_test.go @@ -64,7 +64,7 @@ func TestAuthFailures(t *testing.T) { cli := mock.NewSimpleServiceClient(conn) - _, err = cli.SimpleUnaryUnary(ctx, &mock.SimpleRequest{ + _, err = cli.ServerAccessor(ctx, &mock.SimpleRequest{ Value: 1, }) @@ -133,7 +133,7 @@ func TestAuthSuccess(t *testing.T) { cli := mock.NewSimpleServiceClient(conn) - _, err = cli.SimpleUnaryUnary(ctx, &mock.SimpleRequest{ + _, err = cli.ServerAccessor(ctx, &mock.SimpleRequest{ Value: 1, }) @@ -155,7 +155,14 @@ func dial(serverSocketPath string, opts []grpc.DialOption) (*grpc.ClientConn, er func runServer(t *testing.T, token string, required bool) (*Server, string, func()) { backendToken := "abcxyz" - backend, cleanup := newMockDownstream(t, backendToken, callbackIncrement) + mockServer := &mockSvc{ + serverAccessor: func(_ context.Context, req *mock.SimpleRequest) (*mock.SimpleResponse, error) { + return &mock.SimpleResponse{ + Value: req.Value + 1, + }, nil + }, + } + backend, cleanup := newMockDownstream(t, backendToken, mockServer) conf := config.Config{ VirtualStorageName: "praefect", |