Sha256: d03ddd459e49b262d5cafdca91ae6686e70d33260691846b27ac18c560da8c3b

Contents?: true

Size: 1.77 KB

Versions: 52

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 = default.tmpdir()
    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 = default.tmpdir()
    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 = default.tmpdir()
    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

52 entries across 52 versions & 1 rubygems

Version Path
beaker-4.38.1 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-4.38.0 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-4.37.2 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-4.37.1 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-4.37.0 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-4.36.1 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-4.36.0 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-4.35.0 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-4.34.0 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-4.33.0 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-4.32.0 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-4.31.0 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-4.30.0 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-4.29.1 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-4.29.0 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-4.28.1 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-4.28.0 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-4.27.1 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-4.27.0 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb
beaker-4.26.0 acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb