Skip to content

Commit 6dd53df

Browse files
committed
TEST: e2e: fix https offload to check the right certificate
1 parent bf3e819 commit 6dd53df

File tree

2 files changed

+2
-21
lines changed

2 files changed

+2
-21
lines changed

deploy/tests/e2e/https/config/ingress.yaml.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ spec:
1515
secretName: haproxy-offload-test
1616
- hosts:
1717
- default.haproxy
18-
secretName: haproxy-offload-test # Another cert to make sure HAProxy picks the right one
18+
secretName: haproxy-default # Another cert to make sure HAProxy picks the right one
1919
{{end}}
2020
rules:
2121
- host: {{ .Host }}

deploy/tests/e2e/https/offload.go

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,13 @@
1717
package https
1818

1919
import (
20-
"encoding/json"
21-
"io/ioutil"
22-
2320
"github.com/haproxytech/kubernetes-ingress/deploy/tests/e2e"
2421
)
2522

2623
func (suite *HTTPSSuite) Test_HTTPS_Offload() {
2724
var err error
2825
suite.NoError(suite.test.DeployYamlTemplate("config/ingress.yaml.tmpl", suite.test.GetNS(), suite.tmplData))
29-
suite.client, err = e2e.NewHTTPSClient(suite.tmplData.Host, 0)
26+
suite.client, err = e2e.NewHTTPSClient("offload-test.haproxy", 0)
3027
suite.NoError(err)
3128
suite.Eventually(func() bool {
3229
res, cls, err := suite.client.Do()
@@ -35,22 +32,6 @@ func (suite *HTTPSSuite) Test_HTTPS_Offload() {
3532
return false
3633
}
3734
defer cls()
38-
body, err := ioutil.ReadAll(res.Body)
39-
if err != nil {
40-
return false
41-
}
42-
type echoServerResponse struct {
43-
OS struct {
44-
Hostname string `json:"hostname"`
45-
} `json:"os"`
46-
}
47-
48-
response := &echoServerResponse{}
49-
err = json.Unmarshal(body, response)
50-
if err != nil {
51-
return false
52-
}
53-
//targetPod := strings.HasPrefix(response.OS.Hostname, "https-offload")
5435
targetCrt := res.TLS.PeerCertificates[0].Subject.CommonName == "offload-test.haproxy"
5536
return targetCrt
5637
}, e2e.WaitDuration, e2e.TickDuration)

0 commit comments

Comments
 (0)