Skip to content

Commit 2ad27db

Browse files
committed
add asserts to prove these requests do not reach the server
1 parent d2438d5 commit 2ad27db

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

tests/gold_tests/headers/normalized_ae_match_vary_cache.test.py

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,43 @@
3131
replay_file = "replays/normalized_ae_varied_transactions.replay.yaml"
3232
server = Test.MakeVerifierServerProcess("server", replay_file)
3333

34-
ts = Test.MakeATSProcess("ts", enable_cache=True)
34+
# Verify that cache hit requests never reach the server
35+
# Case 2 (normalize_ae:1) cache hits
36+
server.Streams.stdout += Testers.ExcludesExpression(
37+
"uuid: 12", "Verify empty Accept-Encoding (uuid 12) is a cache hit and doesn't reach the server.")
38+
server.Streams.stdout += Testers.ExcludesExpression(
39+
"uuid: 13", "Verify deflate request (uuid 13) is a cache hit and doesn't reach the server.")
40+
server.Streams.stdout += Testers.ExcludesExpression(
41+
"uuid: 14", "Verify br,compress request (uuid 14) is a cache hit and doesn't reach the server.")
42+
server.Streams.stdout += Testers.ExcludesExpression(
43+
"uuid: 16", "Verify br,compress,gzip request (uuid 16) is a cache hit and doesn't reach the server.")
44+
# Case 3 (normalize_ae:2) cache hits
45+
server.Streams.stdout += Testers.ExcludesExpression(
46+
"uuid: 22", "Verify empty Accept-Encoding (uuid 22) is a cache hit and doesn't reach the server.")
47+
server.Streams.stdout += Testers.ExcludesExpression(
48+
"uuid: 23", "Verify deflate request (uuid 23) is a cache hit and doesn't reach the server.")
49+
server.Streams.stdout += Testers.ExcludesExpression(
50+
"uuid: 26", "Verify br,compress,gzip request (uuid 26) is a cache hit and doesn't reach the server.")
51+
server.Streams.stdout += Testers.ExcludesExpression(
52+
"uuid: 27", "Verify compress,gzip request (uuid 27) is a cache hit and doesn't reach the server.")
53+
# Case 4 (normalize_ae:3) cache hits
54+
server.Streams.stdout += Testers.ExcludesExpression(
55+
"uuid: 32", "Verify empty Accept-Encoding (uuid 32) is a cache hit and doesn't reach the server.")
56+
server.Streams.stdout += Testers.ExcludesExpression(
57+
"uuid: 33", "Verify deflate request (uuid 33) is a cache hit and doesn't reach the server.")
58+
server.Streams.stdout += Testers.ExcludesExpression(
59+
"uuid: 37", "Verify compress,gzip request (uuid 37) is a cache hit and doesn't reach the server.")
60+
server.Streams.stdout += Testers.ExcludesExpression(
61+
"uuid: 38", "Verify br;q=1.1 request (uuid 38) is a cache hit and doesn't reach the server.")
62+
server.Streams.stdout += Testers.ExcludesExpression(
63+
"uuid: 39", "Verify br,gzip;q=0.8 request (uuid 39) is a cache hit and doesn't reach the server.")
64+
65+
ts = Test.MakeATSProcess("ts", enable_cache=True, select_ports=False)
66+
# Hardcode port to avoid port binding issues
67+
ts.Variables.port = 8765
68+
ts.Disk.records_config.update({
69+
'proxy.config.http.server_ports': f'{ts.Variables.port}',
70+
})
3571
ts.Disk.remap_config.AddLine(
3672
f"map http://www.ae-0.com http://127.0.0.1:{server.Variables.http_port}" +
3773
' @plugin=conf_remap.so @pparam=proxy.config.http.normalize_ae=0')

0 commit comments

Comments
 (0)