Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: Potentially fix flaky TestConfigureNotAttachedHttpListenerOptions #10596

Merged
merged 2 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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