Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

test: prevent apptest from choosing ports in use#12580

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Emyrk merged 1 commit intomainfromstevenmasley/app_test_flake
Mar 14, 2024

Conversation

Emyrk
Copy link
Member

Apptest requires a port without a listening server to test failure cases. This port was chosen and had a chance of actually being provisioned. To prevent this accident, a port <1k is chosen, since those will never be allocated.

Closes 2/3 of#12531 (comment)

One of the flakes (#12531 (comment)) looks different.

I am able to reproduce the exact error if I spin up a server on65535. I think this fix should prevent this in future.

Apptest requires a port without a listening server to test failurecases. This port was chosen and had a chance of actually beingprovisioned. To prevent this accident, a port <1k is chosen,since those will never be allocated.
@EmyrkEmyrk changed the titletest: apptest was accidently choosing ports in usetest: prevent apptest from choosing ports in useMar 13, 2024
// Ports <1k will never be selected. 396 is for some old OS over IP.
// It will never likely be provisioned. Using quick timeout since
// it's all localhost
fakeAppURL := "http://127.1.0.1:396"
Copy link
Contributor

Choose a reason for hiding this comment

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

AFAIK ports <1024 are privileged.
Does the test suite run as root?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

They do not. We do not want a listener on this port. So the fact they are privileged is what I am hoping for 👍

Copy link
Member

Choose a reason for hiding this comment

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

Essentially we want a port that will never be listened on in our tests. If we listen on port 0, then read the port and close the listener, there's a potential that another test will take that port that we hope nothing will listen on.

Using a port < 1024 and on an uncommon app as the URL for a "not running" app should serve our use case here. We're just dialing it to make sure it's not in use and then failing fast if it is.

Copy link
Member

Choose a reason for hiding this comment

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

It's unfortunate, but to do this in a less potentially flakey way we would need to stub out the dialer somehow. In CI and on dev machines though I don't expect this port to ever be in use so I doubt we'll ever hit this problem

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice, thanks for the explanation 👍

@EmyrkEmyrk merged commit4cba83b intomainMar 14, 2024
@EmyrkEmyrk deleted the stevenmasley/app_test_flake branchMarch 14, 2024 13:54
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsMar 14, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@dannykoppingdannykoppingdannykopping left review comments

@deansheatherdeansheatherdeansheather approved these changes

Assignees

@EmyrkEmyrk

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@Emyrk@dannykopping@deansheather

[8]ページ先頭

©2009-2025 Movatter.jp