Commit f73e43e8 authored by Marek Vavrusa's avatar Marek Vavrusa

scenario: REPLAY improvements

- INTENSIFY=N env variable multiplies the number of
  replayed queries by factor N
- REPLAY bails out when test subject starts dropping
  queries
parent 7e9299e2
...@@ -115,7 +115,7 @@ def replay_rrs(rrs, nqueries, destination, args = []): ...@@ -115,7 +115,7 @@ def replay_rrs(rrs, nqueries, destination, args = []):
fdset = [sock] fdset = [sock]
import select import select
while nsent - nwait < nqueries: while nsent - nwait < nqueries:
to_read, to_write, _ = select.select(fdset, fdset if nwait < chunksize else [], [], 0.1) to_read, to_write, _ = select.select(fdset, fdset if nwait < chunksize else [], [], 0.5)
if len(to_write) > 0: if len(to_write) > 0:
try: try:
while nsent < nqueries and nwait < chunksize: while nsent < nqueries and nwait < chunksize:
...@@ -132,6 +132,9 @@ def replay_rrs(rrs, nqueries, destination, args = []): ...@@ -132,6 +132,9 @@ def replay_rrs(rrs, nqueries, destination, args = []):
nrcvd += 1 nrcvd += 1
except: except:
pass pass
if len(to_write) == 0 and len(to_read) == 0:
nwait = 0 # Timeout, started dropping packets
break
return nsent, nrcvd return nsent, nrcvd
class Entry: class Entry:
...@@ -495,6 +498,8 @@ class Step: ...@@ -495,6 +498,8 @@ class Step:
destination = ctx.client[ctx.client.keys()[0]] destination = ctx.client[ctx.client.keys()[0]]
if 'VERBOSE' in os.environ: if 'VERBOSE' in os.environ:
dprint(dtag, 'replaying %d queries to %s@%d (%s)' % (nqueries, destination[0], destination[1], ' '.join(self.args))) dprint(dtag, 'replaying %d queries to %s@%d (%s)' % (nqueries, destination[0], destination[1], ' '.join(self.args)))
if 'INTENSIFY' in os.environ:
nqueries *= int(os.environ['INTENSIFY'])
tstart = datetime.now() tstart = datetime.now()
nsent, nrcvd = replay_rrs(self.queries, nqueries, destination, self.args) nsent, nrcvd = replay_rrs(self.queries, nqueries, destination, self.args)
# Keep/print the statistics # Keep/print the statistics
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment