def test_sizing_multiprocess(self): counters = SharedCounters('OK', 'FAILED') with catch_sleep(): @scenario() async def sizer(session): if random.randint(0, 10) == 1: counters['FAILED'] += 1 raise AssertionError() else: counters['OK'] += 1 with set_args('molotov', '--sizing', '-p', '2', '--sizing-tolerance', '5', '--console-update', '0', '-s', 'sizer', 'molotov.tests.test_run') as (stdout, stderr): try: main() except SystemExit: pass stdout, stderr = stdout.read().strip(), stderr.read().strip() # stdout, stderr, rc = self._test_molotov() ratio = (float(counters['FAILED'].value) / float(counters['OK'].value) * 100.) self.assertTrue(ratio >= 5., ratio)
def test_codeworks(self): quickstart._input = self._input with set_args('molostart'): quickstart.main() result = os.listdir(self.location) result.sort() self.assertEqual(result, ['Makefile', 'loadtest.py', 'molotov.json']) os.chdir(self.location) with set_args('molotov', '-cxv', '--max-runs', '1'): try: run.main() except SystemExit: pass
def _test_molotov(self, *args): with set_args('molotov', *args) as (stdout, stderr): try: main() except SystemExit: pass return stdout.read().strip(), stderr.read().strip()
def test_codeworks(self): quickstart._input = self._input with set_args('molostart'): quickstart.main() result = os.listdir(self.tempdir) result.sort() self.assertEqual(result, ['Makefile', 'loadtest.py', 'molotov.json']) os.chdir(self.tempdir) with set_args('molotov', '-cxv', '--max-runs', '1'): try: run.main() except SystemExit: pass
def test_main(self): with set_args('moloslave', _REPO, 'test') as out: main() time.sleep(.2) output = out[0].read() self.assertTrue('Preparing 1 worker...\nOK' in output, output)
def test_codeworks(self): quickstart._input = self._input with set_args("molostart"): quickstart.main() result = os.listdir(self.location) result.sort() self.assertEqual(result, ["Makefile", "loadtest.py", "molotov.json"]) os.chdir(self.location) with set_args("molotov", "-cxv", "--max-runs", "1"): try: run.main() except SystemExit: pass
def test_version(self): with set_args('moloslave', '--version') as out: try: main() except SystemExit: pass version = out[0].read().strip() self.assertTrue(version, __version__)
def test_main(self): with set_args('moloslave', _REPO, 'test') as out: main() if os.environ.get("TRAVIS") is not None: return output = out[0].read() self.assertTrue('Preparing 1 worker...' in output, output) self.assertTrue('OK' in output, output)
def test_generate(self): quickstart._input = self._input with set_args('molostart'): quickstart.main() result = os.listdir(self.location) result.sort() self.assertEqual(result, ['Makefile', 'loadtest.py', 'molotov.json']) # second runs stops with set_args('molostart'): try: quickstart.main() raise AssertionError() except SystemExit: pass
def test_main(self): with set_args("moloslave", _REPO, "test") as out: main() if os.environ.get("TRAVIS") is not None: return output = out[0].read() self.assertTrue("Preparing 1 worker..." in output, output) self.assertTrue("OK" in output, output)
def test_generate(self): quickstart._input = self._input with set_args('molostart'): quickstart.main() result = os.listdir(self.tempdir) result.sort() self.assertEqual(result, ['Makefile', 'loadtest.py', 'molotov.json']) # second runs stops with set_args('molostart'): try: quickstart.main() raise AssertionError() except SystemExit: pass
def test_generate(self): quickstart._input = self._input with set_args("molostart"): quickstart.main() result = os.listdir(self.location) result.sort() self.assertEqual(result, ["Makefile", "loadtest.py", "molotov.json"]) # second runs stops with set_args("molostart"): try: quickstart.main() raise AssertionError() except SystemExit: pass
def test_version(self): with set_args("moloslave", "--version", "--directory", self.dir) as out: try: main() except SystemExit: pass version = out[0].read().strip() self.assertTrue(version, __version__)
def _test_molotov(self, *args): if '--duration' not in args and '-d' not in args: args = list(args) + ['--duration', '10'] rc = 0 with set_args('molotov', *args) as (stdout, stderr): try: main() except SystemExit as e: rc = e.code return stdout.read().strip(), stderr.read().strip(), rc
def test_version(self): quickstart._input = self._input with set_args('molostart', '--version') as out: try: quickstart.main() except SystemExit: pass output = out[0].read().strip() self.assertEqual(output, __version__)
def _test_molotov(self, *args): if "--duration" not in args and "-d" not in args: args = list(args) + ["--duration", "10"] rc = 0 with set_args("molotov", *args) as (stdout, stderr): try: main() except SystemExit as e: rc = e.code return stdout.read().strip(), stderr.read().strip(), rc
def test_sizing_multiprocess(self): counters = SharedCounters("OK", "FAILED") with catch_sleep(): @scenario() async def sizer(session): if random.randint(0, 10) == 1: counters["FAILED"] += 1 raise AssertionError() else: counters["OK"] += 1 with set_args( "molotov", "--sizing", "-p", "2", "--sizing-tolerance", "5", "--console-update", "0", "-s", "sizer", "molotov.tests.test_run", ) as (stdout, stderr): try: main() except SystemExit: pass stdout, stderr = stdout.read().strip(), stderr.read().strip() # stdout, stderr, rc = self._test_molotov() ratio = (float(counters["FAILED"].value) / float(counters["OK"].value) * 100.0) self.assertTrue(ratio >= 4.75, ratio)
def test_fail(self): with set_args("moloslave", _REPO, "fail", "--directory", self.dir): self.assertRaises(Exception, main)
def test_main(self): with set_args("molotov", "-cq", "-d", "1", "molotov/tests/example.py"): main()
def test_fail(self): with set_args("moloslave", _REPO, "fail"): self.assertRaises(Exception, main)
def test_main(self): with set_args('moloslave', _REPO, 'test') as out: main() output = out[0].read() self.assertTrue('Preparing 1 workers...OK' in output)
def test_fail(self): with set_args('moloslave', _REPO, 'fail'): self.assertRaises(Exception, main)
def test_main(self): with set_args('molotov', '-cq', '-d', '1', 'molotov/tests/example.py'): main()