-
Notifications
You must be signed in to change notification settings - Fork 956
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
Assign emulator ports and resolve hostnames upfront. #5083
Conversation
// Listening on multiple addresses to maximize the chance of discovery. | ||
hub: false, | ||
|
||
// TODO: Modify the following emulators to listen on multiple addresses. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: Do want this to happen in the same release or later?
Codecov ReportBase: 55.97% // Head: 56.04% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #5083 +/- ##
==========================================
+ Coverage 55.97% 56.04% +0.06%
==========================================
Files 306 307 +1
Lines 20484 20629 +145
Branches 4135 4164 +29
==========================================
+ Hits 11466 11561 +95
- Misses 8036 8068 +32
- Partials 982 1000 +18
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Description
This PR explicitly resolves hostnames like
localhost
to IP addresses like127.0.0.1
,::1
before listening for each emulator and assigns all the ports all at once early in the process.It also modifies the Emulator Hub to listen on as many addresses as it can to increase the chance of successful discovery (no matter the client is v4- or v6-only). If we like what we're seeing here, we can apply this to most other Node.js-based emulators (see comments inline).
The new test process use the more reliable net Socket instead of
tcp-port-used
. There's only one instance of it left to test for port closed (occupied by emulator), and I wonder if we still need it. (Also, the new test process is more or less similar toportfinder
and maybe we can remove the dependency of it one day, after we update all the other usages.)Since the ports are all allocated early, this may fix the frameworks autoinit integration.
Scenarios Tested
Manually started the emulators, observed what ports are allocated with
--debug
, including when ports are partially occupied. ProTip: You can occupy a specific address withpython3 -m http.server --bind ::1 9999
IPv4 (or127.0.0.1
for IPv4). I've tested that when the preferred IPv4 address is occupied, the process gives an error. A warning is given when secondary addresses are occupied.Sample Commands