Sha256: 8c7011fbabb7bfb903126a172d0ecf83a1067b5aefa0aa45e692c8a175f8afb3

Contents?: true

Size: 1.55 KB

Versions: 5

Compression:

Stored size: 1.55 KB

Contents

require 'beaker-hostgenerator'

namespace :beaker_quickstart do

  desc 'Generate Default Beaker Host Config File'
  task :gen_hosts do
    cli = BeakerHostGenerator::CLI.new(['redhat7-64default.mdcal-redhat7-64af'])
    FileUtils.mkdir_p('acceptance/config') # -p ignores when dir already exists
    File.open("acceptance/config/default_hosts.yaml", 'w') do |fh|
      fh.print(cli.execute)
    end
  end

  desc 'Generate Default Pre-Suite'
  task :gen_pre_suite do
    FileUtils.mkdir_p('acceptance/setup') # -p ignores when dir already exists
    File.open("acceptance/setup/default_pre_suite.rb", 'w') do |fh|
      fh.print('install_puppet')
    end
  end

  desc 'Generate Default Smoke Test'
  task :gen_smoke_test do
    FileUtils.mkdir_p('acceptance/tests') # -p ignores when dir already exists
    File.open("acceptance/tests/default_smoke_test.rb", 'w') do |fh|
      fh.print("test_name 'puppet install smoketest'
step 'puppet install smoketest: verify \\'puppet help\\' can be successfully called on
all hosts'
    hosts.each do |host|
      on host, puppet('help')
    end")
    end
  end

  desc 'Run Default Smoke Test'
  task :run => ['beaker_quickstart:gen_hosts', 'beaker_quickstart:gen_pre_suite', 'beaker_quickstart:gen_smoke_test'] do
    system(beaker_command)
  end

end

def beaker_command
  cmd_parts = []
  cmd_parts << "beaker"
  cmd_parts << "--hosts acceptance/config/default_hosts.yaml"
  cmd_parts << "--pre-suite acceptance/setup/default_pre_suite.rb"
  cmd_parts << "--tests acceptance/tests/default_smoke_test.rb"
  cmd_parts.flatten.join(" ")
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
beaker-2.49.0 lib/beaker/tasks/quick_start.rb
beaker-2.48.1 lib/beaker/tasks/quick_start.rb
beaker-2.48.0 lib/beaker/tasks/quick_start.rb
beaker-2.47.1 lib/beaker/tasks/quick_start.rb
beaker-2.47.0 lib/beaker/tasks/quick_start.rb