Skip to content

Commit

Permalink
re-enable handler_server in end2end test, and fix some failed tests (g…
Browse files Browse the repository at this point in the history
  • Loading branch information
menghanl authored May 26, 2017
1 parent 3a46d9d commit 2739967
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
21 changes: 19 additions & 2 deletions test/end2end_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,7 @@ var (
unixTLSEnv = env{name: "unix-tls", network: "unix", security: "tls", balancer: true}
handlerEnv = env{name: "handler-tls", network: "tcp", security: "tls", httpHandler: true, balancer: true}
noBalancerEnv = env{name: "no-balancer", network: "tcp", security: "tls", balancer: false}
// TODO add handlerEnv back when ServeHTTP is stable.
allEnv = []env{tcpClearEnv, tcpTLSEnv, unixClearEnv, unixTLSEnv /*handlerEnv,*/, noBalancerEnv}
allEnv = []env{tcpClearEnv, tcpTLSEnv, unixClearEnv, unixTLSEnv, handlerEnv, noBalancerEnv}
)

var onlyEnv = flag.String("only_env", "", "If non-empty, one of 'tcp-clear', 'tcp-tls', 'unix-clear', 'unix-tls', or 'handler-tls' to only run the tests for that environment. Empty means all.")
Expand Down Expand Up @@ -2074,6 +2073,11 @@ func testEmptyUnaryWithUserAgent(t *testing.T, e env) {
func TestFailedEmptyUnary(t *testing.T) {
defer leakCheck(t)()
for _, e := range listTestEnv() {
if e.name == "handler-tls" {
// This test covers status details, but
// Grpc-Status-Details-Bin is not support in handler_server.
continue
}
testFailedEmptyUnary(t, e)
}
}
Expand Down Expand Up @@ -2695,6 +2699,11 @@ func testMultipleSetHeaderStreamingRPCError(t *testing.T, e env) {
func TestMalformedHTTP2Metadata(t *testing.T) {
defer leakCheck(t)()
for _, e := range listTestEnv() {
if e.name == "handler-tls" {
// Failed with "server stops accepting new RPCs".
// Server stops accepting new RPCs when the client sends an illegal http2 header.
continue
}
testMalformedHTTP2Metadata(t, e)
}
}
Expand Down Expand Up @@ -2753,6 +2762,10 @@ func performOneRPC(t *testing.T, tc testpb.TestServiceClient, wg *sync.WaitGroup
func TestRetry(t *testing.T) {
defer leakCheck(t)()
for _, e := range listTestEnv() {
if e.name == "handler-tls" {
// In race mode, with go1.6, the test never returns with handler_server.
continue
}
testRetry(t, e)
}
}
Expand Down Expand Up @@ -3434,6 +3447,10 @@ const defaultMaxStreamsClient = 100
func TestExceedDefaultMaxStreamsLimit(t *testing.T) {
defer leakCheck(t)()
for _, e := range listTestEnv() {
if e.name == "handler-tls" {
// The default max stream limit in handler_server is not 100?
continue
}
testExceedDefaultMaxStreamsLimit(t, e)
}
}
Expand Down
9 changes: 0 additions & 9 deletions transport/handler_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,6 @@ func NewServerHandlerTransport(w http.ResponseWriter, r *http.Request) (ServerTr
continue
}
for _, v := range vv {
if k == "user-agent" {
// user-agent is special. Copying logic of http_util.go.
if i := strings.LastIndex(v, " "); i == -1 {
// There is no application user agent string being set
continue
} else {
v = v[:i]
}
}
v, err := decodeMetadataHeader(k, v)
if err != nil {
return nil, streamErrorf(codes.InvalidArgument, "malformed binary metadata: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion transport/handler_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func TestHandlerTransport_NewServerHandlerTransport(t *testing.T) {
check: func(ht *serverHandlerTransport, tt *testCase) error {
want := metadata.MD{
"meta-bar": {"bar-val1", "bar-val2"},
"user-agent": {"x/y"},
"user-agent": {"x/y a/b"},
"meta-foo": {"foo-val"},
}
if !reflect.DeepEqual(ht.headerMD, want) {
Expand Down

0 comments on commit 2739967

Please sign in to comment.