aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/http2_interop/http2interop_test.go
blob: 3b687c035e8748bcba20952138d3b02f0cd2b2d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package http2interop

import (
	"crypto/tls"
	"flag"
	"io"
	"os"
	"testing"
)

var (
	serverSpec = flag.String("spec", ":50051", "The server spec to test")
)

func TestShortPreface(t *testing.T) {
	for i := 0; i < len(Preface)-1; i++ {
		if err := testShortPreface(*serverSpec, Preface[:i]+"X"); err != io.EOF {
			t.Error("Expected an EOF but was", err)
		}
	}
}

func TestUnknownFrameType(t *testing.T) {
	if err := testUnknownFrameType(*serverSpec); err != nil {
		t.Fatal(err)
	}
}

func TestTLSApplicationProtocol(t *testing.T) {
	if err := testTLSApplicationProtocol(*serverSpec); err != io.EOF {
		t.Fatal("Expected an EOF but was", err)
	}
}

func TestTLSMaxVersion(t *testing.T) {
	if err := testTLSMaxVersion(*serverSpec, tls.VersionTLS11); err != io.EOF {
		t.Fatal("Expected an EOF but was", err)
	}
}

func TestClientPrefaceWithStreamId(t *testing.T) {
	if err := testClientPrefaceWithStreamId(*serverSpec); err != io.EOF {
		t.Fatal("Expected an EOF but was", err)
	}
}

func TestMain(m *testing.M) {
	flag.Parse()
	os.Exit(m.Run())
}