Merge branch 'master' into 4-mongodb_api

This commit is contained in:
Tobias Eidelpes
2021-01-19 12:10:59 +01:00
15 changed files with 330 additions and 74 deletions
+65 -6
View File
@@ -4,7 +4,7 @@ import requests
import json
import time
from datetime import datetime
import sys, getopt
import sys, getopt, random
def build_post_payload(identifier, metadata_payload, file_payload):
return {
@@ -233,16 +233,75 @@ def print_cursor():
print('Cursor on ' + str(index) + " out of " + str(len(metadata)) + " - " + metadata[index]['filename'])
testCommands=[]
testscriptData=[]
def test_script(argv):
try:
testscriptData.append(False)
testscriptData.append(0)
opts, args=getopt.getopt(argv,"t")
except getopt.GetoptError:
print("Error by starting test script")
sys.exit(2)
for opt, arg in opts:
if opt == '-t':
testscriptData.clear()
testscriptData.append(True)
testCommands.append("deleteall")
for i in range(2):
testCommands.append("trigger")
testCommands.append("fetchall")
testCommands.append("delete")
testCommands.append("fetchall")
for i in range(3):
testCommands.append("trigger")
testCommands.append("update")
testCommands.append("fetchall")
for i in range(2):
testCommands.append("trigger")
testCommands.append("update")
testCommands.append("trigger")
testCommands.append("delete")
testCommands.append("fetchall")
for i in range(3):
testCommands.append("trigger")
testCommands.append("update")
testCommands.append("fetchall")
for i in range(2):
testCommands.append("trigger")
testCommands.append("fetchall")
testCommands.append("delete")
testCommands.append("fetchall")
for i in range(5):
testCommands.append("trigger")
testCommands.append("fetchall")
testCommands.append("exit")
testscriptData.append(len(testCommands))
else:
testscriptData.append(False)
testscriptData.append(0)
# main input loop
command = "dummy"
test_script(sys.argv[1:])
i = 0
while (command.lower() not in ["exit", "quit", "end"]):
try:
command = input("Please enter command: ")
except:
print()
if testscriptData[0] and i < testscriptData[1]:
command = testCommands[i]
if i > 0:
time.sleep(random.randrange(5, 60))
print(datetime.now())
if command == "delete" or command == "update":
index -= 1
i+=1
else:
command = input("Please enter command: ")
except Exception as ex:
print(ex)
print("Error while reading keyboard input")
break
command_split = command.split(" ")