Skip to content
This repository has been archived by the owner on Jun 25, 2023. It is now read-only.

Acceptance tests: vagrant-spec #145

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2015-12-05 08:32:20 +0100 using RuboCop version 0.35.1.
# on 2015-12-06 20:56:09 +0100 using RuboCop version 0.35.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand Down Expand Up @@ -40,7 +40,7 @@ Metrics/AbcSize:
Metrics/CyclomaticComplexity:
Max: 12

# Offense count: 52
# Offense count: 56
# Configuration parameters: AllowURI, URISchemes.
Metrics/LineLength:
Max: 157
Expand Down Expand Up @@ -156,6 +156,12 @@ Style/EmptyLinesAroundModuleBody:
Exclude:
- 'test/landrush/cap/linux/read_host_visible_ip_address_test.rb'

# Offense count: 1
# Configuration parameters: Exclude.
Style/FileName:
Exclude:
- 'vagrant-spec.config.rb'

# Offense count: 6
# Configuration parameters: MinBodyLength.
Style/GuardClause:
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ group :development do

gem 'byebug'
gem 'mocha'
gem 'vagrant-spec', git: 'https://github.com/mitchellh/vagrant-spec.git'
end
2 changes: 2 additions & 0 deletions test/acceptance/base.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require 'vagrant-spec/acceptance'
require_relative 'shared/context_virtualbox'
23 changes: 23 additions & 0 deletions test/acceptance/dns/resolution_host_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
shared_examples 'provider/resolution_host' do |provider, options|
unless options[:box]
fail ArgumentError, "box option must be specified for provider: #{provider}"
end

include_context 'acceptance'

before do
environment.skeleton('landrush_basic')
assert_execute('sed', '-i', '', '-e', "s|{{box}}|#{options[:box]}|g", 'Vagrantfile')
assert_execute('vagrant', 'up', "--provider=#{provider}")
end

after do
assert_execute('vagrant', 'destroy', '--force')
end

it 'sets up DNS resolution on the host' do
result = execute('dig', '+short', '@localhost', '-p', '10053', 'my-host', 'A')
expect(result).to exit_with(0)
expect(result.stdout).to match(/^10.10.10.123$/)
end
end
3 changes: 3 additions & 0 deletions test/acceptance/shared/context_virtualbox.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
shared_context 'provider-context/virtualbox' do
let(:extra_env) { { 'VBOX_USER_HOME' => '{{homedir}}' } }
end
8 changes: 8 additions & 0 deletions test/acceptance/skeletons/landrush_basic/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
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
8 changes: 8 additions & 0 deletions vagrant-spec.config.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require_relative 'test/acceptance/base'

Vagrant::Spec::Acceptance.configure do |c|
c.component_paths = [File.expand_path('../test/acceptance', __FILE__)]
c.skeleton_paths = [File.expand_path('../test/acceptance/skeletons', __FILE__)]

c.provider 'virtualbox', box: 'debian/wheezy64', contexts: ['provider-context/virtualbox']
end