2015-02-05 14:45:17 +00:00
|
|
|
from yandextank.plugins.ShellExec import ShellExecPlugin
|
2015-02-16 23:50:50 +00:00
|
|
|
from Tank_Test import TankTestCase
|
2012-09-12 13:18:58 +00:00
|
|
|
import logging
|
|
|
|
import select
|
|
|
|
import subprocess
|
|
|
|
import unittest
|
|
|
|
|
2015-02-05 14:45:17 +00:00
|
|
|
|
|
|
|
class ShellExecPluginTestCase(TankTestCase):
|
2012-09-12 13:18:58 +00:00
|
|
|
def setUp(self):
|
2012-09-21 11:47:37 +00:00
|
|
|
core = self.get_core()
|
2012-09-12 13:18:58 +00:00
|
|
|
core.load_configs(['config/shellexec.conf'])
|
|
|
|
self.foo = ShellExecPlugin(core)
|
|
|
|
|
|
|
|
def tearDown(self):
|
|
|
|
del self.foo
|
|
|
|
self.foo = None
|
|
|
|
|
|
|
|
def test_run(self):
|
|
|
|
self.foo.configure()
|
|
|
|
self.foo.prepare_test()
|
|
|
|
self.foo.start_test()
|
|
|
|
self.foo.end_test(0)
|
2015-02-05 14:45:17 +00:00
|
|
|
|
2012-09-12 13:18:58 +00:00
|
|
|
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)
|
2015-02-05 14:45:17 +00:00
|
|
|
|
2012-09-12 13:18:58 +00:00
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main()
|