@@ -10,45 +10,23 @@ import (
10
10
"github.com/solo-io/gloo/projects/gateway2/wellknown"
11
11
"github.com/solo-io/gloo/test/kubernetes/e2e"
12
12
"github.com/solo-io/gloo/test/kubernetes/e2e/defaults"
13
+ "github.com/solo-io/gloo/test/kubernetes/e2e/tests/base"
13
14
)
14
15
15
16
// testingSuite is the entire Suite of tests for testing K8s Service-specific features/fixes
16
17
type testingSuite struct {
17
- suite.Suite
18
-
19
- ctx context.Context
20
-
21
- // testInstallation contains all the metadata/utilities necessary to execute a series of tests
22
- // against an installation of Gloo Gateway
23
- testInstallation * e2e.TestInstallation
18
+ * base.BaseTestingSuite
24
19
}
25
20
26
21
func NewTestingSuite (ctx context.Context , testInst * e2e.TestInstallation ) suite.TestingSuite {
27
22
return & testingSuite {
28
- ctx : ctx ,
29
- testInstallation : testInst ,
23
+ base .NewBaseTestingSuite (ctx , testInst , base.SimpleTestCase {}, testCases ),
30
24
}
31
25
}
32
26
33
27
func (s * testingSuite ) TestConfigureHTTPRouteBackingDestinationsWithService () {
34
- s .T ().Cleanup (func () {
35
- err := s .testInstallation .Actions .Kubectl ().DeleteFile (s .ctx , routeWithServiceManifest )
36
- s .NoError (err , "can delete manifest" )
37
- err = s .testInstallation .Actions .Kubectl ().DeleteFile (s .ctx , serviceManifest )
38
- s .NoError (err , "can delete manifest" )
39
- s .testInstallation .Assertions .EventuallyObjectsNotExist (s .ctx , proxyService , proxyDeployment )
40
- })
41
-
42
- err := s .testInstallation .Actions .Kubectl ().ApplyFile (s .ctx , routeWithServiceManifest )
43
- s .Assert ().NoError (err , "can apply gloo.solo.io Route manifest" )
44
-
45
- // apply the service manifest separately, after the route table is applied, to ensure it can be applied after the route table
46
- err = s .testInstallation .Actions .Kubectl ().ApplyFile (s .ctx , serviceManifest )
47
- s .Assert ().NoError (err , "can apply gloo.solo.io Service manifest" )
48
-
49
- s .testInstallation .Assertions .EventuallyObjectsExist (s .ctx , proxyService , proxyDeployment )
50
- s .testInstallation .Assertions .AssertEventualCurlResponse (
51
- s .ctx ,
28
+ s .TestInstallation .Assertions .AssertEventualCurlResponse (
29
+ s .Ctx ,
52
30
defaults .CurlPodExecOpt ,
53
31
[]curl.Option {
54
32
curl .WithHost (kubeutils .ServiceFQDN (proxyService .ObjectMeta )),
@@ -59,34 +37,33 @@ func (s *testingSuite) TestConfigureHTTPRouteBackingDestinationsWithService() {
59
37
60
38
func (s * testingSuite ) TestConfigureHTTPRouteBackingDestinationsWithServiceAndWithoutTCPRoute () {
61
39
s .T ().Cleanup (func () {
62
- err := s .testInstallation .Actions .Kubectl ().DeleteFile (s .ctx , routeWithServiceManifest )
63
- s .NoError (err , "can delete manifest" )
64
- err = s .testInstallation .Actions .Kubectl ().DeleteFile (s .ctx , serviceManifest )
65
- s .NoError (err , "can delete manifest" )
66
- s .testInstallation .Assertions .EventuallyObjectsNotExist (s .ctx , proxyService , proxyDeployment )
67
- err = s .testInstallation .Actions .Kubectl ().ApplyFile (s .ctx , tcpRouteCrdManifest )
40
+ err := s .TestInstallation .Actions .Kubectl ().ApplyFile (s .Ctx , tcpRouteCrdManifest )
68
41
s .NoError (err , "can apply manifest" )
69
- s .testInstallation .Assertions .EventuallyObjectsExist (s .ctx , & wellknown .TCPRouteCRD )
42
+ s .TestInstallation .Assertions .EventuallyObjectsExist (s .Ctx , & wellknown .TCPRouteCRD )
70
43
})
71
44
72
45
// Remove the TCPRoute CRD to assert HTTPRoute services still work.
73
- err := s .testInstallation .Actions .Kubectl ().DeleteFile (s .ctx , tcpRouteCrdManifest )
46
+ err := s .TestInstallation .Actions .Kubectl ().DeleteFile (s .Ctx , tcpRouteCrdManifest )
74
47
s .NoError (err , "can delete manifest" )
75
48
76
- err = s .testInstallation .Actions .Kubectl ().ApplyFile (s .ctx , routeWithServiceManifest )
77
- s .Assert ().NoError (err , "can apply gloo.solo.io Route manifest" )
78
-
79
- // apply the service manifest separately, after the route table is applied, to ensure it can be applied after the route table
80
- err = s .testInstallation .Actions .Kubectl ().ApplyFile (s .ctx , serviceManifest )
81
- s .Assert ().NoError (err , "can apply gloo.solo.io Service manifest" )
82
-
83
- s .testInstallation .Assertions .EventuallyObjectsExist (s .ctx , proxyService , proxyDeployment )
84
- s .testInstallation .Assertions .AssertEventualCurlResponse (
85
- s .ctx ,
49
+ s .TestInstallation .Assertions .AssertEventualCurlResponse (
50
+ s .Ctx ,
86
51
defaults .CurlPodExecOpt ,
87
52
[]curl.Option {
88
53
curl .WithHost (kubeutils .ServiceFQDN (proxyService .ObjectMeta )),
89
54
curl .WithHostHeader ("example.com" ),
90
55
},
91
56
expectedSvcResp )
92
57
}
58
+
59
+ func (s * testingSuite ) TestHTTP2AppProtocol () {
60
+ s .TestInstallation .Assertions .AssertEventualCurlResponse (
61
+ s .Ctx ,
62
+ defaults .CurlPodExecOpt ,
63
+ []curl.Option {
64
+ curl .WithHost (kubeutils .ServiceFQDN (proxyService .ObjectMeta )),
65
+ curl .WithHostHeader ("example.com" ),
66
+ curl .WithArgs ([]string {"--http2-prior-knowledge" }),
67
+ },
68
+ expectedHTTP2SvcResp )
69
+ }
0 commit comments