Skip to content
This repository has been archived by the owner on Oct 10, 2021. It is now read-only.

Is there a way to know what the ZUUL_PORT is from the tests? #139

Closed
Bockit opened this issue Feb 7, 2015 · 7 comments · Fixed by #149
Closed

Is there a way to know what the ZUUL_PORT is from the tests? #139

Bockit opened this issue Feb 7, 2015 · 7 comments · Fixed by #149

Comments

@Bockit
Copy link

Bockit commented Feb 7, 2015

I have some tests that require some requests to be crossdomain. I am using a support server written to listen on ZUUL_PORT and that works fine. If I log the port and set my tests to use that port for the crossdomain requests after the server starts they work.

Is this exposed at all in the tests so that I don't have that manual step of getting the port number and putting it into my tests?

@defunctzombie
Copy link
Owner

What I have done in the past if needed, is create an endpoint on my support server /port and just fetched that in a before hook using basic ajax.

I think we could expose this and other zuul configs via a ZUUL global without much fuss tho so you wouldn't need to have the above hack.

@vvo
Copy link
Collaborator

vvo commented Feb 11, 2015

Having the current browser + version as an environement var would be very useful too.

@Bockit
Copy link
Author

Bockit commented Feb 12, 2015

Thanks @defunctzombie that sounds like a good workaround. Agreed that eventually it would be nice to have that stuff available.

@rase-
Copy link
Collaborator

rase- commented Feb 18, 2015

@vvo what's the use case you had in mind for the browser and version?

@vvo
Copy link
Collaborator

vvo commented Feb 19, 2015

@rase- :

if (process.env.BROWSER === 'ie8') {
  test('it should work with specific ie8 fallback', function() {

  });
}

Let's say you have an ajax request wrapper which does use XDomainRequest on ie8 then you would
like to test this. Of course feature detection is always better but since we exactly know what's the current tested browser, might be good.

But then in --local mode, this would fail badly.

@rase-
Copy link
Collaborator

rase- commented Feb 19, 2015

Yeah I would strongly prefer feature detection in those cases. It also makes it clearer what exactly the browser should have/should not have for that functionality to exist.

@goloroden
Copy link

@defunctzombie

What I have done in the past if needed, is create an endpoint on my support server /port and just fetched that in a before hook using basic ajax.

Uhm, I don't get this: How do you fetch the /port route if you do not yet know the port?

I think we could expose this and other zuul configs via a ZUUL global without much fuss tho so you wouldn't need to have the above hack.

Is something such as this actually available?

Or: How do I get the ZUUL_PORT from within my tests so that I know what to connect to?

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

Successfully merging a pull request may close this issue.

5 participants