yandex-tank/tests/TankTests.py

45 lines
1.2 KiB
Python
Raw Normal View History

2012-09-12 13:18:58 +00:00
import logging
import sys
2012-09-21 11:47:37 +00:00
import tempfile
2012-09-25 13:59:58 +00:00
import unittest
2012-09-12 13:18:58 +00:00
2015-02-05 14:45:17 +00:00
from yandextank.plugins.Aggregator import SecondAggregateData, \
2013-11-25 13:45:18 +00:00
SecondAggregateDataTotalItem
2015-02-05 14:45:17 +00:00
from yandextank.core import TankCore
2013-11-25 13:45:18 +00:00
2012-09-12 13:18:58 +00:00
class TankTestCase(unittest.TestCase):
formatter = logging.Formatter("%(asctime)s [%(levelname)s] %(name)s\t%(message)s")
logger = logging.getLogger('')
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler(sys.stdout)
ch.setLevel(logging.DEBUG)
ch.setFormatter(formatter)
logger.addHandler(ch)
logger.debug("Starting Unit Test")
2012-09-18 11:47:04 +00:00
def get_aggregate_data(self, filename):
2012-09-20 06:55:45 +00:00
return SecondAggregateData(SecondAggregateDataTotalItem())
2013-11-25 13:45:18 +00:00
2012-09-18 11:47:04 +00:00
def callback(self, data):
2013-11-25 13:45:18 +00:00
self.data = SecondAggregateData(data)
2012-09-18 11:47:04 +00:00
2012-09-21 11:47:37 +00:00
def get_core(self):
self.core = TankCore()
self.core.artifacts_base_dir = tempfile.mkdtemp()
2014-02-12 10:28:01 +00:00
self.core.artifacts_dir = self.core.artifacts_base_dir
2012-09-21 11:47:37 +00:00
return self.core
2012-09-12 13:18:58 +00:00
2013-11-25 13:45:18 +00:00
2012-09-12 13:18:58 +00:00
class FakeOptions(object):
2012-09-12 15:55:59 +00:00
log = ''
verbose = True
config = []
option = ['testsection.testoption=testvalue']
ignore_lock = True
2012-09-18 11:47:04 +00:00
lock_fail = False
2012-09-25 13:59:58 +00:00
no_rc = True
2012-10-01 11:23:59 +00:00
manual_start = False
scheduled_start = None
2013-12-20 18:41:02 +00:00
lock_dir = None