mirror of
https://github.com/googleforgames/open-match.git
synced 2025-03-29 22:44:20 +00:00
Remove TestServerBinding from component tests (#485)
This commit is contained in:
internal
app
rpc/testing
@ -16,23 +16,8 @@ package backend
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
"open-match.dev/open-match/internal/pb"
|
||||
"open-match.dev/open-match/internal/rpc"
|
||||
rpcTesting "open-match.dev/open-match/internal/rpc/testing"
|
||||
)
|
||||
|
||||
func TestServerBinding(t *testing.T) {
|
||||
bs := func(p *rpc.ServerParams) {
|
||||
p.AddHandleFunc(func(s *grpc.Server) {
|
||||
pb.RegisterBackendServer(s, &backendService{})
|
||||
}, pb.RegisterBackendHandlerFromEndpoint)
|
||||
}
|
||||
|
||||
rpcTesting.TestServerBinding(t, bs)
|
||||
}
|
||||
|
||||
func TestAssignTickets(t *testing.T) {
|
||||
// TODO: add test when test helper #462 is checked in
|
||||
// https://github.com/googleforgames/open-match/pull/462
|
||||
|
@ -13,22 +13,3 @@
|
||||
// limitations under the License.
|
||||
|
||||
package evaluator
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
"open-match.dev/open-match/internal/pb"
|
||||
"open-match.dev/open-match/internal/rpc"
|
||||
rpcTesting "open-match.dev/open-match/internal/rpc/testing"
|
||||
)
|
||||
|
||||
func TestServerBinding(t *testing.T) {
|
||||
bs := func(p *rpc.ServerParams) {
|
||||
p.AddHandleFunc(func(s *grpc.Server) {
|
||||
pb.RegisterEvaluatorServer(s, &evaluatorService{})
|
||||
}, pb.RegisterEvaluatorHandlerFromEndpoint)
|
||||
}
|
||||
|
||||
rpcTesting.TestServerBinding(t, bs)
|
||||
}
|
||||
|
@ -23,25 +23,12 @@ import (
|
||||
structpb "github.com/golang/protobuf/ptypes/struct"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
"open-match.dev/open-match/internal/config"
|
||||
"open-match.dev/open-match/internal/pb"
|
||||
"open-match.dev/open-match/internal/rpc"
|
||||
rpcTesting "open-match.dev/open-match/internal/rpc/testing"
|
||||
)
|
||||
|
||||
func TestServerBinding(t *testing.T) {
|
||||
bs := func(p *rpc.ServerParams) {
|
||||
p.AddHandleFunc(func(s *grpc.Server) {
|
||||
pb.RegisterFrontendServer(s, &frontendService{})
|
||||
}, pb.RegisterFrontendHandlerFromEndpoint)
|
||||
}
|
||||
|
||||
rpcTesting.TestServerBinding(t, bs)
|
||||
}
|
||||
|
||||
// validateTicket validates that the fetched ticket is identical to the expected ticket.
|
||||
func validateTicket(t *testing.T, got *pb.Ticket, want *pb.Ticket) {
|
||||
assert.Equal(t, got.Id, want.Id)
|
||||
|
@ -13,22 +13,3 @@
|
||||
// limitations under the License.
|
||||
|
||||
package mmlogic
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
"open-match.dev/open-match/internal/pb"
|
||||
"open-match.dev/open-match/internal/rpc"
|
||||
rpcTesting "open-match.dev/open-match/internal/rpc/testing"
|
||||
)
|
||||
|
||||
func TestServerBinding(t *testing.T) {
|
||||
bs := func(p *rpc.ServerParams) {
|
||||
p.AddHandleFunc(func(s *grpc.Server) {
|
||||
pb.RegisterMmLogicServer(s, &mmlogicService{})
|
||||
}, pb.RegisterMmLogicHandlerFromEndpoint)
|
||||
}
|
||||
|
||||
rpcTesting.TestServerBinding(t, bs)
|
||||
}
|
||||
|
@ -93,12 +93,6 @@ func bindAndStart(t *testing.T, p *rpc.ServerParams, binder func(*rpc.ServerPara
|
||||
return s
|
||||
}
|
||||
|
||||
// TestServerBinding verifies that a server can start and shutdown.
|
||||
func TestServerBinding(t *testing.T, binder func(*rpc.ServerParams)) {
|
||||
tc := MustServe(t, binder)
|
||||
tc.Close()
|
||||
}
|
||||
|
||||
// TestContext provides methods to interact with the Open Match server.
|
||||
type TestContext struct {
|
||||
t *testing.T
|
||||
|
@ -26,15 +26,6 @@ import (
|
||||
shellTesting "open-match.dev/open-match/internal/testing"
|
||||
)
|
||||
|
||||
func TestTestServerBinding(t *testing.T) {
|
||||
ff := &shellTesting.FakeFrontend{}
|
||||
TestServerBinding(t, func(spf *rpc.ServerParams) {
|
||||
spf.AddHandleFunc(func(s *grpc.Server) {
|
||||
pb.RegisterFrontendServer(s, ff)
|
||||
}, pb.RegisterFrontendHandlerFromEndpoint)
|
||||
})
|
||||
}
|
||||
|
||||
// TestMustServerParamsForTesting verifies that a server can stand up in (insecure or TLS) mode.
|
||||
func TestMustServe(t *testing.T) {
|
||||
runMustServeTest(t, MustServe)
|
||||
|
Reference in New Issue
Block a user