Sha256: bb1eb1463141bb0dbb1606fc056b76d20a267be339895b60c0698d7c78dc8386

Contents?: true

Size: 1.77 KB

Versions: 70

Compression:

Stored size: 1.77 KB

Contents

require "helpers/test_helper"

test_name "dsl::helpers::host_helpers #retry_on" do
  step "#retry_on CURRENTLY fails with a RuntimeError if command does not pass after all retries" do
    # NOTE: would have expected this to fail with Beaker::Hosts::CommandFailure

    remote_tmpdir = tmpdir_on default
    remote_script_file = File.join(remote_tmpdir, "test.sh")
    remote_filename, contents = create_remote_file_from_fixture("retry_script", default, remote_tmpdir, "test.sh")

    assert_raises RuntimeError do
      retry_on default, "bash #{remote_script_file} #{remote_tmpdir} 10", { :max_retries => 2, :retry_interval => 0.1 }
    end
  end

  step "#retry_on succeeds if command passes before retries are exhausted" do
    remote_tmpdir = tmpdir_on default
    remote_script_file = File.join(remote_tmpdir, "test.sh")
    remote_filename, contents = create_remote_file_from_fixture("retry_script", default, remote_tmpdir, "test.sh")

    result = retry_on default, "bash #{remote_script_file} #{remote_tmpdir} 2", { :max_retries => 4, :retry_interval => 0.1 }
    assert_equal 0, result.exit_code
    assert_equal "", result.stdout
  end

  step "#retry_on CURRENTLY fails when provided a host array" do
    # NOTE: would expect this to work across hosts, or be better documented and
    #       to raise Beaker::Host::CommandFailure

    remote_tmpdir = tmpdir_on default
    remote_script_file = File.join(remote_tmpdir, "test.sh")

    hosts.each do |host|
      on host, "mkdir -p #{remote_tmpdir}"
      remote_filename, contents = create_remote_file_from_fixture("retry_script", host, remote_tmpdir, "test.sh")
    end

    assert_raises NoMethodError do
      result = retry_on hosts, "bash #{remote_script_file} #{remote_tmpdir} 2", { :max_retries => 4, :retry_interval => 0.1 }
    end
  end
end

Version data entries

70 entries across 70 versions & 1 rubygems

Version Path
beaker-3.37.0 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-3.36.0 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-3.35.0 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-3.34.0 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-3.33.0 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-3.32.0 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-3.31.0 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-3.30.0 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-3.29.0 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-3.28.0 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-3.27.0 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-3.26.0 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-3.25.0 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-3.24.0 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-3.23.0 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-3.22.0 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-3.21.1 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-3.21.0 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-3.20.0 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-3.19.0 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb