Small fixes: island reset added to telemetry performance test, fixed a bug on report generation test

This commit is contained in:
VakarisZ 2020-05-14 10:55:59 +03:00
parent a360e8514e
commit 87e50d37f1
5 changed files with 10 additions and 8 deletions

View File

@ -166,5 +166,4 @@ class TestMonkeyBlackbox(object):
MapGenerationFromTelemetryTest(island_client, quick_performance_tests).run() MapGenerationFromTelemetryTest(island_client, quick_performance_tests).run()
def test_telem_performance(self, island_client, quick_performance_tests): def test_telem_performance(self, island_client, quick_performance_tests):
if not quick_performance_tests: TelemetryPerformanceTest(island_client, quick_performance_tests).test_telemetry_performance()
TelemetryPerformanceTest(island_client).test_telemetry_performance()

View File

@ -17,9 +17,6 @@ class EndpointPerformanceTest(BasicTest):
self.island_client = island_client self.island_client = island_client
def run(self) -> bool: def run(self) -> bool:
if not self.island_client.is_all_monkeys_dead():
raise RuntimeError("Can't test report times since not all Monkeys have died.")
# Collect timings for all pages # Collect timings for all pages
self.island_client.clear_caches() self.island_client.clear_caches()
endpoint_timings = {} endpoint_timings = {}

View File

@ -23,6 +23,8 @@ class PerformanceTestWorkflow(BasicTest):
self.island_client.kill_all_monkeys() self.island_client.kill_all_monkeys()
self.exploitation_test.wait_until_monkeys_die() self.exploitation_test.wait_until_monkeys_die()
self.exploitation_test.wait_for_monkey_process_to_finish() self.exploitation_test.wait_for_monkey_process_to_finish()
if not self.island_client.is_all_monkeys_dead():
raise RuntimeError("Can't test report times since not all Monkeys have died.")
performance_test = EndpointPerformanceTest(self.name, self.performance_config, self.island_client) performance_test = EndpointPerformanceTest(self.name, self.performance_config, self.island_client)
try: try:
if not self.island_client.is_all_monkeys_dead(): if not self.island_client.is_all_monkeys_dead():

View File

@ -21,7 +21,7 @@ class ReportGenerationFromTelemetryTest(PerformanceTest):
TEST_NAME = "Map generation from fake telemetries test" TEST_NAME = "Map generation from fake telemetries test"
def __init__(self, island_client, break_on_timeout=False): def __init__(self, island_client, quick_performance_test, break_on_timeout=False):
self.island_client = island_client self.island_client = island_client
performance_config = PerformanceTestConfig(max_allowed_single_page_time=MAX_ALLOWED_SINGLE_PAGE_TIME, performance_config = PerformanceTestConfig(max_allowed_single_page_time=MAX_ALLOWED_SINGLE_PAGE_TIME,
max_allowed_total_time=MAX_ALLOWED_TOTAL_TIME, max_allowed_total_time=MAX_ALLOWED_TOTAL_TIME,
@ -29,7 +29,8 @@ class ReportGenerationFromTelemetryTest(PerformanceTest):
break_on_timeout=break_on_timeout) break_on_timeout=break_on_timeout)
self.performance_test_workflow = TelemetryPerformanceTestWorkflow(ReportGenerationFromTelemetryTest.TEST_NAME, self.performance_test_workflow = TelemetryPerformanceTestWorkflow(ReportGenerationFromTelemetryTest.TEST_NAME,
self.island_client, self.island_client,
performance_config) performance_config,
quick_performance_test)
def run(self): def run(self):
self.performance_test_workflow.run() self.performance_test_workflow.run()

View File

@ -18,8 +18,9 @@ MAX_ALLOWED_TOTAL_TIME = timedelta(seconds=60)
class TelemetryPerformanceTest: class TelemetryPerformanceTest:
def __init__(self, island_client: MonkeyIslandClient): def __init__(self, island_client: MonkeyIslandClient, quick_performance_test: bool):
self.island_client = island_client self.island_client = island_client
self.quick_performance_test = quick_performance_test
def test_telemetry_performance(self): def test_telemetry_performance(self):
LOGGER.info("Starting telemetry performance test.") LOGGER.info("Starting telemetry performance test.")
@ -36,6 +37,8 @@ class TelemetryPerformanceTest:
telemetry_parse_times[telemetry_endpoint] = self.get_telemetry_time(telemetry) telemetry_parse_times[telemetry_endpoint] = self.get_telemetry_time(telemetry)
test_config = PerformanceTestConfig(MAX_ALLOWED_SINGLE_TELEM_PARSE_TIME, MAX_ALLOWED_TOTAL_TIME) test_config = PerformanceTestConfig(MAX_ALLOWED_SINGLE_TELEM_PARSE_TIME, MAX_ALLOWED_TOTAL_TIME)
PerformanceAnalyzer(test_config, telemetry_parse_times).analyze_test_results() PerformanceAnalyzer(test_config, telemetry_parse_times).analyze_test_results()
if not self.quick_performance_test:
self.island_client.reset_env()
def get_telemetry_time(self, telemetry): def get_telemetry_time(self, telemetry):
content = telemetry['content'] content = telemetry['content']