yandex-tank/Tests/ABTest.py
Andrey Pohilko e9c3911dcc Pull up some items to AbstractReader
Implement AB load generator module
2012-09-25 15:22:09 +04:00

30 lines
901 B
Python

from Tests.TankTests import TankTestCase
import unittest
from Tank.Plugins.ApacheBenchmark import ABReader, ApacheBenchmarkPlugin
from Tank.Plugins.Aggregator import AggregatorPlugin
class ABTestCase(TankTestCase):
def setUp(self):
self.core = self.get_core()
self.foo = ApacheBenchmarkPlugin(self.core)
def tearDown(self):
del self.foo
self.foo = None
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)
if __name__ == '__main__':
unittest.main()