Skip to content

Commit

Permalink
Adding repeat argument tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
bneradt authored and bneradt committed Jul 28, 2020
1 parent 32a205c commit a078e08
Show file tree
Hide file tree
Showing 7 changed files with 338 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
'''
Verify the user can repeat transactions with --repeat.
'''
# @file
#
# Copyright 2020, Verizon Media
# SPDX-License-Identifier: Apache-2.0
#


Test.Summary = '''
Verify the user can repeat transactions with --repeat.
'''

#
# Test 1: Verify that without the repeat argument the transactions are
# executed once.
#
r = Test.AddTestRun("Verify transactions are executed once with no --repeat argument.")
client = r.AddClientProcess("client1", "replay_files/two_files",
http_ports=[8086],
other_args="--verbose diag")
server = r.AddServerProcess("server1", "replay_files/two_files",
http_ports=[8087], other_args="--verbose diag")
proxy = r.AddProxyProcess("proxy1", listen_port=8086, server_port=8087)

client.Streams.stdout += Testers.ContainsExpression(
'Parsed 8 transactions',
'Verify the 8 transactions were parsed.')
client.Streams.stdout += Testers.ContainsExpression(
'8 transactions in 5 sessions',
'Verify each transaction is executed once.')

#
# Test 2: Verify that with --repeat 1 the transactions are executed once.
#
r = Test.AddTestRun("Verify transactions are executed once with --repeat 1.")
client = r.AddClientProcess("client2", "replay_files/two_files",
http_ports=[8086],
other_args="--verbose diag --repeat 1")
server = r.AddServerProcess("server2", "replay_files/two_files",
http_ports=[8087], other_args="--verbose diag")
proxy = r.AddProxyProcess("proxy2", listen_port=8086, server_port=8087)

client.Streams.stdout += Testers.ContainsExpression(
'Parsed 8 transactions',
'Verify the 8 transactions were parsed.')
client.Streams.stdout += Testers.ContainsExpression(
'8 transactions in 5 sessions',
'Verify each transaction is executed once.')

#
# Test 3: Verify that with --repeat 0 the transactions are not executed.
#
r = Test.AddTestRun("Verify no transactions are executed with --repeat 0.")
client = r.AddClientProcess("client3", "replay_files/two_files",
http_ports=[8086],
other_args="--verbose diag --repeat 0")
server = r.AddServerProcess("server3", "replay_files/two_files",
http_ports=[8087], other_args="--verbose diag")
proxy = r.AddProxyProcess("proxy3", listen_port=8086, server_port=8087)

client.Streams.stdout += Testers.ContainsExpression(
'Parsed 8 transactions',
'Verify the 8 transactions were parsed.')
client.Streams.stdout += Testers.ContainsExpression(
'0 transactions in 0 sessions',
'Verify no transactions are executed.')

#
# Test 4: Verify that with --repeat 2 the transactions are executed twice.
#
r = Test.AddTestRun("Verify transactions are executed twice with --repeat 2.")
client = r.AddClientProcess("client4", "replay_files/two_files",
http_ports=[8086],
other_args="--verbose diag --repeat 2")
server = r.AddServerProcess("server4", "replay_files/two_files",
http_ports=[8087], other_args="--verbose diag")
proxy = r.AddProxyProcess("proxy4", listen_port=8086, server_port=8087)

client.Streams.stdout += Testers.ContainsExpression(
'Parsed 8 transactions',
'Verify the 8 transactions were parsed.')
client.Streams.stdout += Testers.ContainsExpression(
'16 transactions in 10 sessions',
'Verify each transaction is executed twice.')

#
# Test 5: Verify that with --repeat 10 the transactions are executed ten times
#
r = Test.AddTestRun("Verify transactions are executed ten times with --repeat 10.")
client = r.AddClientProcess("client5", "replay_files/two_files",
http_ports=[8086],
other_args="--verbose diag --repeat 10")
server = r.AddServerProcess("server5", "replay_files/two_files",
http_ports=[8087], other_args="--verbose diag")
proxy = r.AddProxyProcess("proxy5", listen_port=8086, server_port=8087)

client.Streams.stdout += Testers.ContainsExpression(
'Parsed 8 transactions',
'Verify the 8 transactions were parsed.')
client.Streams.stdout += Testers.ContainsExpression(
'80 transactions in 50 sessions',
'Verify each transaction is executed ten times.')
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
meta:
version: "1.0"

sessions:
- protocol: [ { name: tcp }, {name: ip, version: 4} ]
transactions:
- all:
headers:
fields:
- [ uuid, 1 ]
client-request:
version: "1.1"
scheme: "http"
method: "GET"
url: "http://example.one/path/1"
headers:
fields:
- [ Host, example.one ]

proxy-request:

server-response:
status: 200
reason: OK
content:
size: 16
headers:
fields:
- [ Content-Type, text/html ]
- [ Content-Length, 16 ]

proxy-response:

- all:
headers:
fields:
- [ uuid, 2 ]
client-request:
version: "1.1"
scheme: "http"
method: "GET"
url: "http://example.one/path/2"
headers:
fields:
- [ Host, example.one ]

proxy-request:

server-response:
status: 200
reason: OK
content:
size: 16
headers:
fields:
- [ Content-Type, text/html ]
- [ Content-Length, 16 ]

proxy-response:

- all:
headers:
fields:
- [ uuid, 3 ]
client-request:
version: "1.1"
scheme: "http"
method: "GET"
url: "http://example.one/path/3"
headers:
fields:
- [ Host, example.one ]

proxy-request:

server-response:
status: 200
reason: OK
content:
size: 16
headers:
fields:
- [ Content-Type, text/html ]
- [ Content-Length, 16 ]

proxy-response:

- all:
headers:
fields:
- [ uuid, 4 ]
client-request:
version: "1.1"
scheme: "http"
method: "GET"
url: "http://example.one/path/4"
headers:
fields:
- [ Host, example.one ]

proxy-request:

server-response:
status: 200
reason: OK
content:
size: 16
headers:
fields:
- [ Content-Type, text/html ]
- [ Content-Length, 16 ]

proxy-response:

- protocol: [ { name: tcp }, {name: ip, version: 4} ]
transactions:
- all:
headers:
fields:
- [ uuid, 5 ]
client-request:
version: "1.1"
scheme: "http"
method: "GET"
url: "http://example.two/path/5"
headers:
fields:
- [ Host, example.one ]

proxy-request:

server-response:
status: 200
reason: OK
content:
size: 16
headers:
fields:
- [ Content-Type, text/html ]
- [ Content-Length, 16 ]

proxy-response:

Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
meta:
version: "1.0"

sessions:
- protocol: [ { name: tcp }, {name: ip, version: 4} ]
transactions:
- all:
headers:
fields:
- [ uuid, 11 ]
client-request:
version: "1.1"
scheme: "http"
method: "GET"
url: "http://example.one/path/11"
headers:
fields:
- [ Host, example.one ]

proxy-request:

server-response:
status: 200
reason: OK
content:
size: 16
headers:
fields:
- [ Content-Type, text/html ]
- [ Content-Length, 16 ]

proxy-response:


- protocol: [ { name: tcp }, {name: ip, version: 4} ]
transactions:
- all:
headers:
fields:
- [ uuid, 12 ]
client-request:
version: "1.1"
scheme: "http"
method: "GET"
url: "http://example.two/path/12"
headers:
fields:
- [ Host, example.one ]

proxy-request:

server-response:
status: 200
reason: OK
content:
size: 16
headers:
fields:
- [ Content-Type, text/html ]
- [ Content-Length, 16 ]

proxy-response:

- protocol: [ { name: tcp }, {name: ip, version: 4} ]
transactions:
- all:
headers:
fields:
- [ uuid, 13 ]
client-request:
version: "1.1"
scheme: "http"
method: "GET"
url: "http://example.two/path/13"
headers:
fields:
- [ Host, example.one ]

proxy-request:

server-response:
status: 200
reason: OK
content:
size: 16
headers:
fields:
- [ Content-Type, text/html ]
- [ Content-Length, 16 ]

proxy-response:

0 comments on commit a078e08

Please sign in to comment.