Skip to content

Commit 4053d1e

Browse files
committed
django mysql fix flaky e2e test
1 parent 890e78e commit 4053d1e

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

end2end/django_mysql_test.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,16 @@ def test_initial_heartbeat():
103103
"hits_delta_since_sync": 0,
104104
"method": "POST",
105105
"path": "/app/create"
106-
}],
107-
{
108-
"aborted": 0,
109-
"attacksDetected": {"blocked": 2, "total": 2},
110-
"total": 3,
111-
'rateLimited': 0
112-
},
106+
}],
113107
{'wrapt', 'asgiref', 'aikido_zen', 'django', 'sqlparse', 'mysqlclient'}
114108
)
109+
req_stats = heartbeat_events[0]["stats"]["requests"]
110+
assert req_stats["aborted"] == 0
111+
assert req_stats["rateLimited"] == 0
112+
assert req_stats["attacksDetected"] == {"blocked": 2, "total": 2}
113+
# There are 3-4 requests :
114+
# 1. is website live request, first request not always counted
115+
# 2. /app/create safe
116+
# 3. /app/create sql inj
117+
# 4. /app/shell/ls -la shell inj
118+
assert 3 <= req_stats["total"] <= 4, f"Unexpected amount of total requests {req_stats['total']}"

0 commit comments

Comments
 (0)