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_errors_by_host_with_no_errors(self): no_err_reqs = nginx.load_access_log_data('test/fixtures/nginx_test-no_err.csv', save_binary=False) err_by_host = nginx.errors_by_host(no_err_reqs) self.assertEquals(err_by_host[0]['err_pct'], 0)
def setUpClass(cls): cls.reqs = nginx.load_access_log_data('test/fixtures/nginx_test.csv', save_binary=False)