These are chat archives for spring-cloud/spring-cloud

Mar 2016
Pedro Alvarado
Mar 28 2016 18:08
@dsyer I'm in absolute agreement with regards to not starting a server per test. If I had a choice I would start one and one only. However, I have two profiles to deal with, hence, the port binding problem. That said, I'm not blocked by this issue. I just continue to wonder how would one deal with this scenario where there are no means to pass the random port to a feign client sitting on test side of an integration test.
Spencer Gibb
Mar 28 2016 18:12
@PedroAlvarado we use @RibbonClient with a static server list that has the local.server.port injected
Pedro Alvarado
Mar 28 2016 18:20
@spencergibb Acknowledged. From a previous comment:
"The scenario I'm consdering is using Feign clients to help me write rest integration tests against mvc controllers. Moreover, I'd like to run these tests in parallel while leveraging @WebIntegrationTest(randomPort = true). The limitation I'm running into is not being able to set the port for the many feign clients(e.g. using local.server.port) cross-cuttingly. I know I can use @RibbonClient(name="foo", configuration= StaticServerListOverrideFooConfig.class) however this means I would need to add this annotation in 10s-100s of test classes(multiple times in the cases where an integration uses more then one rest client). I'm wondering if there is some other way to propagate the local port to feign/ribbon. Any ideas are greatly appreciated."
Please let me know your opinion on this approach. If this sounds unreasonable, I'm open to forgo this approach/thought altogether.
Dave Syer
Mar 28 2016 18:48
I don't think we understand yet why you don't a) use fewer server instances, b) use config for locating the server
Spencer Gibb
Mar 28 2016 19:08
You could use @RibbonClients(defaultConfiguration= StaticServerListOverrideFooConfig.class)
Marcin Grzejszczak
Mar 28 2016 19:10
I think I've mentioned that already ^^
Pedro Alvarado
Mar 28 2016 21:39
@dsyer Having simply 2 server instances is enough to run into port in-use issues, unless, we reserve a couple of ports which is what I'm doing at the moment. Probably, a better approach would be to use a random available port which is what I was striving for as it honors the spirit of @WebIntegrationTest(randomPort = true). So yes, the setup you describe is exactly what I'm doing.
@spencergibb I forgot @marcingrzejszczak had suggested that option. That sounds exactly like what I need and I'll try it shortly.
Mar 28 2016 22:28
@spencergibb : We are using zuul and one of our downstream ui is trying to read end clinet ip address and it is getting zuul host aip address , am I missing something ? Please help.