Module: Beaker::DSL

Includes:
Assertions, Helpers, InstallUtils, Outcomes, PE, 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/install_utils.rb,
lib/beaker/dsl/helpers/tk_helpers.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/facter_helpers.rb,
lib/beaker/dsl/helpers/puppet_helpers.rb,
lib/beaker/dsl/install_utils/foss_utils.rb,
lib/beaker/dsl/install_utils/pe_defaults.rb,
lib/beaker/dsl/install_utils/aio_defaults.rb,
lib/beaker/dsl/install_utils/ezbake_utils.rb,
lib/beaker/dsl/install_utils/module_utils.rb,
lib/beaker/dsl/install_utils/puppet_utils.rb,
lib/beaker/dsl/install_utils/foss_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, Wrappers

Constant Summary

Constants included from InstallUtils::EZBakeUtils

InstallUtils::EZBakeUtils::LOCAL_COMMANDS_REQUIRED

Constants included from InstallUtils::ModuleUtils

InstallUtils::ModuleUtils::PUPPET_MODULE_INSTALL_IGNORE

Constants included from InstallUtils::FOSSUtils

InstallUtils::FOSSUtils::GitHubSig, InstallUtils::FOSSUtils::GitURI, InstallUtils::FOSSUtils::SourcePath

Constants included from InstallUtils::FOSSDefaults

InstallUtils::FOSSDefaults::FOSS_DEFAULTS, InstallUtils::FOSSDefaults::FOSS_DEFAULT_DOWNLOAD_URLS

Constants included from InstallUtils::AIODefaults

InstallUtils::AIODefaults::AIO_DEFAULTS

Constants included from InstallUtils::PEDefaults

InstallUtils::PEDefaults::PE_DEFAULTS

Instance Attribute Summary

Attributes included from Assertions

#assertions

Class Method Summary collapse

Methods included from Patterns

#block_on

Methods included from InstallUtils::EZBakeUtils

#conditionally_clone, #ezbake_config, #ezbake_dev_build, #ezbake_install_dir, #ezbake_install_name, #ezbake_installsh, #ezbake_lein_prefix, #ezbake_local_cmd, #ezbake_stage, #ezbake_tools_available?, #ezbake_validate_support, #install_ezbake_tarball_on_host, #install_from_ezbake, #install_termini_from_ezbake

Methods included from InstallUtils::ModuleUtils

#build_ignore_list, #copy_module_to, #get_module_name, #install_dev_puppet_module, #install_dev_puppet_module_on, #install_puppet_module_via_pmt, #install_puppet_module_via_pmt_on, #parse_for_modulename, #parse_for_moduleroot, #split_author_modulename

Methods included from InstallUtils::FOSSUtils

#build_git_url, #clone_git_repo_on, #compute_puppet_msi_name, #configure_puppet, #configure_puppet_on, #extract_repo_info_from, #find_git_repo_versions, #get_latest_puppet_agent_build_from_url, #install_a_puppet_msi_on, #install_cert_on_windows, #install_from_git_on, #install_packages_from_local_dev_repo, #install_puppet, #install_puppet_agent_dev_repo_on, #install_puppet_agent_from_dmg_on, #install_puppet_agent_from_msi_on, #install_puppet_agent_on, #install_puppet_agent_pe_promoted_repo_on, #install_puppet_from_deb_on, #install_puppet_from_dmg_on, #install_puppet_from_freebsd_ports_on, #install_puppet_from_gem_on, #install_puppet_from_msi_on, #install_puppet_from_openbsd_packages_on, #install_puppet_from_rpm_on, #install_puppet_on, #install_puppetlabs_dev_repo, #install_puppetlabs_release_repo_on, #install_repo_configs, #remove_puppet_on

Methods included from InstallUtils::WindowsUtils

#create_install_msi_batch_on, #get_system_temp_path, #install_msi_on, #msi_install_script

Methods included from InstallUtils::PuppetUtils

#add_puppet_paths_on, #configure_defaults_on, #configure_type_defaults_on, #construct_puppet_path, #normalize_type, #remove_defaults_on, #remove_puppet_paths_on

Methods included from InstallUtils::FOSSDefaults

#add_foss_defaults_on, #add_platform_foss_defaults, #remove_foss_defaults_on, #remove_platform_foss_defaults

Methods included from InstallUtils::AIODefaults

#add_aio_defaults_on, #add_platform_aio_defaults, #remove_aio_defaults_on, #remove_platform_aio_defaults

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::WebHelpers

#link_exists?, #port_open_within?

Methods included from Helpers::TKHelpers

#modify_tk_config

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::PuppetHelpers

#apply_manifest, #apply_manifest_on, #create_tmpdir_for_user, #puppet_group, #puppet_user, #run_agent_on, #sign_certificate, #sign_certificate_for, #sleep_until_nc_started, #sleep_until_puppetdb_started, #sleep_until_puppetserver_started, #stop_agent, #stop_agent_on, #stub_forge, #stub_forge_on, #stub_hosts, #stub_hosts_on, #wait_for_host_in_dashboard, #with_forge_stubbed, #with_forge_stubbed_on, #with_host_stubbed_on, #with_puppet_running, #with_puppet_running_on

Methods included from Helpers::HostHelpers

#add_system32_hosts_entry, #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 Helpers::FacterHelpers

#fact, #fact_on

Methods included from Wrappers

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

Methods included from Assertions

#assert_no_match, #assert_output

Methods included from Structure

#confine, #confine_block, #expect_failure, #select_hosts, #step, #tag, #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



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

def self.register(helper_module)
  include helper_module
end