コード例 #1
0
ファイル: ABTest.py プロジェクト: toshic/yandex-tank
 def test_run(self):
     aggregator = AggregatorPlugin(self.core)
     self.foo.out_file = 'data/ab_results.txt'
     reader = ABReader(aggregator, self.foo)
     reader.check_open_files()
     self.assertNotEquals(None, reader.get_next_sample(False))
     self.assertNotEquals(None, reader.get_next_sample(True))
     cnt = 2
     while reader.get_next_sample(True):
         cnt += 1
     self.assertEquals(25, cnt)
コード例 #2
0
 def test_reader_errors(self):
     aggregator = AggregatorPlugin(self.core)
     self.foo.jtl_file = 'data/jmeter_HifF2z.jtl'
     reader = JMeterReader(aggregator, self.foo)
     reader.check_open_files()
     self.assertNotEquals(None, reader.get_next_sample(False))
     self.assertNotEquals(None, reader.get_next_sample(True))
     cnt = 2
     while reader.get_next_sample(True):
         cnt += 1
     self.assertEquals(5, cnt)
コード例 #3
0
    def test_reader(self):
        self.foo.phout_file = 'data/phout_timeout_mix.txt'
        self.foo.phantom_start_time = time.time()
        reader = PhantomReader(AggregatorPlugin(self.foo.core), self.foo)
        reader.check_open_files()

        data = reader.get_next_sample(False)
        while data:
            times_sum = 0
            for timing in data.overall.times_dist:
                times_sum += timing['count']
            self.assertEquals(sum(data.overall.net_codes.values()), times_sum)
            data = reader.get_next_sample(False)
コード例 #4
0
    def test_run(self):
        self.foo.core.set_option(PhantomPlugin.SECTION, "config", '')
        self.foo.configure()
        self.foo.prepare_test()
        reader = PhantomReader(AggregatorPlugin(self.foo.core), self.foo)
        self.foo.start_test()

        while self.foo.is_test_finished() < 0:
            self.foo.log.debug("Not finished")
            reader.check_open_files()
            reader.get_next_sample(False)
            time.sleep(1)
        if self.foo.is_test_finished() != 0:
            raise RuntimeError("RC: %s" % self.foo.is_test_finished())
        self.foo.end_test(0)
        reader.get_next_sample(True)
コード例 #5
0
    def test_reader(self):
        self.phantom_plugin_instance.phantom_start_time = time.time()
        reader = PhantomReader(
            AggregatorPlugin(self.phantom_plugin_instance.core),
            self.phantom_plugin_instance)
        reader.phout_file = 'data/phout_timeout_mix.txt'
        reader.check_open_files()

        data = reader.get_next_sample(False)
        while data:
            times_sum = 0
            for timing in data.overall.times_dist:
                times_sum += timing['count']
            # FIXME: kinda strange problem here
            #self.assertEquals(sum(data.overall.net_codes.values()), times_sum)
            data = reader.get_next_sample(False)
コード例 #6
0
 def setUp(self):
     core = self.get_core()
     core.load_configs(['config/aggregator.conf'])
     self.foo = AggregatorPlugin(core)
コード例 #7
0
class  AggregatorPluginTestCase(TankTestCase):
    def setUp(self):
        core = self.get_core()
        core.load_configs(['config/aggregator.conf'])
        self.foo = AggregatorPlugin(core)

    def tearDown(self):
        del self.foo
        self.foo = None        

    def test_run(self):
        self.foo.configure()
        self.assertEquals(11000, self.foo.get_timeout())
        self.foo.prepare_test()
        self.foo.reader = FakeReader(self.foo)
        self.foo.start_test()
        retry = 0
        while self.foo.is_test_finished() < 0 and retry < 5:
            self.foo.log.debug("Not finished")
            time.sleep(0.01)
            retry = retry + 1
        self.foo.end_test(0)

    def test_run_final_read(self):
        self.foo.configure()
        self.foo.prepare_test()
        self.foo.reader = FakeReader(self.foo)
        self.foo.start_test()
        self.foo.end_test(0)
        
    def test_run_interrupt(self):
        self.foo.configure()
        self.foo.prepare_test()
        self.foo.start_test()
        time.sleep(2)
        self.foo.end_test(0)