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

fix(trafficrouting): patch VirtualService when there is only one named route #4055

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jeanmorais
Copy link

Fixes #3884

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this is a chore.
  • The title of the PR is (a) conventional with a list of types and scopes found here, (b) states what changed, and (c) suffixes the related issues number. E.g. "fix(controller): Updates such and such. Fixes #1234".
  • I've signed my commits with DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My builds are green. Try syncing with master if they are not.
  • My organization is added to USERS.md.

Copy link
Contributor

github-actions bot commented Jan 16, 2025

Published E2E Test Results

  4 files    4 suites   3h 11m 51s ⏱️
113 tests 104 ✅  7 💤 2 ❌
454 runs  424 ✅ 28 💤 2 ❌

For more details on these failures, see this check.

Results for commit 1fb273b.

♻️ This comment has been updated with latest results.

Copy link
Contributor

github-actions bot commented Jan 16, 2025

Published Unit Test Results

2 296 tests   2 296 ✅  2m 59s ⏱️
  128 suites      0 💤
    1 files        0 ❌

Results for commit 1fb273b.

♻️ This comment has been updated with latest results.

Comment on lines 3162 to 3170
// Test case when the rollout has no managed routes defined
httpRoutes := []VirtualServiceHTTPRoute{
{Name: "foo", Match: nil},
{Name: "", Match: nil},
}

indexes, err := getHttpRouteIndexesToPatch([]string{}, httpRoutes)
assert.NoError(t, err)
assert.Equal(t, []int{1}, indexes)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you wrap each test inside a Run block. For instance,

t.Run("the rollout has no managed routes defined, func(t *testing.T) {
	httpRoutes := []VirtualServiceHTTPRoute{
		{Name: "foo", Match: nil},
		{Name: "", Match: nil},
	}

	indexes, err := getHttpRouteIndexesToPatch([]string{}, httpRoutes)
	assert.NoError(t, err)
	assert.Equal(t, []int{1}, indexes)
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@agaudreault done.

Copy link

sonarqubecloud bot commented Feb 1, 2025

Copy link
Member

@agaudreault agaudreault left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Patch in the VirtualService is not working when there is only one named route
3 participants