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

fix(devtools): Changed FakeOutlineTunnel to check for ip and not tag #1666

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

Conversation

andreevgy
Copy link
Contributor

Hello!

I was trying to launch project locally to play around and try to implement one of the features requested in the issues here.
I noticed that fake servers do not give any errors when I try to connect to them and looks like it's because host is used not instead of the tag. So I replaced tags with ips for the ease of work.

Hope it helps and I did not miss any bigger context.

@andreevgy andreevgy requested a review from a team as a code owner July 16, 2023 16:19
@@ -24,12 +24,12 @@ export class FakeOutlineTunnel implements Tunnel {

constructor(public readonly id: string) {}

private playBroken(hostname?: string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks @andreevgy for the contribution. I would suggest to use tag instead of host IP because we might introduce multiple mocked broken/unreachable tunnels.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry for long reply, with busy with work. But tag does not get passed on this level, so it's not accessible and because of it it's broken. Do we want to pass it here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it, then I think it's OK to use the IP address here. But I would recommend to export them as consts instead of using them as magic strings, and use these consts both here and in main.ts. Maybe:

export const FAKE_BROKEN_HOST = "...";
export const FAKE_UNREACHABLE_HOST = "...";

Copy link
Collaborator

@fortuna fortuna Aug 7, 2023

Choose a reason for hiding this comment

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

I don't understand. If you can specify the hostname, you can just specify a domain name with the corresponding patterns. No need to use IPs, which are not readable. The hostname is a lot clearer.

Copy link
Collaborator

Choose a reason for hiding this comment

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

For example: "broken.example.com" or "unreachable.example.com".
This is way better, as it lets use have multiple servers and trigger many behaviors, with the name reflecting the behavior.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@fortuna should I make this change in separate MR in that case?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you clarify what you are trying to accomplish?
You can already test errors by adding servers with the appropriate host names.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right that it can be tested by adding servers with appropriate host names. But there are default mock ones named "broken" and "unreachable" that do not behave like that. That's what I tried to fix first by checking IP address because tag is not passed all the way here. I thought you meant that instead of ip address we can set certain hostname to mock broken server and that's why I am asking if I should open another MR or do changes here. Because default mock servers that I see now first time launching dev environment are "working" just fine.

Copy link
Collaborator

@fortuna fortuna left a comment

Choose a reason for hiding this comment

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

I believe we can revert this PR, since you can already achieve what you need with proper host names (not the service name in the tag).

@@ -24,12 +24,12 @@ export class FakeOutlineTunnel implements Tunnel {

constructor(public readonly id: string) {}

private playBroken(hostname?: string) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

For example: "broken.example.com" or "unreachable.example.com".
This is way better, as it lets use have multiple servers and trigger many behaviors, with the name reflecting the behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants