Skip to content

Commit d9665b6

Browse files
authored
tests: Potentially fix flaky TestConfigureNotAttachedHttpListenerOptions (#10596)
1 parent 43a49b1 commit d9665b6

File tree

4 files changed

+35
-32
lines changed

4 files changed

+35
-32
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
changelog:
2+
- type: NON_USER_FACING
3+
issueLink: https://github.com/solo-io/gloo/issues/10594
4+
description: Potentially fixes the TestConfigureNotAttachedHttpListenerOptions flake. It was noticed that the second test generally took longer to run since the inital connections to the proxy would fail. This could be because the proxy does not come up in time or the DNS cache became out of date, and we would curl the old IP

test/kubernetes/e2e/features/http_listener_options/http_lis_opt_suite.go

+11-13
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,27 @@ func (s *testingSuite) SetupSuite() {
4848
s.testInstallation.Assertions.EventuallyPodsRunning(s.ctx, testdefaults.CurlPod.GetNamespace(), metav1.ListOptions{
4949
LabelSelector: "app=curl",
5050
})
51+
s.testInstallation.Assertions.EventuallyObjectsExist(s.ctx, proxyService, proxyDeployment)
52+
s.testInstallation.Assertions.EventuallyPodsRunning(s.ctx, proxyDeployment.ObjectMeta.GetNamespace(), metav1.ListOptions{
53+
LabelSelector: "app.kubernetes.io/name=gloo-proxy-gw",
54+
})
5155

5256
// include gateway manifests for the tests, so we recreate it for each test run
5357
s.manifests = map[string][]string{
54-
"TestConfigureHttpListenerOptions": {gatewayManifest, basicLisOptManifest},
55-
"TestConfigureNotAttachedHttpListenerOptions": {gatewayManifest, notAttachedLisOptManifest},
58+
"TestConfigureHttpListenerOptions": {basicLisOptManifest},
59+
"TestConfigureNotAttachedHttpListenerOptions": {notAttachedLisOptManifest},
5660
}
5761
}
5862

5963
func (s *testingSuite) TearDownSuite() {
6064
// Check that the common setup manifest is deleted
6165
output, err := s.testInstallation.Actions.Kubectl().DeleteFileWithOutput(s.ctx, setupManifest)
6266
s.testInstallation.Assertions.ExpectObjectDeleted(setupManifest, err, output)
67+
68+
s.testInstallation.Assertions.EventuallyObjectsNotExist(s.ctx, proxyService, proxyDeployment)
69+
s.testInstallation.Assertions.EventuallyPodsNotExist(s.ctx, proxyDeployment.ObjectMeta.GetNamespace(), metav1.ListOptions{
70+
LabelSelector: "app.kubernetes.io/name=gloo-proxy-gw",
71+
})
6372
}
6473

6574
func (s *testingSuite) BeforeTest(suiteName, testName string) {
@@ -72,13 +81,6 @@ func (s *testingSuite) BeforeTest(suiteName, testName string) {
7281
err := s.testInstallation.Actions.Kubectl().ApplyFile(s.ctx, manifest)
7382
s.Assert().NoError(err, "can apply manifest "+manifest)
7483
}
75-
76-
// we recreate the `Gateway` resource (and thus dynamically provision the proxy pod) for each test run
77-
// so let's assert the proxy svc and pod is ready before moving on
78-
s.testInstallation.Assertions.EventuallyObjectsExist(s.ctx, proxyService, proxyDeployment)
79-
s.testInstallation.Assertions.EventuallyPodsRunning(s.ctx, proxyDeployment.ObjectMeta.GetNamespace(), metav1.ListOptions{
80-
LabelSelector: "app.kubernetes.io/name=gloo-proxy-gw",
81-
})
8284
}
8385

8486
func (s *testingSuite) AfterTest(suiteName, testName string) {
@@ -91,10 +93,6 @@ func (s *testingSuite) AfterTest(suiteName, testName string) {
9193
output, err := s.testInstallation.Actions.Kubectl().DeleteFileWithOutput(s.ctx, manifest)
9294
s.testInstallation.Assertions.ExpectObjectDeleted(manifest, err, output)
9395
}
94-
s.testInstallation.Assertions.EventuallyObjectsNotExist(s.ctx, proxyService, proxyDeployment)
95-
s.testInstallation.Assertions.EventuallyPodsNotExist(s.ctx, proxyDeployment.ObjectMeta.GetNamespace(), metav1.ListOptions{
96-
LabelSelector: "app.kubernetes.io/name=gloo-proxy-gw",
97-
})
9896
}
9997

10098
func (s *testingSuite) TestConfigureHttpListenerOptions() {

test/kubernetes/e2e/features/http_listener_options/testdata/gateway.yaml

-19
This file was deleted.

test/kubernetes/e2e/features/http_listener_options/testdata/setup.yaml

+20
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
kind: Gateway
2+
apiVersion: gateway.networking.k8s.io/v1
3+
metadata:
4+
name: gw
5+
spec:
6+
gatewayClassName: gloo-gateway
7+
listeners:
8+
- protocol: HTTP
9+
port: 8080
10+
name: http
11+
allowedRoutes:
12+
namespaces:
13+
from: Same
14+
- protocol: HTTP
15+
port: 8081
16+
name: other
17+
allowedRoutes:
18+
namespaces:
19+
from: Same
20+
---
121
apiVersion: gateway.networking.k8s.io/v1
222
kind: HTTPRoute
323
metadata:

0 commit comments

Comments
 (0)