Skip to content

Commit

Permalink
tests: Potentially fix flaky TestConfigureNotAttachedHttpListenerOpti…
Browse files Browse the repository at this point in the history
…ons (#10596)
  • Loading branch information
davidjumani authored Jan 31, 2025
1 parent 43a49b1 commit d9665b6
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 32 deletions.
4 changes: 4 additions & 0 deletions changelog/v1.19.0-beta6/fix-http-listener-flake.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
changelog:
- type: NON_USER_FACING
issueLink: https://github.com/solo-io/gloo/issues/10594
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
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,27 @@ func (s *testingSuite) SetupSuite() {
s.testInstallation.Assertions.EventuallyPodsRunning(s.ctx, testdefaults.CurlPod.GetNamespace(), metav1.ListOptions{
LabelSelector: "app=curl",
})
s.testInstallation.Assertions.EventuallyObjectsExist(s.ctx, proxyService, proxyDeployment)
s.testInstallation.Assertions.EventuallyPodsRunning(s.ctx, proxyDeployment.ObjectMeta.GetNamespace(), metav1.ListOptions{
LabelSelector: "app.kubernetes.io/name=gloo-proxy-gw",
})

// include gateway manifests for the tests, so we recreate it for each test run
s.manifests = map[string][]string{
"TestConfigureHttpListenerOptions": {gatewayManifest, basicLisOptManifest},
"TestConfigureNotAttachedHttpListenerOptions": {gatewayManifest, notAttachedLisOptManifest},
"TestConfigureHttpListenerOptions": {basicLisOptManifest},
"TestConfigureNotAttachedHttpListenerOptions": {notAttachedLisOptManifest},
}
}

func (s *testingSuite) TearDownSuite() {
// Check that the common setup manifest is deleted
output, err := s.testInstallation.Actions.Kubectl().DeleteFileWithOutput(s.ctx, setupManifest)
s.testInstallation.Assertions.ExpectObjectDeleted(setupManifest, err, output)

s.testInstallation.Assertions.EventuallyObjectsNotExist(s.ctx, proxyService, proxyDeployment)
s.testInstallation.Assertions.EventuallyPodsNotExist(s.ctx, proxyDeployment.ObjectMeta.GetNamespace(), metav1.ListOptions{
LabelSelector: "app.kubernetes.io/name=gloo-proxy-gw",
})
}

func (s *testingSuite) BeforeTest(suiteName, testName string) {
Expand All @@ -72,13 +81,6 @@ func (s *testingSuite) BeforeTest(suiteName, testName string) {
err := s.testInstallation.Actions.Kubectl().ApplyFile(s.ctx, manifest)
s.Assert().NoError(err, "can apply manifest "+manifest)
}

// we recreate the `Gateway` resource (and thus dynamically provision the proxy pod) for each test run
// so let's assert the proxy svc and pod is ready before moving on
s.testInstallation.Assertions.EventuallyObjectsExist(s.ctx, proxyService, proxyDeployment)
s.testInstallation.Assertions.EventuallyPodsRunning(s.ctx, proxyDeployment.ObjectMeta.GetNamespace(), metav1.ListOptions{
LabelSelector: "app.kubernetes.io/name=gloo-proxy-gw",
})
}

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

func (s *testingSuite) TestConfigureHttpListenerOptions() {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
kind: Gateway
apiVersion: gateway.networking.k8s.io/v1
metadata:
name: gw
spec:
gatewayClassName: gloo-gateway
listeners:
- protocol: HTTP
port: 8080
name: http
allowedRoutes:
namespaces:
from: Same
- protocol: HTTP
port: 8081
name: other
allowedRoutes:
namespaces:
from: Same
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
Expand Down

0 comments on commit d9665b6

Please sign in to comment.