Sha256: 586f722905e878c1e6f662edbe6f09e1f7dfa9f49134d43d93cc57ddf473ffb2

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

describe 'check-node executable' do

  # Setup a platform for check-node tests
  #
  # Parameters::
  # * *block* (Proc): Code called when the platform is setup
  #   * Parameters::
  #     * *repository* (String): Platform's repository
  def with_test_platform_for_check_node(&block)
    with_test_platform({ nodes: { 'node' => {} } }, &block)
  end

  it 'checks a given node' do
    with_test_platform_for_check_node do
      expect(test_deployer).to receive(:deploy_on).with('node') do
        expect(test_deployer.use_why_run).to be true
        test_deployer.stdout_device << "Check ok\n"
        { 'node' => [0, "Check ok\n", ''] }
      end
      exit_code, stdout, stderr = run 'check-node', '--node', 'node'
      expect(exit_code).to eq 0
      expect(stdout).to match(/Check ok/)
      expect(stderr).to eq ''
    end
  end

  it 'fails if no node is given' do
    with_test_platform_for_check_node do
      expect { run 'check-node' }.to raise_error(RuntimeError, 'No node selected. Please use --node option to set at least one.')
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hybrid_platforms_conductor-33.9.5 spec/hybrid_platforms_conductor_test/executables/check_node_spec.rb
hybrid_platforms_conductor-33.9.4 spec/hybrid_platforms_conductor_test/executables/check_node_spec.rb