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

Improving VHO tests in an attempt to investigate a bug #10385

Merged
merged 25 commits into from
Nov 26, 2024
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
b3771ca
Improving tests in an attempt to better expose the underlying bug
ryanrolds Nov 21, 2024
80fb3e2
Comments and renamed a function
ryanrolds Nov 21, 2024
f675dde
Test adjustments
ryanrolds Nov 21, 2024
2788f08
Added changelog
ryanrolds Nov 21, 2024
442e488
Moved changelog
ryanrolds Nov 21, 2024
d07708f
Fixing issue with test failure
ryanrolds Nov 22, 2024
c4a1aac
Merge branch 'main' into rolds/cleanup_vhost_opts_suite
ryanrolds Nov 22, 2024
87f1c4c
Adjusting how I'm applying a resource that is expected to fail
ryanrolds Nov 22, 2024
7dd22dd
Merge branch 'rolds/cleanup_vhost_opts_suite' of ssh://github.com/sol…
ryanrolds Nov 22, 2024
f985e4b
Merge branch 'main' into rolds/cleanup_vhost_opts_suite
ryanrolds Nov 22, 2024
cf6ad8c
Merge branch 'main' into rolds/cleanup_vhost_opts_suite
ryanrolds Nov 22, 2024
e8d06e2
Trying to address issue with rejection test
ryanrolds Nov 22, 2024
f063979
Merge branch 'rolds/cleanup_vhost_opts_suite' of ssh://github.com/sol…
ryanrolds Nov 22, 2024
c70d642
Fixed issue with checking wrong resource is deleted
ryanrolds Nov 22, 2024
46745ee
Merge branch 'main' into rolds/cleanup_vhost_opts_suite
ryanrolds Nov 22, 2024
7b072bc
Merge branch 'main' into rolds/cleanup_vhost_opts_suite
nfuden Nov 25, 2024
1cef969
Merge branch 'main' into rolds/cleanup_vhost_opts_suite
ryanrolds Nov 25, 2024
a9e3343
Adding changelog file to new location
Nov 25, 2024
a22f7d6
Deleting changelog file from old location
Nov 25, 2024
7d6a543
Merge branch 'main' into rolds/cleanup_vhost_opts_suite
ryanrolds Nov 25, 2024
9f78bc7
Merge branch 'main' into rolds/cleanup_vhost_opts_suite
ryanrolds Nov 26, 2024
7d8598b
Merge branch 'main' into rolds/cleanup_vhost_opts_suite
ryanrolds Nov 26, 2024
2b93f93
Merge branch 'main' into rolds/cleanup_vhost_opts_suite
ryanrolds Nov 26, 2024
fb62a25
Merged assertions
ryanrolds Nov 26, 2024
2549794
Merge branch 'main' into rolds/cleanup_vhost_opts_suite
ryanrolds Nov 26, 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
Prev Previous commit
Next Next commit
Trying to address issue with rejection test
ryanrolds committed Nov 22, 2024
commit e8d06e299a2da4248eec81d80ee476cfc4cf2611
Original file line number Diff line number Diff line change
@@ -134,13 +134,23 @@ func (s *testingSuite) TestConfigureVirtualHostOptions() {
// TestConfigureInvalidVirtualHostOptions confirms that an invalid VirtualHostOption is rejected
func (s *testingSuite) TestConfigureInvalidVirtualHostOptions() {
s.T().Cleanup(func() {
if s.testInstallation.Metadata.ValidationAlwaysAccept {
// delete the VHO
output, err := s.testInstallation.Actions.Kubectl().DeleteFileWithOutput(s.ctx, manifestVhoWebhookReject)
s.testInstallation.Assertions.ExpectObjectDeleted(manifestVhoWebhookReject, err, output)
}
output, err := s.testInstallation.Actions.Kubectl().DeleteFileWithOutput(s.ctx, manifestVhoRemoveXBar)
s.testInstallation.Assertions.ExpectObjectDeleted(manifestVhoRemoveXBar, err, output)

output, err = s.testInstallation.Actions.Kubectl().DeleteFileWithOutput(s.ctx, manifestVhoWebhookReject)
s.testInstallation.Assertions.ExpectObjectDeleted(manifestVhoWebhookReject, err, output)
})

err := s.testInstallation.Actions.Kubectl().ApplyFile(s.ctx, manifestVhoRemoveXBar)
s.NoError(err, "can apply "+manifestVhoRemoveXBar)

// Check status is accepted on VirtualHostOption
s.testInstallation.Assertions.EventuallyResourceStatusMatchesState(
s.getterForMeta(&vhoRemoveXBar),
core.Status_Accepted,
defaults.KubeGatewayReporter,
)

output, err := s.testInstallation.Actions.Kubectl().ApplyFileWithOutput(s.ctx, manifestVhoWebhookReject)
s.testInstallation.Assertions.ExpectObjectAdmitted(manifestVhoWebhookReject, err, output,
"Validating *v1.VirtualHostOption failed")
@@ -159,6 +169,16 @@ func (s *testingSuite) TestConfigureInvalidVirtualHostOptions() {
defaults.KubeGatewayReporter,
)
}

// Check healthy response with no x-bar header
s.testInstallation.Assertions.AssertEventualCurlResponse(
s.ctx,
testdefaults.CurlPodExecOpt,
[]curl.Option{
curl.WithHost(kubeutils.ServiceFQDN(proxyService.ObjectMeta)),
curl.WithHostHeader("example.com"),
},
expectedResponseWithoutXBar)
}

// TestConfigureVirtualHostOptionsWithSectionName tests a complex scenario where multiple VirtualHostOptions conflicting