diff --git a/acceptance/tests/base/dsl/helpers/host_helpers/create_remote_file_test.rb b/acceptance/tests/base/dsl/helpers/host_helpers/create_remote_file_test.rb index c4dd005d4b..0a33d0d7b9 100644 --- a/acceptance/tests/base/dsl/helpers/host_helpers/create_remote_file_test.rb +++ b/acceptance/tests/base/dsl/helpers/host_helpers/create_remote_file_test.rb @@ -81,10 +81,18 @@ remote_filename = File.join(remote_tmpdir, "testfile.txt") contents = fixture_contents("simple_text_file") - create_remote_file default, remote_filename, contents, { :protocol => "rsync" } - - remote_contents = on(default, "cat #{remote_filename}").stdout - assert_equal contents, remote_contents + result = create_remote_file default, remote_filename, contents, { :protocol => "rsync" } + + fails_intermittently("https://tickets.puppetlabs.com/browse/BKR-612", + "default" => default, + "remote_tmpdir" => remote_tmpdir, + "remote_filename" => remote_filename, + "contents" => contents, + "result" => result + ) do + remote_contents = on(default, "cat #{remote_filename}").stdout + assert_equal contents, remote_contents + end end end @@ -154,15 +162,26 @@ step "#create_remote_file creates remote files on all remote hosts, when given an array, using rsync" do remote_tmpdir = tmpdir_on default + + # NOTE: we do not do this step in the non-hosts-array version of the test, not sure why on hosts, "mkdir -p #{remote_tmpdir}" + remote_filename = File.join(remote_tmpdir, "testfile.txt") contents = fixture_contents("simple_text_file") - create_remote_file hosts, remote_filename, contents, { :protocol => 'rsync' } + result = create_remote_file hosts, remote_filename, contents, { :protocol => 'rsync' } hosts.each do |host| - remote_contents = on(host, "cat #{remote_filename}").stdout - assert_equal contents, remote_contents + fails_intermittently("https://tickets.puppetlabs.com/browse/BKR-612", + "host" => host, + "remote_tmpdir" => remote_tmpdir, + "remote_filename" => remote_filename, + "contents" => contents, + "result" => result + ) do + remote_contents = on(host, "cat #{remote_filename}").stdout + assert_equal contents, remote_contents + end end end end diff --git a/acceptance/tests/base/dsl/helpers/host_helpers/rsync_to_test.rb b/acceptance/tests/base/dsl/helpers/host_helpers/rsync_to_test.rb index 6d8a56ffb0..9292d80000 100644 --- a/acceptance/tests/base/dsl/helpers/host_helpers/rsync_to_test.rb +++ b/acceptance/tests/base/dsl/helpers/host_helpers/rsync_to_test.rb @@ -80,17 +80,21 @@ Dir.mktmpdir do |local_dir| local_filename, contents = create_local_file_from_fixture("simple_text_file", local_dir, "testfile.txt") remote_tmpdir = tmpdir_on default + remote_filename = File.join(remote_tmpdir, "testfile.txt") result = rsync_to default, local_filename, remote_tmpdir - remote_filename = File.join(remote_tmpdir, "testfile.txt") - remote_contents = on(default, "cat #{remote_filename}").stdout - fails_intermittently("https://tickets.puppetlabs.com/browse/QENG-3053", + "result" => result, "default" => default, + "contents" => contents, + "local_filename" => local_filename, + "local_dir" => local_dir, "remote_filename" => remote_filename, + "remote_tmdir" => remote_tmpdir, "result" => result.inspect, ) do + remote_contents = on(default, "cat #{remote_filename}").stdout assert_equal contents, remote_contents end end @@ -103,11 +107,22 @@ on hosts, "mkdir -p #{remote_tmpdir}" remote_filename = File.join(remote_tmpdir, "testfile.txt") - rsync_to hosts, local_filename, remote_tmpdir + result = rsync_to hosts, local_filename, remote_tmpdir hosts.each do |host| - remote_contents = on(host, "cat #{remote_filename}").stdout - assert_equal contents, remote_contents + fails_intermittently("https://tickets.puppetlabs.com/browse/QENG-3053", + "result" => result, + "host" => host, + "contents" => contents, + "local_filename" => local_filename, + "local_dir" => local_dir, + "remote_filename" => remote_filename, + "remote_tmdir" => remote_tmpdir, + "result" => result.inspect, + ) do + remote_contents = on(host, "cat #{remote_filename}").stdout + assert_equal contents, remote_contents + end end end end diff --git a/acceptance/tests/base/host_test.rb b/acceptance/tests/base/host_test.rb index bf76a5420b..d4b431dbdb 100644 --- a/acceptance/tests/base/host_test.rb +++ b/acceptance/tests/base/host_test.rb @@ -175,13 +175,8 @@ end end -# TODO: re-enable via resolution of QENG-3063 -# -# step "#reboot: can reboot the host" -# hosts.each do |host| -# host.reboot -# fails_intermittently("https://tickets.puppetlabs.com/browse/QENG-3063", -# "host" => "#{host}") do -# on host, "echo #{host} rebooted!" -# end -# end +step "#reboot: can reboot the host" +hosts.each do |host| + host.reboot + on host, "echo #{host} rebooted!" +end diff --git a/lib/beaker/logger.rb b/lib/beaker/logger.rb index 4a3233f440..76dab0bb4a 100644 --- a/lib/beaker/logger.rb +++ b/lib/beaker/logger.rb @@ -357,6 +357,7 @@ def optionally_color color_code, msg, add_newline = true to.print color_code if @color to.send print_statement, msg to.print NORMAL if @color unless color_code == NONE + to.flush end end diff --git a/spec/beaker/logger_spec.rb b/spec/beaker/logger_spec.rb index 844623a2f1..da5e5cd618 100644 --- a/spec/beaker/logger_spec.rb +++ b/spec/beaker/logger_spec.rb @@ -3,7 +3,7 @@ module Beaker describe Logger do - let(:my_io) { MockIO.new } + let(:my_io) { StringIO.new } let(:logger) { Logger.new(my_io, :quiet => true) } let(:test_dir) { 'tmp/tests' } let(:dummy_prefix) { 'dummy' } diff --git a/spec/mocks.rb b/spec/mocks.rb index f18cb7d55c..292b695d23 100644 --- a/spec/mocks.rb +++ b/spec/mocks.rb @@ -1,18 +1,5 @@ require 'rspec/mocks' -class MockIO < IO - def initialize - end - - methods.each do |meth| - define_method(:meth) {} - end - - def === other - super other - end -end - module MockNet class HTTP