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

Running "make test" fails in random ways in TestValidatePorts on WSL #17268

Closed
rmsilva1973 opened this issue Sep 19, 2023 · 8 comments
Closed
Assignees
Labels
kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@rmsilva1973
Copy link
Contributor

rmsilva1973 commented Sep 19, 2023

What Happened?

Running "make test" on WSL fails with random ports on TestValidatePorts. Here are two samples:

--- FAIL: TestValidatePorts (0.00s)
--- FAIL: TestValidatePorts/0-1:80-81/udp (0.00s)
start_test.go:742: validatePorts(ports=[0-1:80-81/udp]): got Sorry, you cannot use privileged ports on the host (below 1024): 1, expected Sorry, one of the ports provided with --ports flag is outside range: 0

--- FAIL: TestValidatePorts (0.00s)
--- FAIL: TestValidatePorts/127.0.0.1:80-83:80-83/udp (0.00s)
start_test.go:742: validatePorts(ports=[127.0.0.1:80-83:80-83/udp]): got Sorry, you cannot use privileged ports on the host (below 1024): 83, expected Sorry, you cannot use privileged ports on the host (below 1024): 80

Tracking down the reason for this, I think it's due to the assumption that this loop on a map object returns the elements in an ordered way:

for exposedPort, portBindings := range portBindingsMap {
exposedPorts = append(exposedPorts, exposedPort.Port())
for _, portBinding := range portBindings {
hostPorts = append(hostPorts, portBinding.HostPort)
}
}

But apparently this doesn't seem to be true. Thus the test for ports "127.0.0.1:80-83:80-83/udp" like the example above returns an error validating a port different than 80 initially (83 in the specific run depicted above).

If my statement is correct, I have a proposal: add a "hasRegex" field to the structs inside the portTest array whose definition begins here:

var tests = []portTest{

like this:

var tests = []portTest{
    {
        isTarget: isMicrosoftWSL,
	ports:    []string{"127.0.0.1:80-83:80-83/tcp"},
        hasRegex: true,               
	errorMsg: "Sorry, you cannot use privileged ports on the host (below 1024): 8[0-3]",
    },

and then apply and validate the errorMsg using the regex when required. It seems better than assuming every errorMsg has regex since we'll be splattering escape characters all over them.

Another idea would be to search the first port and validate only that one. But this seems to be a rather lame way to handle it.

Attach the log file

Validation error samples:

--- FAIL: TestValidatePorts (0.00s)
--- FAIL: TestValidatePorts/0-1:80-81/udp (0.00s)
start_test.go:742: validatePorts(ports=[0-1:80-81/udp]): got Sorry, you cannot use privileged ports on the host (below 1024): 1, expected Sorry, one of the ports provided with --ports flag is outside range: 0

--- FAIL: TestValidatePorts (0.00s)
--- FAIL: TestValidatePorts/127.0.0.1:80-83:80-83/udp (0.00s)
start_test.go:742: validatePorts(ports=[127.0.0.1:80-83:80-83/udp]): got Sorry, you cannot use privileged ports on the host (below 1024): 83, expected Sorry, you cannot use privileged ports on the host (below 1024): 80

Operating System

Ubuntu

Driver

N/A

@rmsilva1973
Copy link
Contributor Author

/assign rmsilva1973

@rmsilva1973
Copy link
Contributor Author

rmsilva1973 commented Sep 19, 2023

Will create a PR. Will wait a little bit for the opinions on the proposed alternatives (or any other additional considerations).

@rmsilva1973
Copy link
Contributor Author

/kind failing-test

@k8s-ci-robot k8s-ci-robot added the kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. label Sep 19, 2023
@rmsilva1973
Copy link
Contributor Author

@spowelljr any considerations on this? 😁

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 29, 2024
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Feb 28, 2024
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

@k8s-ci-robot
Copy link
Contributor

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

No branches or pull requests

3 participants