Skip to content

Commit

Permalink
Added basic traffic generator for testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
deepaknadig committed Apr 8, 2020
1 parent 764dfbe commit 087d94f
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/ergo_traffic_generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import time
import random
import threading

import requests

endpoints = ('device', 'device/devices', 'measurements', 'measurements/0/0/1', 'error')


def run():
while True:
try:
target = random.choice(endpoints)
requests.get("http://<ERGO_API_SERVICE_IP>:5000/api/v1/%s" % target, timeout=1)
except:
pass


if __name__ == '__main__':
for _ in range(4):
thread = threading.Thread(target=run)
thread.setDaemon(True)
thread.start()

while True:
time.sleep(1)

0 comments on commit 087d94f

Please sign in to comment.