def test_find_load_periods_with_loads(self): reqs = nginx.load_access_log_data('test/fixtures/nginx_test-with_loads.csv', save_binary=False) reqs, rps = nginx.summary(reqs) periods = nginx.find_load_periods(rps, surrounding_period=5, rps_threashold=20, load_pause_period=5) self.assertEquals(len(periods), 2) self.assertEquals(periods[0].start, 1444359676) self.assertEquals(periods[0].end, 1444359688) self.assertEquals(periods[0].duration(), 12) self.assertEquals(periods[1].start, 1444359716) self.assertEquals(periods[1].end, 1444359726) self.assertEquals(periods[1].duration(), 10)
def test_find_load_periods_without_loads(self): rps = nginx.aggregate_rps(self.reqs) periods = nginx.find_load_periods(rps) self.assertEquals(len(periods), 0)