Module: Beaker::DSL

Includes:
Assertions, EZBakeUtils, Helpers, InstallUtils, Outcomes, Patterns, Roles, Structure, 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/ezbake_utils.rb,
lib/beaker/dsl/install_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, EZBakeUtils, Helpers, InstallUtils, Outcomes, Patterns, Roles, Structure, Wrappers

Constant Summary

Constants included from InstallUtils

InstallUtils::GitHubSig, InstallUtils::GitURI, InstallUtils::PUPPET_MODULE_INSTALL_IGNORE, InstallUtils::SourcePath

Constants included from EZBakeUtils

EZBakeUtils::LOCAL_COMMANDS_REQUIRED, EZBakeUtils::REMOTE_PACKAGES_REQUIRED

Instance Attribute Summary

Attributes included from Assertions

#assertions

Method Summary

Methods included from Patterns

#block_on

Methods included from InstallUtils

#add_system32_hosts_entry, #build_ignore_list, #check_for_package, #copy_module_to, #deploy_frictionless_to_master, #do_higgs_install, #do_install, #extract_repo_info_from, #fetch_puppet, #fetch_puppet_on_mac, #fetch_puppet_on_unix, #fetch_puppet_on_windows, #find_git_repo_versions, #get_module_name, #higgs_installer_cmd, #install_dev_puppet_module, #install_dev_puppet_module_on, #install_from_git, #install_higgs, #install_package, #install_packages_from_local_dev_repo, #install_pe, #install_puppet, #install_puppet_from_deb, #install_puppet_from_dmg, #install_puppet_from_gem, #install_puppet_from_msi, #install_puppet_from_rpm, #install_puppet_module_via_pmt, #install_puppet_module_via_pmt_on, #install_puppetagent_dev_repo, #install_puppetlabs_dev_repo, #install_puppetlabs_release_repo, #installer_cmd, #link_exists?, #parse_for_modulename, #parse_for_moduleroot, #split_author_modulename, #upgrade_package, #upgrade_pe

Methods included from EZBakeUtils

#ezbake_config, #ezbake_stage, #ezbake_tools_available?, #install_ezbake_deps, #install_from_ezbake

Methods included from Helpers

#apply_manifest, #apply_manifest_on, #confine, #confine_block, #copy_hiera_data, #copy_hiera_data_to, #create_remote_file, #create_tmpdir_for_user, #curl_on, #curl_with_retries, #deploy_package_repo, #exit_code, #fact, #fact_on, #modify_tk_config, #on, #port_open_within?, #puppet_group, #puppet_user, #retry_on, #run_agent_on, #run_script, #run_script_on, #scp_from, #scp_to, #select_hosts, #shell, #sign_certificate, #sign_certificate_for, #sleep_until_nc_started, #sleep_until_puppetdb_started, #sleep_until_puppetserver_started, #stderr, #stdout, #stop_agent, #stop_agent_on, #stub_forge, #stub_forge_on, #stub_hosts, #stub_hosts_on, #version_is_less, #wait_for_host_in_dashboard, #with_forge_stubbed, #with_forge_stubbed_on, #with_host_stubbed_on, #with_puppet_running, #with_puppet_running_on, #write_hiera_config, #write_hiera_config_on

Methods included from Wrappers

#cfacter, #facter, #hiera, #powershell, #puppet

Methods included from Assertions

#assert_no_match, #assert_output

Methods included from Structure

#step, #teardown, #test_name

Methods included from Outcomes

#fail_test, #pass_test, #pending_test, #skip_test

Methods included from Roles

#add_role_def, #agents, #any_hosts_as?, #dashboard, #database, #default, #find_at_most_one, #find_host_with_role, #find_only_one, #hosts_as, #master