Skip to content

Commit

Permalink
Disable Http on ILB Https e2e tests
Browse files Browse the repository at this point in the history
Set the AllowHttp annotation to false for all L7-ILB HTTPS e2e tests since allowing both
HTTP and HTTPS on the same VIP is not currently supported.
  • Loading branch information
spencerhance committed Sep 28, 2019
1 parent 2f7515d commit 9a3edbd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
13 changes: 9 additions & 4 deletions cmd/e2e-test/ilb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ func TestILB(t *testing.T) {
}
}

// TODO(shance): Remove the SetAllowHttp() calls once L7-ILB supports sharing VIPs
func TestILBHttps(t *testing.T) {
t.Parallel()

Expand All @@ -149,7 +150,8 @@ func TestILBHttps(t *testing.T) {
desc: "https ILB one path, pre-shared cert",
ingBuilder: fuzz.NewIngressBuilder("", ingressPrefix+"1", "").
AddPath("test.com", "/", serviceName, port80).
ConfigureForILB(),
ConfigureForILB().
SetAllowHttp(false),
numForwardingRules: 1,
numBackendServices: 2,
certType: e2e.GCPCert,
Expand All @@ -159,7 +161,8 @@ func TestILBHttps(t *testing.T) {
desc: "https ILB one path, tls",
ingBuilder: fuzz.NewIngressBuilder("", ingressPrefix+"2", "").
AddPath("test.com", "/", serviceName, port80).
ConfigureForILB(),
ConfigureForILB().
SetAllowHttp(false),
numForwardingRules: 1,
numBackendServices: 2,
certType: e2e.K8sCert,
Expand All @@ -170,7 +173,8 @@ func TestILBHttps(t *testing.T) {
ingBuilder: fuzz.NewIngressBuilder("", ingressPrefix+"3", "").
AddPath("test.com", "/foo", serviceName, port80).
AddPath("baz.com", "/bar", serviceName, port80).
ConfigureForILB(),
ConfigureForILB().
SetAllowHttp(false),
numForwardingRules: 1,
numBackendServices: 2,
certType: e2e.GCPCert,
Expand All @@ -181,7 +185,8 @@ func TestILBHttps(t *testing.T) {
ingBuilder: fuzz.NewIngressBuilder("", ingressPrefix+"4", "").
AddPath("test.com", "/foo", serviceName, port80).
AddPath("baz.com", "/bar", serviceName, port80).
ConfigureForILB(),
ConfigureForILB().
SetAllowHttp(false),
numForwardingRules: 1,
numBackendServices: 2,
certType: e2e.K8sCert,
Expand Down
10 changes: 10 additions & 0 deletions pkg/fuzz/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package fuzz

import (
"fmt"
"strconv"
"strings"

"k8s.io/api/core/v1"
Expand Down Expand Up @@ -276,6 +277,15 @@ func (i *IngressBuilder) ConfigureForILB() *IngressBuilder {
return i
}

// SetAllowHttp sets the AllowHTTP annotation on the ingress
func (i *IngressBuilder) SetAllowHttp(val bool) *IngressBuilder {
if i.ing.Annotations == nil {
i.ing.Annotations = make(map[string]string)
}
i.ing.Annotations[annotations.AllowHTTPKey] = strconv.FormatBool(val)
return i
}

// BackendConfigBuilder is syntactic sugar for creating BackendConfig specs for testing
// purposes.
//
Expand Down

0 comments on commit 9a3edbd

Please sign in to comment.