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

Start replacing curl pods and using common validation #9979

Open
wants to merge 84 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
cbeea3b
Start replacing curl pods and using common validation
sheidkamp Aug 30, 2024
4ac7a70
Merge main into TestConfigureNotAttachedHttpListenerOptions-fix
soloio-bulldozer[bot] Aug 30, 2024
df8deb3
Merge branch 'main' into TestConfigureNotAttachedHttpListenerOptions-fix
sheidkamp Aug 30, 2024
3187e2f
Merge branch 'TestConfigureNotAttachedHttpListenerOptions-fix' of ssh…
sheidkamp Aug 30, 2024
1376582
another approach
sheidkamp Sep 2, 2024
703aaa8
Update defaults.go
sheidkamp Sep 3, 2024
99b7a42
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 3, 2024
1f232f3
Adding changelog file to new location
Sep 3, 2024
376cdab
Deleting changelog file from old location
Sep 3, 2024
dc1e163
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 5, 2024
bde7710
Adding changelog file to new location
Sep 5, 2024
3cbc1fc
Deleting changelog file from old location
Sep 5, 2024
e22860f
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 5, 2024
e0e3b3c
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 6, 2024
54c1bb5
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 10, 2024
59a899b
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 10, 2024
d1f153c
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 10, 2024
9eb4830
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 11, 2024
a017361
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 11, 2024
56acd17
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 11, 2024
11e7a74
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 11, 2024
60e9552
Adding changelog file to new location
Sep 11, 2024
94c4a93
Deleting changelog file from old location
Sep 11, 2024
3e998b8
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 11, 2024
2e2429a
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 12, 2024
e86533d
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 12, 2024
c2eb3c6
add Resource interface
sheidkamp Sep 13, 2024
4bbdb35
Update defaults.go
sheidkamp Sep 13, 2024
b0c0997
Update defaults.go
sheidkamp Sep 13, 2024
d4f785e
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 13, 2024
d8710e8
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 16, 2024
62b46d9
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 16, 2024
b782898
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 16, 2024
b405aca
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 16, 2024
325675c
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 16, 2024
58caa33
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 17, 2024
574dada
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 17, 2024
04f5a49
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 17, 2024
99be208
Adding changelog file to new location
Sep 17, 2024
2335acd
Deleting changelog file from old location
Sep 17, 2024
eb58c1f
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 18, 2024
c69d67d
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 18, 2024
cf1fe9e
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 19, 2024
5ee51f9
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 19, 2024
7cc0ea9
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 20, 2024
24fb9b5
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 23, 2024
927d795
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 24, 2024
89e32ca
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 24, 2024
5248ce1
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 24, 2024
1aa0c52
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 24, 2024
0bda2ec
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 25, 2024
c9aeba3
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 25, 2024
9afbb4a
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 26, 2024
c2edd26
Adding changelog file to new location
Sep 27, 2024
c92a0c5
Deleting changelog file from old location
Sep 27, 2024
9de2f36
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 27, 2024
63f42fa
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 27, 2024
90b2f4b
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 27, 2024
da9a9be
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 27, 2024
0cd6cea
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 30, 2024
e7325ab
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 30, 2024
2c06cf0
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Sep 30, 2024
fb3cc2f
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Oct 1, 2024
37ed7fa
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Oct 1, 2024
ebb48f0
Adding changelog file to new location
Oct 1, 2024
297eec5
Deleting changelog file from old location
Oct 1, 2024
83f1d82
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Oct 1, 2024
9dd61d7
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Oct 1, 2024
cda8651
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Oct 3, 2024
bc5fbca
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Oct 3, 2024
50e7c53
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Oct 3, 2024
38076d8
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Oct 3, 2024
c6b32ad
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Oct 3, 2024
83b4ebd
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Oct 3, 2024
859af0e
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Oct 3, 2024
e806f6b
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Oct 4, 2024
c9c1b73
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Oct 4, 2024
0a819e1
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Oct 4, 2024
79651c1
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Oct 4, 2024
17e0e81
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Oct 4, 2024
f51737f
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Oct 4, 2024
2dcc680
Adding changelog file to new location
Oct 4, 2024
e3feea8
Deleting changelog file from old location
Oct 4, 2024
5d97da6
Merge refs/heads/main into TestConfigureNotAttachedHttpListenerOption…
soloio-bulldozer[bot] Oct 4, 2024
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
changelog:
- type: FIX
issueLink: https://github.com/solo-io/gloo/issues/9736
resolvesIssue: false
description: >-
Check curl pod is running before starting tests

118 changes: 118 additions & 0 deletions test/kubernetes/e2e/defaults/defaults.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,53 @@
package defaults

import (
"context"
"path/filepath"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/solo-io/gloo/pkg/utils/kubeutils/kubectl"
"github.com/solo-io/gloo/test/kubernetes/e2e"

Check failure on line 13 in test/kubernetes/e2e/defaults/defaults.go

View workflow job for this annotation

GitHub Actions / Lint Checks

could not import github.com/solo-io/gloo/test/kubernetes/e2e (-: import cycle not allowed: import stack: [github.com/solo-io/gloo/test/kubernetes/e2e github.com/solo-io/gloo/test/kubernetes/testutils/assertions github.com/solo-io/gloo/test/kubernetes/e2e/defaults github.com/solo-io/gloo/test/kubernetes/e2e]) (typecheck)
"github.com/solo-io/skv2/codegen/util"
)

type CommonTestSuite interface {
Ctx() context.Context
TestInstallation() *e2e.TestInstallation // DO_NOT_SUBMIT: what to do about solo-projects? uses a struct that embeds this struct
Assert() *assert.Assertions
Resources() []Resource
}

type CommonTestSuiteImpl struct {
suite.Suite
ctx context.Context
ti *e2e.TestInstallation
resources []Resource
}

func (s *CommonTestSuiteImpl) Ctx() context.Context {
return s.ctx
}

func (s *CommonTestSuiteImpl) TestInstallation() *e2e.TestInstallation {
return s.ti
}

func (s *CommonTestSuiteImpl) Resources() []Resource {
return s.resources
}

func NewCommonTestSuiteImpl(ctx context.Context, testInst *e2e.TestInstallation, resources []Resource) *CommonTestSuiteImpl {
return &CommonTestSuiteImpl{
ctx: ctx,
ti: testInst,
resources: resources,
}
}

var (
CurlPodExecOpt = kubectl.PodExecOptions{
Name: "curl",
Expand Down Expand Up @@ -84,3 +122,83 @@
</body>
</html>`
)

// Resource interface
type Resource interface {
Install(s CommonTestSuite)
Delete(s CommonTestSuite)
}

// InstallResources installs multiple resources for the test suite
func InstallResources(s CommonTestSuite) {
for _, r := range s.Resources() {
r.Install(s)
}
}

// DeleteResources deletes multiple resources for the test suite
func DeleteResources(s CommonTestSuite) {
for _, r := range s.Resources() {
r.Delete(s)
}
}

// CurlPodResource
type CurlPodResource struct{}

func (c *CurlPodResource) eventuallyRunning(s CommonTestSuite) {
s.TestInstallation().Assertions.EventuallyPodsRunning(s.Ctx(), CurlPod.ObjectMeta.GetNamespace(), metav1.ListOptions{
LabelSelector: "app.kubernetes.io/name=curl",
})
}

func (c *CurlPodResource) Install(s CommonTestSuite) {
err := s.TestInstallation().Actions.Kubectl().ApplyFile(s.Ctx(), CurlPodManifest)
s.Assert().NoError(err)
c.eventuallyRunning(s)
}

func (c *CurlPodResource) Delete(s CommonTestSuite) {
output, err := s.TestInstallation().Actions.Kubectl().DeleteFileWithOutput(s.Ctx(), CurlPodManifest)
s.Assert().NoError(err, "can delete curl pod")
s.TestInstallation().Assertions.ExpectObjectDeleted(CurlPodManifest, err, output)
}

// func CurlPodEventuallyRunning(s CommonTestSuite) {
// // Check that test resources are running
// s.TestInstallation().Assertions.EventuallyPodsRunning(s.Ctx(), CurlPod.ObjectMeta.GetNamespace(), metav1.ListOptions{
// LabelSelector: "app.kubernetes.io/name=curl",
// })
// }

// func InstallCurlPod(s CommonTestSuite) {
// err := s.TestInstallation().Actions.Kubectl().ApplyFile(s.Ctx(), CurlPodManifest)
// s.Assert().NoError(err)
// CurlPodEventuallyRunning(s)
// }

// func DeleteCurlPod(s CommonTestSuite) {
// output, err := s.TestInstallation().Actions.Kubectl().DeleteFileWithOutput(s.Ctx(), CurlPodManifest)
// s.Assert().NoError(err, "can delete curl pod")
// s.TestInstallation().Assertions.ExpectObjectDeleted(CurlPodManifest, err, output)
// }

// // Or like this?
// func CurlPodEventuallyRunning(ctx context.Context, ti *e2e.TestInstallation) {
// // Check that test resources are running
// ti.Assertions.EventuallyPodsRunning(ctx, CurlPod.ObjectMeta.GetNamespace(), metav1.ListOptions{
// LabelSelector: "app.kubernetes.io/name=curl",
// })
// }

// func InstallCurlPod(ctx context.Context, ti *e2e.TestInstallation, s *suite.Suite) {
// err := ti.Actions.Kubectl().ApplyFile(ctx, CurlPodManifest)
// s.Assert().NoError(err)
// CurlPodEventuallyRunning(ctx, ti)
// }

// func DeleteCurlPod(ctx context.Context, ti *e2e.TestInstallation, s *suite.Suite) {
// output, err := ti.Actions.Kubectl().DeleteFileWithOutput(ctx, CurlPodManifest)
// s.Assert().NoError(err, "can delete curl pod")
// ti.Assertions.ExpectObjectDeleted(CurlPodManifest, err, output)
// }
20 changes: 20 additions & 0 deletions test/kubernetes/e2e/features/headless_svc/gloo_gateway_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/solo-io/gloo/projects/gateway/pkg/defaults"
gloo_defaults "github.com/solo-io/gloo/projects/gloo/pkg/defaults"
"github.com/solo-io/gloo/test/kubernetes/e2e"
testdefaults "github.com/solo-io/gloo/test/kubernetes/e2e/defaults"
testutilsresources "github.com/solo-io/gloo/test/kubernetes/testutils/resources"
"github.com/solo-io/solo-kit/pkg/api/v1/resources"

Expand All @@ -33,6 +34,21 @@ type edgeGatewaySuite struct {
routingManifestFile string
}

// DO_NOT_SUBMIT: better like this or embeddeded like in test/kubernetes/e2e/features/http_listener_options/http_lis_opt_suite.go
func (s *edgeGatewaySuite) Ctx() context.Context {
return s.ctx
}

func (s *edgeGatewaySuite) TestInstallation() *e2e.TestInstallation {
return s.testInstallation
}

func (s *edgeGatewaySuite) Resources() []testdefaults.Resource {
return []testdefaults.Resource{
&testdefaults.CurlPodResource{},
}
}

func NewEdgeGatewayHeadlessSvcSuite(ctx context.Context, testInst *e2e.TestInstallation) suite.TestingSuite {
manifestFile := filepath.Join(testInst.GeneratedFiles.TempDir, EdgeGatewayApiRoutingGeneratedFileName)
return &edgeGatewaySuite{
Expand All @@ -55,6 +71,8 @@ func (s *edgeGatewaySuite) TestEdgeGatewayRoutingHeadlessSvc() {
s.NoError(err, "can delete setup manifest")
s.testInstallation.Assertions.EventuallyObjectsNotExist(s.ctx, headlessService)

testdefaults.DeleteResources(s)

err = s.testInstallation.Actions.Kubectl().DeleteFile(s.ctx, s.routingManifestFile)
s.NoError(err, "can delete setup Edge Gateway API routing manifest")
})
Expand All @@ -66,6 +84,8 @@ func (s *edgeGatewaySuite) TestEdgeGatewayRoutingHeadlessSvc() {
LabelSelector: "app.kubernetes.io/name=nginx",
})

testdefaults.InstallResources(s)

err = s.testInstallation.Actions.Kubectl().ApplyFile(s.ctx, s.routingManifestFile)
s.NoError(err, "can setup Edge Gateway API routing manifest")
// check status of the VirtualService and Upstream to ensure they are accepted
Expand Down
19 changes: 19 additions & 0 deletions test/kubernetes/e2e/features/headless_svc/k8s_gw_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/solo-io/gloo/pkg/utils/kubeutils"
"github.com/solo-io/gloo/pkg/utils/requestutils/curl"
"github.com/solo-io/gloo/test/kubernetes/e2e"
testdefaults "github.com/solo-io/gloo/test/kubernetes/e2e/defaults"
"github.com/solo-io/gloo/test/kubernetes/testutils/resources"
)

Expand All @@ -29,6 +30,20 @@ type k8sGatewaySuite struct {
routingManifestFile string
}

func (s *k8sGatewaySuite) Ctx() context.Context {
return s.ctx
}

func (s *k8sGatewaySuite) TestInstallation() *e2e.TestInstallation {
return s.testInstallation
}

func (s *k8sGatewaySuite) Resources() []testdefaults.Resource {
return []testdefaults.Resource{
&testdefaults.CurlPodResource{},
}
}

func NewK8sGatewayHeadlessSvcSuite(ctx context.Context, testInst *e2e.TestInstallation) suite.TestingSuite {
routingManifestFile := filepath.Join(testInst.GeneratedFiles.TempDir, K8sApiRoutingGeneratedFileName)
return &k8sGatewaySuite{
Expand All @@ -53,6 +68,8 @@ func (s *k8sGatewaySuite) TestConfigureRoutingHeadlessSvc() {
s.NoError(err, "can delete setup manifest")
s.testInstallation.Assertions.EventuallyObjectsNotExist(s.ctx, headlessService)

testdefaults.DeleteResources(s)

err = s.testInstallation.Actions.Kubectl().DeleteFile(s.ctx, s.routingManifestFile)
s.NoError(err, "can delete setup k8s routing manifest")
s.testInstallation.Assertions.EventuallyObjectsNotExist(s.ctx, k8sApiProxyDeployment, k8sApiProxyService)
Expand All @@ -65,6 +82,8 @@ func (s *k8sGatewaySuite) TestConfigureRoutingHeadlessSvc() {
LabelSelector: "app.kubernetes.io/name=nginx",
})

testdefaults.InstallResources(s)

err = s.testInstallation.Actions.Kubectl().ApplyFile(s.ctx, s.routingManifestFile)
s.NoError(err, "can setup k8s routing manifest")

Expand Down
28 changes: 0 additions & 28 deletions test/kubernetes/e2e/features/headless_svc/testdata/setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,3 @@ spec:
ports:
- containerPort: 80
name: http-web-svc
---
apiVersion: v1
kind: Namespace
metadata:
name: curl
---
apiVersion: v1
kind: Pod
metadata:
name: curl
namespace: curl
labels:
app: curl
version: v1
spec:
containers:
- name: curl
image: curlimages/curl:7.83.1
imagePullPolicy: IfNotPresent
command:
- "tail"
- "-f"
- "/dev/null"
resources:
requests:
cpu: "100m"
limits:
cpu: "200m"
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,42 @@ var _ e2e.NewSuiteFunc = NewTestingSuite

// testingSuite is the entire Suite of tests for the "HttpListenerOptions" feature
type testingSuite struct {
suite.Suite
ctx context.Context
testInstallation *e2e.TestInstallation
// maps test name to a list of manifests to apply before the test
//suite.Suite
testdefaults.CommonTestSuiteImpl
// ctx context.Context
// testInstallation *e2e.TestInstallation
// // maps test name to a list of manifests to apply before the test
manifests map[string][]string
}

// DO_NOT_SUBMIT: Better with embedding or writing the methods directly like intest/kubernetes/e2e/features/headless_svc/gloo_gateway_suite.go?
func NewTestingSuite(
ctx context.Context,
testInst *e2e.TestInstallation,
) suite.TestingSuite {
return &testingSuite{
ctx: ctx,
testInstallation: testInst,
CommonTestSuiteImpl: *testdefaults.NewCommonTestSuiteImpl(
ctx,
testInst,
[]testdefaults.Resource{
&testdefaults.CurlPodResource{},
},
),
}
}

func (s *testingSuite) SetupSuite() {
// Check that the common setup manifest is applied
err := s.testInstallation.Actions.Kubectl().ApplyFile(s.ctx, setupManifest)
err := s.TestInstallation().Actions.Kubectl().ApplyFile(s.Ctx(), setupManifest)
s.NoError(err, "can apply "+setupManifest)
s.testInstallation.Assertions.EventuallyObjectsExist(s.ctx, exampleSvc, nginxPod)
s.TestInstallation().Assertions.EventuallyObjectsExist(s.Ctx(), exampleSvc, nginxPod)
// Check that test app is running
s.testInstallation.Assertions.EventuallyPodsRunning(s.ctx, nginxPod.ObjectMeta.GetNamespace(), metav1.ListOptions{
s.TestInstallation().Assertions.EventuallyPodsRunning(s.Ctx(), nginxPod.ObjectMeta.GetNamespace(), metav1.ListOptions{
LabelSelector: "app.kubernetes.io/name=nginx",
})

testdefaults.InstallResources(s)

// include gateway manifests for the tests, so we recreate it for each test run
s.manifests = map[string][]string{
"TestConfigureHttpListenerOptions": {gatewayManifest, basicLisOptManifest},
Expand All @@ -55,8 +64,10 @@ func (s *testingSuite) SetupSuite() {

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)
output, err := s.TestInstallation().Actions.Kubectl().DeleteFileWithOutput(s.Ctx(), setupManifest)
s.TestInstallation().Assertions.ExpectObjectDeleted(setupManifest, err, output)

testdefaults.DeleteResources(s)
}

func (s *testingSuite) BeforeTest(suiteName, testName string) {
Expand All @@ -66,14 +77,14 @@ func (s *testingSuite) BeforeTest(suiteName, testName string) {
}

for _, manifest := range manifests {
err := s.testInstallation.Actions.Kubectl().ApplyFile(s.ctx, manifest)
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{
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",
})
}
Expand All @@ -85,15 +96,15 @@ func (s *testingSuite) AfterTest(suiteName, testName string) {
}

for _, manifest := range manifests {
output, err := s.testInstallation.Actions.Kubectl().DeleteFileWithOutput(s.ctx, manifest)
s.testInstallation.Assertions.ExpectObjectDeleted(manifest, err, output)
output, err := s.TestInstallation().Actions.Kubectl().DeleteFileWithOutput(s.Ctx(), manifest)
s.TestInstallation().Assertions.ExpectObjectDeleted(manifest, err, output)
}
}

func (s *testingSuite) TestConfigureHttpListenerOptions() {
// Check healthy response and response headers contain server name override from HttpListenerOption
s.testInstallation.Assertions.AssertEventualCurlResponse(
s.ctx,
s.TestInstallation().Assertions.AssertEventualCurlResponse(
s.Ctx(),
testdefaults.CurlPodExecOpt,
[]curl.Option{
curl.WithHost(kubeutils.ServiceFQDN(proxyService.ObjectMeta)),
Expand All @@ -110,8 +121,8 @@ func (s *testingSuite) TestConfigureHttpListenerOptions() {

func (s *testingSuite) TestConfigureNotAttachedHttpListenerOptions() {
// Check healthy response and response headers contain default server name as HttpLisOpt isn't attached
s.testInstallation.Assertions.AssertEventualCurlResponse(
s.ctx,
s.TestInstallation().Assertions.AssertEventualCurlResponse(
s.Ctx(),
testdefaults.CurlPodExecOpt,
[]curl.Option{
curl.WithHost(kubeutils.ServiceFQDN(proxyService.ObjectMeta)),
Expand Down
Loading
Loading