This repository has been archived by the owner on Jun 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 78
Acceptance tests: cucumber #182
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,24 @@ | ||
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.my-tld' | ||
config.vm.network :private_network, ip: '10.10.10.123' | ||
|
||
config.landrush.enabled = true | ||
config.landrush.tld = 'my-tld' | ||
end | ||
""" | ||
When I successfully run `bundle exec vagrant up --provider <provider>` | ||
Then the hostname "my-host.my-tld" should resolve to "10.10.10.123" on the internal DNS server | ||
And the hostname "my-host.my-tld" should resolve to "10.10.10.123" on the host | ||
And the hostname "my-host.my-tld" 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,15 @@ | ||
require 'aruba/cucumber' | ||
require 'komenda' | ||
|
||
Aruba.configure do |config| | ||
config.exit_timeout = 300 | ||
config.activate_announcer_on_command_failure = [:stdout, :stderr] | ||
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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is Komenda about in this case? What does it add to the mix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just a simple way to run a shell command. I couldn't easily find something exposed by Aruba (which might be nicer?).