Sha256: aa89db562cbb5274211965e07c9f5c928ff1bd99cb72126ae7fb465929ba2e15

Contents?: true

Size: 1.1 KB

Versions: 4

Compression:

Stored size: 1.1 KB

Contents

module DeepTest
  class ResultReader
    def initialize(central_command)
      @central_command = central_command
    end

    def read(original_work_units_by_id)
      work_units_by_id = original_work_units_by_id.dup
      errors = 0

      begin
        until errors == work_units_by_id.size
          Thread.pass
          result = @central_command.take_result
          next if result.nil?

          if Agent::Error === result
            puts result
            errors += 1
          else
            if result.respond_to?(:output) && (output = result.output)
              print output
            end

            work_unit = work_units_by_id.delete(result.identifier)
            yield [work_unit, result]
          end
        end
      rescue CentralCommand::NoAgentsRunningError
        FailureMessage.show "DeepTest Agents Are Not Running", <<-end_msg
          DeepTest's test running agents have not contacted the 
          server to indicate they are still running.
          Shutting down the test run on the assumption that they have died. 
        end_msg
      end

      work_units_by_id
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
deep_test_pre-2.0 lib/deep_test/result_reader.rb
jstorimer-deep-test-2.0.0 lib/deep_test/result_reader.rb
jstorimer-deep-test-0.2.0 lib/deep_test/result_reader.rb
jstorimer-deep-test-0.1.0 lib/deep_test/result_reader.rb