From 4e1f38d8d95b02f8eefb6c01b779cd588d52966a Mon Sep 17 00:00:00 2001 From: theoreticalbts Date: Wed, 12 Aug 2015 15:36:35 -0400 Subject: [PATCH] api_stress.py: Implement simple stress testing of API --- tests/intense/api_stress.py | 75 +++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100755 tests/intense/api_stress.py diff --git a/tests/intense/api_stress.py b/tests/intense/api_stress.py new file mode 100755 index 00000000..3aa1f2d3 --- /dev/null +++ b/tests/intense/api_stress.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python3 + +import json +import os +import random +import signal +import struct +import sys +import time + +try: + import asyncio +except ImportError: + print("asyncio module not found (try pip install asyncio, or upgrade to Python 3.4 or later)") + sys.exit(1) + +try: + import websockets +except ImportError: + print("websockets module not found (try pip install websockets)") + sys.exit(1) + +@asyncio.coroutine +def mainloop(): + ws = yield from websockets.connect('ws://localhost:8090/') + entropy = struct.unpack("