Question

We are planning to migrate our java web application build environment to Cloudbees but one aspect is currently blocking us. We are developing a multi-tenant application. It uses host subdomain to identify tenants and we use wildcard dns entries to do that in production (e.g. : *.example.com).

In development, we have hardcoded a few entries in our hosts file to mimic that. Those entries are enough to run our tests :

...
127.0.0.1   test1.app.dev
127.0.0.1   test2.app.dev
127.0.0.1   test3.app.dev
127.0.0.1   test4.app.dev

So basically, Jenkins should set the hosts file, then launch our app using our web container locally. Then the test suite is executed against the running web app.

I tried to add a pre-process step in the Jenkins project configuration to edit the hosts file but as expected, the Jenkins job does not have permission to do that.

Is there a way to change the hosts file before my test suite is run? Or is there something else we could do to simulate wildcard dns entries?

Was it helpful?

Solution

You could use the xip.io service from 37signals:

http://37signals.com/svn/posts/3191-announcing-pow-040-with-xipio-support

Thus your host names would be

  • test1.127.0.0.1.xip.io
  • test2.127.0.0.1.xip.io
  • test3.127.0.0.1.xip.io
  • test4.127.0.0.1.xip.io

I'd personally try and keep these in a centrally configured area, just in case the xip.io service was decommissioned, but it's probably fairly cheap to operate and so should be around for a while at least.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top