Skip to content
Snippets Groups Projects
Commit 4683a660 authored by David Lyon's avatar David Lyon
Browse files

finalized tests

parent ac89ce3d
No related branches found
No related tags found
No related merge requests found
......@@ -8,10 +8,10 @@ def error_(parser):
argparse_parser = argparse.ArgumentParser()
argparse_parser.add_argument("IP", help="IP address without port, e.g. '127.0.0.1' (is also the default)", type=str, default="0.0.0.0", nargs="?")
argparse_parser.add_argument("--port", help="port number, e.g. '10110' (is also the default)", type=str, default="10111", nargs="?")
argparse_parser.add_argument("prefix", help="prefix of directory to store results, e.g. 'test_v1' ", type=str, default="test_agotool_v8", nargs="?")
argparse_parser.add_argument("prefix", help="prefix of directory to store results, e.g. 'test_v1' ", type=str, default="temp", nargs="?")
argparse_parser.add_argument("parallel_processes", help="number of parallel processes for flooding, e.g. 50", type=int, default=50, nargs="?")
argparse_parser.add_argument("parallel_iterations", help="total total number of iterations for parallel test, e.g. 1000 (parallel_processes: number of synchronous requests, parallel_iterations: total num requests) ", type=int, default=50000, nargs="?")
argparse_parser.add_argument("sequential_iterations", help="total number of iterations (for 2 parallel but otherwise) sequential requests, e.g. 10000 (2 parallel requests * 1000 = 2000).", type=int, default=10000, nargs="?")
argparse_parser.add_argument("parallel_iterations", help="total total number of iterations for parallel test, e.g. 1000 (parallel_processes: number of synchronous requests, parallel_iterations: total num requests) ", type=int, default=50, nargs="?")
argparse_parser.add_argument("sequential_iterations", help="total number of iterations (for 2 parallel but otherwise) sequential requests, e.g. 10000 (2 parallel requests * 1000 = 2000).", type=int, default=100, nargs="?")
argparse_parser.add_argument("verbose", help="be verbose or not. print things.", type=bool, default=True, nargs="?")
# """
# example of files being created (in directory 'test_agotool_v8') when running this script:
......@@ -76,7 +76,8 @@ with open(log_fn_settings, "a") as fh_log:
fh_log.write("# {} # {}\n".format(cmd, str(datetime.datetime.now())))
flood = subprocess.Popen(cmd, shell=True, stderr=FNULL)
time.sleep(3600) # wait one hour and then flood again
time.sleep(60) # wait one hour and then flood again
file_start_count = parallel_iterations # since files would otherwise be overwritten
cmd = "python parallel_requests.py {} {} {} {} {} {} {}".format(url, prefix, parallel_processes, parallel_iterations, log_fn_requests, file_start_count, verbose)
print(cmd, " # " + str(datetime.datetime.now()))
......@@ -93,11 +94,16 @@ def rsync_uWSGI_log_files():
try copying uWSGI log files to prefix directory. The log files are located in the same directory the uwsgi app was launched in (using "uwsgi uwsgi_config.ini")
# --> ./agotool/app
"""
cmd = "rsync -av --update ../../../log_uwsgi_\* ./{}".format(prefix)
print("Copying uWSGI log files to prefix directory")
cmd = "rsync -av --update ../../../log_uwsgi_error.txt ./{}".format(prefix)
print(cmd)
rsync = subprocess.Popen(cmd, shell=True)
rsync.wait()
cmd = "rsync -av --update ../../../log_uwsgi_requests.txt ./{}".format(prefix)
print(cmd)
rsync = subprocess.Popen(cmd, shell=True)
rsync.wait()
rsync_uWSGI_log_files()
......
......@@ -47,14 +47,14 @@ with open(log_file_name, "a") as fh_log:
if l[3] != "7.489216012376792e-06": # check p_value
if verbose:
print("WARNING! {}".format(filename))
fh_log.write("WARNING! {}".format(filename))
fh_log.write("WARNING! {}\n".format(filename))
except: # connection timed out?
if verbose:
print("WARNING! {}".format(filename))
fh_log.write("WARNING! {}".format(filename))
fh_log.write("WARNING! {}\n".format(filename))
if not heart_devel_found:
if verbose:
print("WARNING! {}".format(filename))
fh_log.write("WARNING! {}".format(filename))
fh_log.write("WARNING! {}\n".format(filename))
print("# Finished part_2 checking results of flood_request.py")
\ No newline at end of file
This diff is collapsed.
import sys, os
import pytest
import pandas as pd
import numpy as np
# import numpy as np
import subprocess, multiprocessing
import matplotlib.pyplot as plt
......@@ -19,7 +19,9 @@ PYTEST_FN_DIR = variables.PYTEST_FN_DIR
@pytest.fixture(scope='module')
def test_dir():
# dir_ = r"/Users/dblyon/modules/cpr/agotool/app/python/load_test/test_2_workers"
dir_ = r"/Users/dblyon/modules/cpr/agotool/app/python/testing/flood_requests/test_agotool_v9"
# dir_ = r"/Users/dblyon/modules/cpr/agotool/app/python/testing/flood_requests/test_agotool_v9"
dir_2_test = "test_temp"
dir_ = os.path.join(os.path.dirname(os.path.abspath(os.path.realpath(__file__))), dir_2_test)
print("#" * 50)
print("TESTING: ", dir_)
print("#" * 50)
......@@ -197,8 +199,6 @@ def dfr(test_dir, get_fn_log_DBL_requests):
dfr["delta_millisec"] = (dfr["timestamp"].iloc[1:].reset_index(drop=True) - dfr["timestamp"].iloc[:-1].reset_index(drop=True)).apply(lambda x: x.delta / 1e6)
return dfr
def test_if_warnings(test_dir, get_fn_log_DBL_requests):
"""
were any 'WARNING!' generated by parallel_requests.py or sequential_requests.py
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment