Sha256: 5b1193530da42026f7da45abff6911a8c9c05101e80ac77a6e18c6ad50c1d36f

Contents?: true

Size: 1.67 KB

Versions: 3

Compression:

Stored size: 1.67 KB

Contents

require 'spec_helper'
require_relative '../factories/node.rb'
require_relative '../vagrant_spec_helper.rb'

describe 'Test 11: Node prepared' do

  let(:node) { build(:node) }

  before(:all) do
    node.prepare
  end

  context 'vagrant prepared' do
    describe interface('eth1') do
      it { should have_ipv4_address(node.ip) }
    end

    describe host('node0.server1.test') do
      it { should be_resolvable }
      it { should be_reachable.with( :port => 22 ) }
    end

    describe user('vagrant') do
      it { should exist }
    end
  end

  context 'all environments prepared' do
    describe command('hostname') do
      it 'should configure the hostname' do
        should return_stdout node.hostname
      end
    end

    describe command("dpkg -s #{Bebox::Project.so_dependencies} | grep Status") do
      it 'should install ubuntu dependencies' do
        should return_stdout /(Status: install ok installed\s*){#{Bebox::Project.so_dependencies.split(' ').size}}/
      end
    end

    describe package('puppet') do
      it { should be_installed }
    end

    it 'should create checkpoint' do
      expect(File.exist?("#{node.project_root}/.checkpoints/environments/#{node.environment}/prepared_nodes/#{node.hostname}.yml")).to be (true)
      prepared_node_content = File.read("#{node.project_root}/.checkpoints/environments/#{node.environment}/prepared_nodes/#{node.hostname}.yml").gsub(/\s+/, ' ').strip
      ouput_template = Tilt::ERBTemplate.new('spec/fixtures/node/prepared_node_0.test.erb')
      prepared_node_expected_content = ouput_template.render(nil, node: node).gsub(/\s+/, ' ').strip
      expect(prepared_node_content).to eq(prepared_node_expected_content)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bebox-0.1.5 spec/node0.server1.test/prepare_phase_spec.rb
bebox-0.1.4 spec/node0.server1.test/prepare_phase_spec.rb
bebox-0.1.3 spec/node0.server1.test/prepare_phase_spec.rb