redhat-cip / openstack-serverspec

The serverspec tests for the puppet-openstack-cloud module
Apache License 2.0
12 stars 13 forks source link

Use env vars to pass host and not exclusion filters #50

Closed bodepd closed 9 years ago

bodepd commented 10 years ago

Exclusion filters should not be used to pass the host name. They are an rspec feature that is not intended to pass arbitrary information.

In my use case, where I need to specify ip addresses as the address.

This patch updates the Rakefile and spec_helper to pass hostnames as the TARGET_HOST env var ( which matches the multi-host example from http://serverspec.org/advanced_tips.html

bodepd commented 10 years ago

As an FYI, this looks like it works as expected, but I still need to do some additional testing. I wanted to go ahead and push the code up for review to at least make sure this is an acceptable patch.

lebauce commented 10 years ago

You're right, using exclusion filters definitely is a hack (introduced by the commit 32a9a075a8e57924f96c1aa96518ea55abce0742) but at the time, using the TARGET_HOST env variable triggered an odd bug that caused serverspec to pick the wrong host (in spec/spec_helper.rb).

Maybe we should give the TARGET_HOST env variable a try again though

bodepd commented 10 years ago

my specific issue is that I cannot pass an ip address as host (in the cloud provider that I'm using, this is going to be the best way to refer to my nodes). The Rspec option parser tries to convert the ip to a float and fails.

I'm haven't gotten this to work yet, it's currently only running tests for one host and not the 2 that I specified in my arch.yaml. Once I can everything working with that patch (and tests passing!) I'l let you know and hopefully you would consider merging it!

thanks

bodepd commented 10 years ago

I tried this out with multiple hosts and it worked perfectly