Module: Beaker::DSL

Includes:
Assertions, Helpers, InstallUtils, Outcomes, Patterns, Roles, Structure, TestTagging, Wrappers
Included in:
TestCase
Defined in:
lib/beaker/dsl.rb,
lib/beaker/dsl/roles.rb,
lib/beaker/dsl/helpers.rb,
lib/beaker/dsl/outcomes.rb,
lib/beaker/dsl/patterns.rb,
lib/beaker/dsl/wrappers.rb,
lib/beaker/dsl/structure.rb,
lib/beaker/dsl/assertions.rb,
lib/beaker/dsl/test_tagging.rb,
lib/beaker/dsl/install_utils.rb,
lib/beaker/dsl/helpers/web_helpers.rb,
lib/beaker/dsl/helpers/host_helpers.rb,
lib/beaker/dsl/helpers/test_helpers.rb,
lib/beaker/dsl/helpers/hocon_helpers.rb,
lib/beaker/dsl/helpers/facter_helpers.rb,
lib/beaker/dsl/install_utils/pe_defaults.rb,
lib/beaker/dsl/install_utils/windows_utils.rb

Overview

This is a catch all module for including Puppetlabs home grown testing DSL. This module is mixed into TestCase and can be mixed into any test runner by defining the methods that it requires to interact with. If not all of the functionality is required sub modules of the DSL may be mixed into a test runner of your choice.

Currently most DSL modules require #logger and #hosts defined. #logger should provided the methods #debug, #warn and #notify and may be a wrapper to any logger you wish (or Logger). #hosts should return an array of objects which conform to the interface defined in Host (primarily it should provide Hash like access and interfaces like Host#exec, Host#do_scp_to, and Host#do_scp_from.

Examples:

Writing a complete testcase to be ran by the builtin test runner.

test_name 'Ensure My App Starts Correctly' do
  confine :except, :platform => ['windows', 'solaris']

  teardown do
    on master, puppet('resource mything ensure=absent')
    on agents, 'kill -9 allTheThings'
  end

  step 'Ensure Pre-Requisites are Installed' do
  end

  with_puppet_running_on master, :master, :logdest => '/tmp/blah' do

    step 'Run Startup Script' do
    end

    step 'And... Did it work?' do
    end
  end
end

Writing an Example to be ran within RSpec

#=> spec_helper.rb
  RSpec.configure do |c|
    c.include 'beaker/dsl/helpers'
    c.include 'beaker/dsl/rspec/matchers'
    c.include 'beaker/dsl/rspec/expectations'
    c.include 'beaker/host'
  end

#=> my_acceptance_spec.rb
require 'spec_helper'

describe 'A Test With RSpec' do
  let(:hosts)  { Host.new('blah', 'blah', 'not helpful') }
  let(:logger) { Where.is('the', 'rspec', 'logger')      }

  after do
    on master, puppet('resource mything ensure=absent')
    on agents, 'kill -9 allTheThings'
  end

  it 'tests stuff?' do
    result = on( hosts.first, 'ls ~' )
    expect( result.stdout ).to match /my_file/
  end
end

Defined Under Namespace

Modules: Assertions, Helpers, InstallUtils, Outcomes, Patterns, Roles, Structure, TestTagging, Wrappers

Constant Summary

Constants included from InstallUtils::PEDefaults

InstallUtils::PEDefaults::PE_DEFAULTS

Instance Attribute Summary

Attributes included from Assertions

#assertions

Class Method Summary collapse

Methods included from TestTagging

#tag

Methods included from Patterns

#block_on

Methods included from InstallUtils::PEDefaults

#add_pe_defaults_on, #add_platform_pe_defaults, #remove_pe_defaults_on, #remove_platform_pe_defaults

Methods included from Helpers::HoconHelpers

#hocon_file_edit_in_place_on, #hocon_file_edit_on, #hocon_file_read_on

Methods included from Helpers::WebHelpers

#link_exists?, #port_open_within?

Methods included from Helpers::TestHelpers

#current_step_name, #current_test_filename, #current_test_name, #set_current_step_name, #set_current_test_filename, #set_current_test_name

Methods included from Helpers::HostHelpers

#add_system32_hosts_entry, #archive_file_from, #backup_the_file, #check_for_package, #create_remote_file, #create_tmpdir_on, #curl_on, #curl_with_retries, #deploy_package_repo, #echo_on, #execute_powershell_script_on, #exit_code, #install_package, #on, #retry_on, #rsync_to, #run_script, #run_script_on, #scp_from, #scp_to, #shell, #stderr, #stdout, #upgrade_package

Methods included from Wrappers

#encode_command, #powershell

Methods included from Assertions

#assert_no_match, #assert_output

Methods included from Structure

#confine, #confine_block, #expect_failure, #select_hosts, #step, #teardown, #test_name

Methods included from Outcomes

#export, #fail_test, #pass_test, #pending_test, #skip_test

Methods included from Roles

#add_role, #add_role_def, #agent_only, #agents, #aio_agent?, #aio_version?, #any_hosts_as?, #dashboard, #database, #default, #find_at_most_one, #find_host_with_role, #find_only_one, #hosts_as, #master, #not_controller

Class Method Details

.register(helper_module) ⇒ Object



84
85
86
# File 'lib/beaker/dsl.rb', line 84

def self.register(helper_module)
  include helper_module
end