Skip to content

Commit 89d2622

Browse files
MerricdeLauneyGerg
andcommitted
WIP: Envoy tests use HTTP/2
- Validate that Envoy proxy can handle HTTP/2 requests - Currently does not pass, we believe because test app does not serve HTTP/2 traffic. This reflects an issue with using ALPN: Envoy will negotiate h2 and forward HTTP/2 traffic to an app that might not be able to speak HTTP/2. [#177667830] [cloudfoundry/routing-release#200] Co-authored-by: Greg Cobb <[email protected]>
1 parent c8d03e7 commit 89d2622

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

cell/instance_identity_test.go

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333
"code.cloudfoundry.org/lager/lagertest"
3434
"code.cloudfoundry.org/localip"
3535
"code.cloudfoundry.org/rep/cmd/rep/config"
36+
"golang.org/x/net/http2"
3637

3738
"crypto/tls"
3839
"crypto/x509"
@@ -50,7 +51,7 @@ import (
5051

5152
const GraceBusyboxImageURL = "docker:///cfdiegodocker/grace"
5253

53-
var _ = Describe("InstanceIdentity", func() {
54+
var _ = FDescribe("InstanceIdentity", func() {
5455
var (
5556
validityPeriod time.Duration
5657
cellProcess ifrit.Process
@@ -97,7 +98,7 @@ var _ = Describe("InstanceIdentity", func() {
9798
}
9899

99100
client = http.Client{}
100-
client.Transport = &http.Transport{
101+
client.Transport = &http2.Transport{
101102
TLSClientConfig: &tls.Config{
102103
InsecureSkipVerify: false,
103104
RootCAs: rootCAs,
@@ -333,7 +334,7 @@ var _ = Describe("InstanceIdentity", func() {
333334
if runtime.GOOS == "windows" {
334335
Skip("unable to find the equivalant command in windows even after using curl.exe (see https://github.com/curl/curl/issues/2262)")
335336
}
336-
output = runTaskAndGetCommandOutput(fmt.Sprintf("curl --silent -k --cert /etc/cf-instance-credentials/instance.crt --key /etc/cf-instance-credentials/instance.key https://%s", url), []string{})
337+
output = runTaskAndGetCommandOutput(fmt.Sprintf("curl --http2 --silent -k --cert /etc/cf-instance-credentials/instance.crt --key /etc/cf-instance-credentials/instance.key https://%s", url), []string{})
337338
})
338339

339340
It("successfully connects", func() {
@@ -438,7 +439,7 @@ var _ = Describe("InstanceIdentity", func() {
438439

439440
Context("when an invalid cipher is used", func() {
440441
BeforeEach(func() {
441-
client.Transport = &http.Transport{
442+
client.Transport = &http2.Transport{
442443
TLSClientConfig: &tls.Config{
443444
InsecureSkipVerify: false,
444445
RootCAs: rootCAs,
@@ -453,10 +454,25 @@ var _ = Describe("InstanceIdentity", func() {
453454
})
454455
})
455456

456-
It("should have a container with envoy enabled on it", func() {
457+
FIt("should have a container with envoy enabled on it", func() {
457458
Eventually(connect, 10*time.Second).Should(Succeed())
458459
})
459460

461+
FContext("If I'm HTTP/1.1", func() {
462+
BeforeEach(func() {
463+
client.Transport = &http.Transport{
464+
TLSClientConfig: &tls.Config{
465+
InsecureSkipVerify: false,
466+
RootCAs: rootCAs,
467+
},
468+
}
469+
})
470+
471+
FIt("should have a container with envoy enabled on it", func() {
472+
Eventually(connect, 10*time.Second).Should(Succeed())
473+
})
474+
})
475+
460476
Context("when rep is configured for mutual tls", func() {
461477
var (
462478
caCertContent []byte
@@ -476,7 +492,7 @@ var _ = Describe("InstanceIdentity", func() {
476492
tlsCert, err := tls.LoadX509KeyPair(string(serverCert), string(serverKey))
477493
Expect(err).NotTo(HaveOccurred())
478494

479-
client.Transport = &http.Transport{
495+
client.Transport = &http2.Transport{
480496
TLSClientConfig: &tls.Config{
481497
InsecureSkipVerify: false,
482498
RootCAs: rootCAs,
@@ -570,7 +586,7 @@ var _ = Describe("InstanceIdentity", func() {
570586
wrongTlsCert, err := tls.LoadX509KeyPair(string(wrongServerCert), string(wrongServerKey))
571587
Expect(err).NotTo(HaveOccurred())
572588

573-
client.Transport = &http.Transport{
589+
client.Transport = &http2.Transport{
574590
TLSClientConfig: &tls.Config{
575591
InsecureSkipVerify: false,
576592
RootCAs: rootCAs,

0 commit comments

Comments
 (0)