lib/test_queue/iterator.rb in test-queue-0.4.0 vs lib/test_queue/iterator.rb in test-queue-0.4.1
- old
+ new
@@ -1,10 +1,10 @@
module TestQueue
class Iterator
attr_reader :sock
- def initialize(test_framework, sock, filter=nil, early_failure_limit: nil)
+ def initialize(test_framework, sock, filter=nil, run_token:, early_failure_limit: nil)
@test_framework = test_framework
@done = false
@suite_stats = []
@sock = sock
@filter = filter
@@ -12,10 +12,11 @@
@tcp_address = $1
@tcp_port = $2.to_i
end
@failures = 0
@early_failure_limit = early_failure_limit
+ @run_token = run_token
end
def each
fail "already used this iterator. previous caller: #@done" if @done
@@ -27,11 +28,11 @@
# can be immediately halted.
if @early_failure_limit && @failures >= @early_failure_limit
connect_to_master("KABOOM")
break
else
- client = connect_to_master('POP')
+ client = connect_to_master("POP #{Socket.gethostname} #{Process.pid}")
end
break if client.nil?
_r, _w, e = IO.select([client], nil, [client], nil)
break if !e.empty?
@@ -77,9 +78,10 @@
if @tcp_address
TCPSocket.new(@tcp_address, @tcp_port)
else
UNIXSocket.new(@sock)
end
+ sock.puts("TOKEN=#{@run_token}")
sock.puts(cmd)
sock
rescue Errno::EPIPE
nil
end