-
Notifications
You must be signed in to change notification settings - Fork 4
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
Support host (IP address) in parseSeedNodes
#324
Comments
Experiencing some very weird behaviour when expecting a Consider the following: try {
new URL('bad url');
} catch (e) {
if (e instanceof TypeError) {
console.log('This is a TypeError')
}
console.log(e);
} We get the following output:
Running the same code within a jest test: test.only('invalid', () => {
try {
new URL('bad url');
} catch (e) {
if (e instanceof TypeError) {
console.log('This is a TypeError')
}
console.log(e);
}
}); We instead only get the error output: we never enter the
Similarly, when trying to expect the exception to be a test.only('invalid', () => {
expect(() => {
new URL('bad URL');
}).toThrowError(TypeError);
});
Have any of you come across this at all with jest? @CMCDragonkai @tegefaulkes @emmacasolin |
Is Jest messing up native exception classes? |
@tegefaulkes is this still need to be done, or was it solved by #378? |
We need a test or tests here that tests the usage of hostnames, ipv4 hosts (and optionally ipv6 hosts) directly from the command line from We should have these addresses usable:
For now ipv6 will not work, so we can just have a test stub. Like Note that we would not force the usage of |
Looks like |
Tests for this already exist at |
Can you check #324 (comment), to see if that's a problem. We need to confirm if |
So Can you change it up so it can also take in the case where a protocol does in fact exist, and if so, doesn't add a prefix. The adding of the prefix should only be there if a protocol doesn't exist. |
I can replicate the I'm not super sure how to fix this properly. It only really affects the tests and only in a specific way. Since it seems that URL can only throw a |
Yea ok in that case, if you catch any error from |
I just pushed up the changes to staging. I'm closing this issue. |
Specification
parseSeedNodes
currently assumes that the provided address of the seed node is a hostname, and does not provide support for a seed node with an IP address as a host address:Furthermore, it should also provide support for IPv6 addresses - as such, we can no longer rely on a colon/semi-colon
split
usage. It's been suggested to usenew URL
to construct a URL from thenodeId@host:port
format (will require a prependedpk://
'protocol') such that we can acquire the different components of the seed nodes.Additional context
Tasks
new URL
to generate thenodeId@host:port
nodeId@host:port
that's invalid if an exception is raised (it's currently done this way through the use ofsplit
)? Look into this.The text was updated successfully, but these errors were encountered: