forked from vagrant-landrush/landrush
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue vagrant-landrush#136 Adding basic cucumber/aruba acceptance test
- Loading branch information
1 parent
7fa055d
commit af2a879
Showing
9 changed files
with
137 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# config/cucumber.yml | ||
##YAML Template | ||
--- | ||
default: --profile html | ||
|
||
pretty: --format pretty -b | ||
html: --format progress --format html --out=build/features_report.html -b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Feature: dns_resolution | ||
Landrush should make a virtual machine's IP address DNS-resolvable. | ||
|
||
Scenario Outline: booting a box | ||
Given a file named "Vagrantfile" with: | ||
""" | ||
Vagrant.configure('2') do |config| | ||
config.vm.box = '<box>' | ||
config.vm.hostname = 'my-host.landrush-acceptance-test' | ||
config.vm.network :private_network, ip: '10.10.10.123' | ||
config.vm.synced_folder '.', '/vagrant', disabled: true | ||
config.landrush.enabled = true | ||
config.landrush.tld = 'landrush-acceptance-test' | ||
end | ||
""" | ||
When I successfully run `bundle exec vagrant up --provider <provider>` | ||
Then the hostname "my-host.landrush-acceptance-test" should resolve to "10.10.10.123" on the internal DNS server | ||
And the hostname "my-host.landrush-acceptance-test" should resolve to "10.10.10.123" on the host | ||
And the hostname "my-host.landrush-acceptance-test" should resolve to "10.10.10.123" on the guest | ||
|
||
Examples: | ||
| box | provider | | ||
| debian/jessie64 | virtualbox | | ||
#| ubuntu/wily64 | virtualbox | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
require 'landrush/server' | ||
|
||
Then(/^the hostname "([^"]+)" should resolve to "([^"]+)" on the internal DNS server$/) do |host, ip| | ||
port = Landrush::Server.port | ||
resolver = Resolv::DNS.new(:nameserver_port => [['localhost', port]], :search => ['local'], :ndots => 1) | ||
ip_resolved = resolver.getaddress(host).to_s | ||
expect(ip_resolved).to eq(ip) | ||
end | ||
|
||
Then(/^the hostname "([^"]+)" should resolve to "([^"]+)" on the host$/) do |host, ip| | ||
addrinfo = Addrinfo.getaddrinfo(host, nil, Socket::AF_INET) | ||
ip_resolved = addrinfo.first.ip_address | ||
expect(ip_resolved).to eq(ip) | ||
end | ||
|
||
Then(/^the hostname "([^"]+)" should resolve to "([^"]+)" on the guest/) do |host, ip| | ||
run("vagrant ssh -c \"dig +short '#{host}' A\"") | ||
expect(last_command_started).to have_output(/^#{ip}$/) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require 'aruba/cucumber' | ||
require 'komenda' | ||
|
||
Aruba.configure do |config| | ||
config.exit_timeout = 300 | ||
config.activate_announcer_on_command_failure = [:stdout, :stderr] | ||
config.working_directory = 'build/aruba' | ||
end | ||
|
||
After do |_scenario| | ||
Komenda.run('bundle exec vagrant landrush stop', fail_on_fail: true) | ||
|
||
if File.exist?(File.join(aruba.config.working_directory, 'Vagrantfile')) | ||
Komenda.run('bundle exec vagrant destroy -f', cwd: aruba.config.working_directory, fail_on_fail: true) | ||
end | ||
end |