fix tests

This commit is contained in:
Alexey Lavrenuke 2015-02-05 17:45:17 +03:00
parent 6ab390cda6
commit af03121e0c
30 changed files with 96 additions and 95 deletions

View File

@ -1,7 +1,7 @@
from Tests.TankTests import TankTestCase
from TankTests import TankTestCase
import unittest
from Tank.Plugins.ApacheBenchmark import ABReader, ApacheBenchmarkPlugin
from Tank.Plugins.Aggregator import AggregatorPlugin
from yandextank.plugins.ApacheBenchmark import ABReader, ApacheBenchmarkPlugin
from yandextank.plugins.Aggregator import AggregatorPlugin
class ABTestCase(TankTestCase):
def setUp(self):

View File

@ -1,9 +1,9 @@
import time
import unittest
from Tank.Plugins.Aggregator import AggregatorPlugin, AbstractReader, \
from yandextank.plugins.Aggregator import AggregatorPlugin, AbstractReader, \
SecondAggregateDataTotalItem
from Tests.TankTests import TankTestCase
from TankTests import TankTestCase
class AggregatorPluginTestCase(TankTestCase):

View File

@ -1,6 +1,6 @@
from Tank.Plugins.Aggregator import SecondAggregateData
from Tank.Plugins.Autostop import AutostopPlugin
from Tests.TankTests import TankTestCase
from yandextank.plugins.Aggregator import SecondAggregateData
from yandextank.plugins.Autostop import AutostopPlugin
from TankTests import TankTestCase
import tempfile
import unittest

View File

@ -1,7 +1,7 @@
import unittest
from Tests.TankTests import TankTestCase
import tankcore
from TankTests import TankTestCase
import yandextank.core as tankcore
class CommonUtilsTest(TankTestCase):

View File

@ -1,6 +1,6 @@
from Tank.ConsoleWorker import ConsoleTank
from Tests.TankTests import TankTestCase, FakeOptions
from tankcore import ConfigManager
from yandextank.core.consoleworker import ConsoleTank
from TankTests import TankTestCase, FakeOptions
from yandextank.core import ConfigManager
import tempfile
import unittest

View File

@ -1,9 +1,9 @@
from Tank.Plugins.ConsoleOnline import ConsoleOnlinePlugin, AbstractInfoWidget, \
from yandextank.plugins.ConsoleOnline import ConsoleOnlinePlugin, AbstractInfoWidget, \
RealConsoleMarkup
from Tests.TankTests import TankTestCase
from TankTests import TankTestCase
import tempfile
import unittest
from Tank.Plugins.ConsoleScreen import krutilka
from yandextank.plugins.ConsoleScreen import krutilka
class FakeConsoleMarkup(RealConsoleMarkup):
clear = "\n[clear]\n"

View File

@ -1,24 +1,25 @@
from Tank.ConsoleWorker import ConsoleTank
from Tank.Plugins.ConsoleOnline import ConsoleOnlinePlugin
from Tests.ConsoleOnlinePluginTest import FakeConsoleMarkup
from Tests.TankTests import FakeOptions
from yandextank.core.consoleworker import ConsoleTank
from yandextank.plugins.ConsoleOnline import ConsoleOnlinePlugin
from ConsoleOnlinePluginTest import FakeConsoleMarkup
from TankTests import FakeOptions
import TankTests
import logging
import unittest
import datetime
class ConsoleWorkerTestCase(TankTests.TankTestCase):
class ConsoleWorkerTestCase(TankTests.TankTestCase):
def setUp(self):
opts = FakeOptions()
opts.no_rc = False
opts.scheduled_start=datetime.datetime.now().strftime('%H:%M:%S')
opts.scheduled_start = datetime.datetime.now().strftime('%H:%M:%S')
self.foo = ConsoleTank(opts, None)
self.foo.set_baseconfigs_dir('full')
def tearDown(self):
del self.foo
self.foo = None
self.foo = None
def test_perform(self):
self.foo.configure()
@ -28,11 +29,10 @@ class ConsoleWorkerTestCase(TankTests.TankTestCase):
console.console_markup = FakeConsoleMarkup()
except:
pass
if self.foo.perform_test() != 0:
raise RuntimeError()
def test_option_override(self):
options = FakeOptions()
options.config = ["config/phantom.conf"]

View File

@ -1,4 +1,4 @@
from tankcore import AbstractPlugin
from yandextank.core import AbstractPlugin
import time
class DummyPlugin(AbstractPlugin):

View File

@ -2,9 +2,9 @@ import logging
import time
import unittest
from Tank.Plugins.JMeter import JMeterPlugin, JMeterReader
from Tests.TankTests import TankTestCase
from Tank.Plugins.Aggregator import AggregatorPlugin
from yandextank.plugins.JMeter import JMeterPlugin, JMeterReader
from TankTests import TankTestCase
from yandextank.plugins.Aggregator import AggregatorPlugin
class JMeterPluginTestCase(TankTestCase):

View File

@ -1,16 +1,17 @@
from Tank.MonCollector.collector import MonitoringCollector, \
from yandextank.plugins.Monitoring.collector import MonitoringCollector, \
MonitoringDataListener, SSHWrapper
from Tank.Plugins.ConsoleOnline import Screen
from Tank.Plugins.Monitoring import MonitoringPlugin, MonitoringWidget
from Tests.ConsoleOnlinePluginTest import FakeConsoleMarkup
from Tests.TankTests import TankTestCase
from yandextank.plugins.ConsoleOnline import Screen
from yandextank.plugins.Monitoring import MonitoringPlugin, MonitoringWidget
from ConsoleOnlinePluginTest import FakeConsoleMarkup
from TankTests import TankTestCase
import logging
import time
import tempfile
class MonitoringCollectorTestCase(TankTestCase):
data = None
def test_collector(self):
mon = MonitoringCollector()
mon.config = "config/mon1.conf"

View File

@ -2,9 +2,9 @@ import socket
import unittest
import logging
from Tank.Plugins.Phantom import PhantomConfig, PhantomPlugin
from Tests.TankTests import TankTestCase
from Tank.Plugins.PhantomUtils import StepperWrapper, AddressWizard
from yandextank.plugins.Phantom import PhantomConfig, PhantomPlugin
from TankTests import TankTestCase
from yandextank.plugins.PhantomUtils import StepperWrapper, AddressWizard
class PhantomConfigTestCase(TankTestCase):

View File

@ -2,10 +2,10 @@ import os
import time
import unittest
from Tank.Plugins.Aggregator import AggregatorPlugin, SecondAggregateData
from Tank.Plugins.Phantom import PhantomPlugin, PhantomReader
from Tests.TankTests import TankTestCase
from Tank.Plugins.PhantomUtils import StepperWrapper
from yandextank.plugins.Aggregator import AggregatorPlugin, SecondAggregateData
from yandextank.plugins.Phantom import PhantomPlugin, PhantomReader
from TankTests import TankTestCase
from yandextank.plugins.PhantomUtils import StepperWrapper
class PhantomPluginTestCase(TankTestCase):

View File

@ -1,6 +1,6 @@
from Tests.TankTests import TankTestCase
from TankTests import TankTestCase
import unittest
from Tank.Plugins.RCAssert import RCAssertPlugin
from yandextank.plugins.RCAssert import RCAssertPlugin
class RCAssertTestCase(TankTestCase):
def setUp(self):

View File

@ -1,8 +1,8 @@
import unittest
from Tank.Plugins.ResourceCheck import ResourceCheckPlugin
from yandextank.plugins.ResourceCheck import ResourceCheckPlugin
from Tests.TankTests import TankTestCase
from TankTests import TankTestCase
class RCheckTestCase(TankTestCase):

View File

@ -1,6 +1,6 @@
from Tank.Plugins.ConsoleScreen import Screen, CurrentHTTPBlock, CurrentNetBlock
from Tests.ConsoleOnlinePluginTest import FakeConsoleMarkup
from Tests.TankTests import TankTestCase
from yandextank.plugins.ConsoleScreen import Screen, CurrentHTTPBlock, CurrentNetBlock
from ConsoleOnlinePluginTest import FakeConsoleMarkup
from TankTests import TankTestCase
class BlocksTestCase(TankTestCase):
def test_HTTP(self):

View File

@ -1,12 +1,12 @@
from Tank.Plugins.ShellExec import ShellExecPlugin
from Tests.TankTests import TankTestCase
from yandextank.plugins.ShellExec import ShellExecPlugin
from TankTests import TankTestCase
import logging
import select
import subprocess
import tempfile
import unittest
class ShellExecPluginTestCase(TankTestCase):
class ShellExecPluginTestCase(TankTestCase):
def setUp(self):
core = self.get_core()
core.load_configs(['config/shellexec.conf'])
@ -21,11 +21,11 @@ class ShellExecPluginTestCase(TankTestCase):
self.foo.prepare_test()
self.foo.start_test()
self.foo.end_test(0)
def test_select(self):
pipes = subprocess.Popen(["pwd"], stdout=subprocess.PIPE)
r, w, x = select.select([pipes.stdout], [], [], 1)
logging.info("selected: %s %s %s", r, w, x)
if __name__ == '__main__':
unittest.main()

View File

@ -1,9 +1,9 @@
import tempfile
import os
from Tank.stepper import Stepper
from Tank.stepper.format import StpdReader
from Tests.TankTests import TankTestCase
from yandextank.stepper import Stepper
from yandextank.stepper.format import StpdReader
from TankTests import TankTestCase
class StepperTestCase(TankTestCase):
@ -94,7 +94,7 @@ class StepperTestCase(TankTestCase):
).write(stpd_file)
res = open(temp_stpd, 'r').read()
self.assertNotEquals("", res)
self.assertEquals(1900, os.path.getsize(temp_stpd))
self.assertEquals(1904, os.path.getsize(temp_stpd))
def test_manual_inst(self):
@ -126,7 +126,7 @@ class StepperTestCase(TankTestCase):
).write(stpd_file)
res = open(temp_stpd, 'r').read()
self.assertNotEquals("", res)
self.assertEquals(258, os.path.getsize(temp_stpd))
self.assertEquals(262, os.path.getsize(temp_stpd))
def test_default(self):
temp_stpd = tempfile.mkstemp()[1]
@ -161,7 +161,7 @@ class StepperTestCase(TankTestCase):
self.assertEquals(1459, os.path.getsize(temp_stpd))
def test_empty_uri(self):
from Tank.stepper.module_exceptions import AmmoFileError
from yandextank.stepper.module_exceptions import AmmoFileError
temp_stpd = tempfile.mkstemp()[1]
with open(temp_stpd, 'w') as stpd_file:
with self.assertRaises(AmmoFileError):
@ -196,7 +196,7 @@ class StepperTestCase(TankTestCase):
self.assertEquals(len(list(sr)), 10)
def test_bad_stpd_reader(self):
from Tank.stepper.module_exceptions import StpdFileError
from yandextank.stepper.module_exceptions import StpdFileError
sr = StpdReader("data/bad.ammo.stpd")
with self.assertRaises(StpdFileError):
list(sr)

View File

@ -1,7 +1,7 @@
import unittest
from Tests.TankTests import TankTestCase
import tankcore
from TankTests import TankTestCase
import yandextank.core as tankcore
class TankCoreTestCase(TankTestCase):
@ -43,4 +43,3 @@ class TankCoreTestCase(TankTestCase):
if __name__ == '__main__':
unittest.main()

View File

@ -3,9 +3,9 @@ import sys
import tempfile
import unittest
from Tank.Plugins.Aggregator import SecondAggregateData, \
from yandextank.plugins.Aggregator import SecondAggregateData, \
SecondAggregateDataTotalItem
from tankcore import TankCore
from yandextank.core import TankCore
class TankTestCase(unittest.TestCase):

View File

@ -1,9 +1,9 @@
from Tank.Plugins.Aggregator import SecondAggregateData, \
from yandextank.plugins.Aggregator import SecondAggregateData, \
SecondAggregateDataTotalItem
from Tank.Plugins.TotalAutostop import TotalFracTimeCriteria, TotalHTTPCodesCriteria, TotalNegativeHTTPCodesCriteria, TotalNetCodesCriteria, TotalNegativeNetCodesCriteria, TotalHTTPTrendCriteria, QuantileOfSaturationCriteria
from Tests.TankTests import TankTestCase
from yandextank.plugins.TotalAutostop import TotalFracTimeCriteria, TotalHTTPCodesCriteria, TotalNegativeHTTPCodesCriteria, TotalNetCodesCriteria, TotalNegativeNetCodesCriteria, TotalHTTPTrendCriteria, QuantileOfSaturationCriteria
from TankTests import TankTestCase
import unittest
from Tank.Plugins.Autostop import AutostopPlugin
from yandextank.plugins.Autostop import AutostopPlugin
class TotalCriteriasTest(TankTestCase):
def setUp(self):

View File

@ -1,5 +1,5 @@
[tank]
#plugin_console=Tank/Plugins/ConsoleOnline.py
#plugin_console=yandextank.plugins.ConsoleOnline
[phantom]
cases = 'search_%D0%BF%D0%BE%D1%80%D0%BD%D0%BE_users' 'search' 'search_%D0%BD%D1%8E_users' 'search_%D1%8D%D1%80%D0%BE%D1%82%D0%B8%D0%BA%D0%B0_users' 'search_%D1%86%D0%B2%D0%B5%D1%82%D1%8B_users' 'search_%D0%B1%D0%B5%D0%B7%20%D1%82%D1%80%D1%83%D1%81%D0%B8%D0%BA%D0%BE%D0%B2_users'

View File

@ -1,7 +1,7 @@
[tank]
plugin_aggreg=Tank/Plugins/Aggregator.py
plugin_phantom=Tank/Plugins/Phantom.py
plugin_console=Tank/Plugins/ConsoleOnline.py
plugin_aggreg=yandextank.plugins.Aggregator
plugin_phantom=yandextank.plugins.Phantom
plugin_console=yandextank.plugins.ConsoleOnline
[phantom]
cases = 'search_%D0%BF%D0%BE%D1%80%D0%BD%D0%BE_users' 'search' 'search_%D0%BD%D1%8E_users' 'search_%D1%8D%D1%80%D0%BE%D1%82%D0%B8%D0%BA%D0%B0_users' 'search_%D1%86%D0%B2%D0%B5%D1%82%D1%8B_users' 'search_%D0%B1%D0%B5%D0%B7%20%D1%82%D1%80%D1%83%D1%81%D0%B8%D0%BA%D0%BE%D0%B2_users'

View File

@ -1,5 +1,5 @@
[tank]
plugin_aggreg=Tank/Plugins/Aggregator.py
plugin_aggreg=yandextank.plugins.Aggregator
[phantom]
cases = 'search_%D0%BF%D0%BE%D1%80%D0%BD%D0%BE_users' 'search' 'search_%D0%BD%D1%8E_users' 'search_%D1%8D%D1%80%D0%BE%D1%82%D0%B8%D0%BA%D0%B0_users' 'search_%D1%86%D0%B2%D0%B5%D1%82%D1%8B_users' 'search_%D0%B1%D0%B5%D0%B7%20%D1%82%D1%80%D1%83%D1%81%D0%B8%D0%BA%D0%BE%D0%B2_users'

View File

@ -3,8 +3,7 @@ dotted.test=passed
[tank]
someoption=somevalue
plugin_ShellExec=Tank/Plugins/ShellExec.py
plugin_ShellExec2=Tests/Dummy.py
plugin_ShellExec=yandextank.plugins.ShellExec
plugin_disabled=
someoption=somevalue

View File

@ -1,7 +1,8 @@
[tank]
plugin_phantom=Tank/Plugins/Phantom.py
plugin_console=Tank/Plugins/ConsoleOnline.py
plugin_aggreg=Tank/Plugins/Aggregator.py
plugin_phantom=yandextank.plugins.Phantom
plugin_console=yandextank.plugins.ConsoleOnline
plugin_aggreg=yandextank.plugins.Aggregator
[phantom]
ammofile=data/dummy.ammo
connection_test=0

View File

@ -1,6 +1,6 @@
[tank]
plugin_aggreg=Tank/Plugins/Aggregator.py
plugin_console=Tank/Plugins/ConsoleOnline.py
plugin_aggreg=yandextank.plugins.Aggregator
plugin_console=yandextank.plugins.ConsoleOnline
[phantom]
phantom_path=phantom

View File

@ -1,6 +1,6 @@
[tank]
plugin_aggreg=Tank/Plugins/Aggregator.py
plugin_console=Tank/Plugins/ConsoleOnline.py
plugin_aggreg=yandextank.plugins.Aggregator
plugin_console=yandextank.plugins.ConsoleOnline
[phantom]
phantom_path=phantom

View File

@ -1,4 +1,4 @@
[tank]
plugin_ShellExec=Tank/Plugins/ShellExec.py
plugin_Dummy=Tank/Plugins/Dummy.py
plugin_ShellExec3=Tank/Plugins/ShellExec3.py
plugin_ShellExec=yandextank.plugins.ShellExec
plugin_Dummy=Dummy
plugin_ShellExec3=yandextank.plugins.ShellExec3

View File

@ -1,8 +1,8 @@
[tank]
plugin_ShellExec=Tank/Plugins/ShellExec.py
plugin_phantom=Tank/Plugins/Phantom.py
plugin_aggreg=Tank/Plugins/Aggregator.py
plugin_console=Tank/Plugins/ConsoleOnline.py
plugin_ShellExec=yandextank.plugins.ShellExec
plugin_phantom=yandextank.plugins.Phantom
plugin_aggreg=yandextank.plugins.Aggregator
plugin_console=yandextank.plugins.ConsoleOnline
[aggregator]
time_periods=1 5 10 50 100ms 500 1s
@ -11,9 +11,10 @@ time_periods=1 5 10 50 100ms 500 1s
ammofile=data/dummy.ammo
instances_schedule=line(1,10,1m)
#loop=100
ammo_limit=100
ammo_limit=10
load=const(1,1) line(1,50,10)
use_caching=1
connection_test=0
[shellexec]
prepare=uname -a

View File

@ -5,7 +5,7 @@ import time
import unittest
import base64
from Tank.MonCollector.agent.agent import CpuStat, Custom, Disk, NetTcp, NetTxRx
from yandextank.plugins.Monitoring.agent.agent import CpuStat, Custom, Disk, NetTcp, NetTxRx
if __name__ == '__main__':