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

chore(ci): fix failing test, upgrade to go 1.23.5 and linter to v1.63 #5013

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mloiseleur
Copy link
Contributor

What does it do ?

  1. Fix failing test on TestServiceSource/Endpoints with example.com
  2. Update go version to 1.23.5
  3. Update linter version to 1.63.4

Motivation

Latest security fixes and working CI.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 17, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from mloiseleur. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot requested a review from szuecs January 17, 2025 20:06
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jan 17, 2025
@ivankatliarchuk
Copy link
Contributor

What was the actual issue?

@mloiseleur
Copy link
Contributor Author

@ivankatliarchuk This issue is on recent PRs:

See for instance on this one:

--- FAIL: TestServiceSource (0.12s)
    --- FAIL: TestServiceSource/Endpoints (0.02s)
        --- FAIL: TestServiceSource/Endpoints/annotated_services_return_an_endpoint_with_hostname_then_resolve_hostname (0.10s)
            service_test.go:1146: Targets expected "23.192.228.84", got "23.192.228.80;23.192.228.84;23.215.0.136;23.215.0.138;96.7.128.175;96.7.128.198"
            service_test.go:1146: Targets expected "2600:1406:3a00:21::173e:2e65", got "2600:1406:3a00:21::173e:2e65;2600:1406:3a00:21::173e:2e66;2600:1406:bc00:53::b81e:94c8;2600:1406:bc00:53::b81e:94ce;2600:1408:ec00:36::1736:7f24;2600:1408:ec00:36::1736:7f31"
FAIL

@mloiseleur
Copy link
Contributor Author

One of the test use a public domain "example.com", which resolve now to multiple IPs v4 and v6 since a few days.

@ivankatliarchuk
Copy link
Contributor

Gotcha. I cannot approve but /lgtm ;-)

@@ -66,6 +66,14 @@ func NewTargets(target ...string) Targets {
return t
}

func NewTargetsFromAddr(targets []netip.Addr) Targets {
Copy link
Contributor

Choose a reason for hiding this comment

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

This function seems to be only required for tests at the moment. Do you want to keep it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure where I should put it.
In the test file ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Would be nice to have clarity accross the project then. There is a well RemoveDuplicates function that only used in single test file endpoints_test.go, but leave endpoints.go and is public.

We could

  1. Leave it as is, it can remain in the endpoint/endpoint.go file, as it deals with operations on Endpoint objects.
  2. we could have endpiont/util.go this will help with codebase organisation a bit
  3. private function in source/service_test.go
  4. There is as well internal/testutils/endpoint.go that have something like test utility functions for endpoints verifications

If it's in endpoint.go file and is public, probably worth to improve it a bit then, in case someone decide to use it production code outside tests

t := make(Targets, len(targets))
for i, target := range targets {
t[i] = target.String()
}
return t

^ avoid repetitive slicing within the loop, taking full advantage of the preallocated capacity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants