aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar Carl Mastrangelo <notcarl@google.com>2015-12-02 14:46:50 -0800
committerGravatar Carl Mastrangelo <notcarl@google.com>2015-12-04 14:03:14 -0800
commit3c7862478d9da829199714e645b6c5a15fb7f596 (patch)
tree32d6c31fdffbb5490c3ffa170a6357c7080d226e /tools
parentb67ef24d776fcc2a0b75ca4c85f58be762d0c68d (diff)
Make http2 interop tests always pass, and instead give a report
Diffstat (limited to 'tools')
-rw-r--r--tools/http2_interop/http2interop_test.go15
-rw-r--r--tools/http2_interop/testsuite.go44
-rwxr-xr-xtools/run_tests/run_interop_tests.py3
3 files changed, 58 insertions, 4 deletions
diff --git a/tools/http2_interop/http2interop_test.go b/tools/http2_interop/http2interop_test.go
index b35d085569..2295340286 100644
--- a/tools/http2_interop/http2interop_test.go
+++ b/tools/http2_interop/http2interop_test.go
@@ -3,6 +3,7 @@ package http2interop
import (
"crypto/tls"
"crypto/x509"
+ "encoding/json"
"flag"
"fmt"
"io/ioutil"
@@ -68,6 +69,7 @@ func (ctx *HTTP2InteropCtx) Close() error {
}
func TestClientShortSettings(t *testing.T) {
+ defer Report(t)()
if *testCase != "framing" {
t.SkipNow()
}
@@ -79,6 +81,7 @@ func TestClientShortSettings(t *testing.T) {
}
func TestShortPreface(t *testing.T) {
+ defer Report(t)()
if *testCase != "framing" {
t.SkipNow()
}
@@ -90,6 +93,7 @@ func TestShortPreface(t *testing.T) {
}
func TestUnknownFrameType(t *testing.T) {
+ defer Report(t)()
if *testCase != "framing" {
t.SkipNow()
}
@@ -100,6 +104,7 @@ func TestUnknownFrameType(t *testing.T) {
}
func TestClientPrefaceWithStreamId(t *testing.T) {
+ defer Report(t)()
if *testCase != "framing" {
t.SkipNow()
}
@@ -109,6 +114,7 @@ func TestClientPrefaceWithStreamId(t *testing.T) {
}
func TestTLSApplicationProtocol(t *testing.T) {
+ defer Report(t)()
if *testCase != "tls" {
t.SkipNow()
}
@@ -118,6 +124,7 @@ func TestTLSApplicationProtocol(t *testing.T) {
}
func TestTLSMaxVersion(t *testing.T) {
+ defer Report(t)()
if *testCase != "tls" {
t.SkipNow()
}
@@ -129,6 +136,7 @@ func TestTLSMaxVersion(t *testing.T) {
}
func TestTLSBadCipherSuites(t *testing.T) {
+ defer Report(t)()
if *testCase != "tls" {
t.SkipNow()
}
@@ -151,5 +159,10 @@ func matchError(t *testing.T, err error, matches ...string) {
func TestMain(m *testing.M) {
flag.Parse()
- os.Exit(m.Run())
+ m.Run()
+ if err := json.NewEncoder(os.Stderr).Encode(&allCaseInfos); err != nil {
+ fmt.Println("Failed to encode", err)
+ }
+ // Always pass
+ os.Exit(0)
}
diff --git a/tools/http2_interop/testsuite.go b/tools/http2_interop/testsuite.go
new file mode 100644
index 0000000000..fcfacf5fc1
--- /dev/null
+++ b/tools/http2_interop/testsuite.go
@@ -0,0 +1,44 @@
+package http2interop
+
+import (
+ "runtime"
+ "strings"
+ "sync"
+ "testing"
+)
+
+// When a test is skipped or fails, runtime.Goexit() is called which destroys the callstack.
+// This means the name of the test case is lost, so we need to grab a copy of pc before.
+func Report(t testing.TB) func() {
+ pc, _, _, ok := runtime.Caller(1)
+ if !ok {
+ t.Fatal("Can't get caller info")
+ }
+ return func() {
+ fn := runtime.FuncForPC(pc)
+ fullName := fn.Name()
+ name := strings.Split(fullName, ".")[1]
+ allCaseInfos.lock.Lock()
+ defer allCaseInfos.lock.Unlock()
+ allCaseInfos.Cases = append(allCaseInfos.Cases, &caseInfo{
+ Name: name,
+ Passed: !t.Failed(),
+ Skipped: t.Skipped(),
+ })
+ }
+}
+
+type caseInfo struct {
+ Name string `json:"name"`
+ Passed bool `json:"passed"`
+ Skipped bool `json:"skipped"`
+}
+
+type caseInfos struct {
+ lock sync.Mutex
+ Cases []*caseInfo `json:"cases"`
+}
+
+var (
+ allCaseInfos = caseInfos{}
+)
diff --git a/tools/run_tests/run_interop_tests.py b/tools/run_tests/run_interop_tests.py
index 5435a1d02f..5feb4f0c38 100755
--- a/tools/run_tests/run_interop_tests.py
+++ b/tools/run_tests/run_interop_tests.py
@@ -661,9 +661,6 @@ try:
if args.http2_interop:
for test_case in _HTTP2_TEST_CASES:
- if server_name == "go":
- # TODO(carl-mastrangelo): Reenable after https://github.com/grpc/grpc-go/issues/434
- continue
test_job = cloud_to_cloud_jobspec(http2Interop,
test_case,
server_name,