Sha256: e5f05c178ee92905ed5759f85269f5e4b9458013a93954724a9d57eaaeb6a728

Contents?: true

Size: 1.25 KB

Versions: 16

Compression:

Stored size: 1.25 KB

Contents

test_name 'use the init subcommand' do
  SubcommandUtil = Beaker::Subcommands::SubcommandUtil
  def delete_root_folder_contents
    on default, 'rm -rf /root/* /root/.beaker'
  end

  step 'ensure beaker init requires hosts flag' do
    result = on(default, 'beaker init')
    assert_match(/No value(.+)--hosts/, result.raw_output)
  end

  step 'ensure beaker init writes YAML configuration files to disk' do
    delete_root_folder_contents
    on(default, 'beaker init --hosts centos6-64')
    subcommand_options = on(default, "cat #{SubcommandUtil::SUBCOMMAND_OPTIONS}").stdout
    subcommand_state = on(default, "cat #{SubcommandUtil::SUBCOMMAND_STATE}").stdout
    parsed_options = YAML.parse(subcommand_options).to_ruby
    assert(parsed_options["HOSTS"].count == 1)
    assert(parsed_options.instance_of?(Hash))
    assert(YAML.parse(subcommand_state).to_ruby.instance_of?(Hash))
  end

  step 'ensure beaker init saves beaker-run arguments to the subcommand_options.yaml' do
    delete_root_folder_contents
    on(default, 'beaker init --log-level verbose --hosts centos6-64')
    subcommand_options = on(default, "cat #{SubcommandUtil::SUBCOMMAND_OPTIONS}").stdout
    hash = YAML.parse(subcommand_options).to_ruby
    assert_equal('verbose', hash['log_level'])
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
beaker-6.4.1 acceptance/tests/subcommands/init.rb
beaker-6.4.0 acceptance/tests/subcommands/init.rb
beaker-6.3.0 acceptance/tests/subcommands/init.rb
beaker-6.2.0 acceptance/tests/subcommands/init.rb
beaker-6.1.0 acceptance/tests/subcommands/init.rb
beaker-5.8.1 acceptance/tests/subcommands/init.rb
beaker-5.8.0 acceptance/tests/subcommands/init.rb
beaker-5.7.0 acceptance/tests/subcommands/init.rb
beaker-5.6.0 acceptance/tests/subcommands/init.rb
beaker-5.5.0 acceptance/tests/subcommands/init.rb
beaker-5.4.0 acceptance/tests/subcommands/init.rb
beaker-5.3.1 acceptance/tests/subcommands/init.rb
beaker-5.3.0 acceptance/tests/subcommands/init.rb
beaker-5.2.0 acceptance/tests/subcommands/init.rb
beaker-5.1.0 acceptance/tests/subcommands/init.rb
beaker-5.0.0 acceptance/tests/subcommands/init.rb