def setUp(self): autostop = AutostopPlugin(self.get_core()) self.frac_criteria = TotalFracTimeCriteria(autostop, "10ms, 50%, 3s") self.http_relcriteria = TotalHTTPCodesCriteria(autostop, "50x, 10%, 3s") self.http_abscriteria = TotalHTTPCodesCriteria(autostop, "50x, 30, 4s") self.negative_http_relcriteria = TotalNegativeHTTPCodesCriteria( autostop, "2xx, 10%, 3s") self.negative_http_abscriteria = TotalNegativeHTTPCodesCriteria( autostop, "20x, 30, 4s") self.net_relcriteria = TotalNetCodesCriteria(autostop, "110, 37%, 3s") self.net_abscriteria = TotalNetCodesCriteria(autostop, "71, 30, 2s") self.negative_net_relcriteria = TotalNegativeNetCodesCriteria( autostop, "0, 45%, 5s") self.negative_net_abscriteria = TotalNegativeNetCodesCriteria( autostop, "0, 100, 5s") self.http_trend = TotalHTTPTrendCriteria(autostop, "2xx, 10s") self.qsat_absrel = QuantileOfSaturationCriteria( autostop, "200ms, 70s, 20%")
def setUp(self): core = self.get_core() core.load_configs(['config/autostop.conf']) core.load_plugins() core.plugins_configure() self.foo = AutostopPlugin(core)
class AutostopTestCase(TankTestCase): def setUp(self): core = self.get_core() core.load_configs(['config/autostop.conf']) core.load_plugins() core.plugins_configure() self.foo = AutostopPlugin(core) def tearDown(self): del self.foo self.foo = None def test_run(self): data = SecondAggregateData() data.overall.avg_response_time = 11 self.foo.core.set_option(self.foo.SECTION, "autostop", "time(1,10)") self.foo.configure() self.foo.prepare_test() self.foo.start_test() for n in range(1, 15): self.foo.aggregate_second(data) if self.foo.is_test_finished() < 0: raise RuntimeError() self.foo.end_test(0) def test_run_http(self): data = SecondAggregateData() data.overall.http_codes = {'200': 11} self.foo.core.set_option(self.foo.SECTION, "autostop", "http (200, 10, 5 )\nhttp (3xx, 1.5%, 10m)") self.foo.configure() self.foo.prepare_test() self.foo.start_test() for n in range(1, 15): self.foo.aggregate_second(data) if self.foo.is_test_finished() < 0: raise RuntimeError() self.foo.end_test(0) def test_run_net(self): data = SecondAggregateData() data.overall.net_codes = {71: 11} self.foo.core.set_option(self.foo.SECTION, "autostop", "net (71, 1, 5)\nnet (xx, 1.5%, 10m )") self.foo.configure() self.foo.prepare_test() self.foo.start_test() for n in range(1, 15): self.foo.aggregate_second(data) if self.foo.is_test_finished() < 0: raise RuntimeError() self.foo.end_test(0) def test_run_quan(self): data = SecondAggregateData() data.overall.quantiles = {99.0: 11} self.foo.core.set_option(self.foo.SECTION, "autostop", "quantile(99,2,3)") self.foo.configure() self.foo.prepare_test() self.foo.start_test() for n in range(1, 15): self.foo.aggregate_second(data) if self.foo.is_test_finished() < 0: raise RuntimeError() self.foo.end_test(0) def test_run_false_trigger_bug(self): data = SecondAggregateData() data.overall.http_codes = {} self.foo.core.set_option(self.foo.SECTION, "autostop", "http (5xx, 100%, 1)") self.foo.configure() self.foo.prepare_test() self.foo.start_test() for n in range(1, 15): self.foo.aggregate_second(data) if self.foo.is_test_finished() >= 0: raise RuntimeError() self.foo.end_test(0)
class AutostopTestCase(TankTestCase): def setUp(self): core = self.get_core() core.load_configs(['config/autostop.conf']) core.load_plugins() core.plugins_configure() self.foo = AutostopPlugin(core) def tearDown(self): del self.foo self.foo = None def test_run(self): data = SecondAggregateData() data.overall.avg_response_time = 11 self.foo.core.set_option(self.foo.SECTION, "autostop", "time(1,10)") self.foo.configure() self.foo.prepare_test() self.foo.start_test() for n in range(1, 15): self.foo.aggregate_second(data) if self.foo.is_test_finished() < 0: raise RuntimeError() self.foo.end_test(0) def test_run_http(self): data = SecondAggregateData() data.overall.http_codes = {'200':11} self.foo.core.set_option(self.foo.SECTION, "autostop", "http (200, 10, 5 )\nhttp (3xx, 1.5%, 10m)") self.foo.configure() self.foo.prepare_test() self.foo.start_test() for n in range(1, 15): self.foo.aggregate_second(data) if self.foo.is_test_finished() < 0: raise RuntimeError() self.foo.end_test(0) def test_run_net(self): data = SecondAggregateData() data.overall.net_codes = {71:11} self.foo.core.set_option(self.foo.SECTION, "autostop", "net (71, 1, 5)\nnet (xx, 1.5%, 10m )") self.foo.configure() self.foo.prepare_test() self.foo.start_test() for n in range(1, 15): self.foo.aggregate_second(data) if self.foo.is_test_finished() < 0: raise RuntimeError() self.foo.end_test(0) def test_run_quan(self): data = SecondAggregateData() data.overall.quantiles = {99.0:11} self.foo.core.set_option(self.foo.SECTION, "autostop", "quantile(99,2,3)") self.foo.configure() self.foo.prepare_test() self.foo.start_test() for n in range(1, 15): self.foo.aggregate_second(data) if self.foo.is_test_finished() < 0: raise RuntimeError() self.foo.end_test(0) def test_run_false_trigger_bug(self): data = SecondAggregateData() data.overall.http_codes = {} self.foo.core.set_option(self.foo.SECTION, "autostop", "http (5xx, 100%, 1)") self.foo.configure() self.foo.prepare_test() self.foo.start_test() for n in range(1, 15): self.foo.aggregate_second(data) if self.foo.is_test_finished() >= 0: raise RuntimeError() self.foo.end_test(0)