pytest-testinfra icon indicating copy to clipboard operation
pytest-testinfra copied to clipboard

parallel execution for multiple servers

Open TheKushIsGood opened this issue 1 year ago • 1 comments

I have few hundred small GCP, Azure servers. I want to run some basic tests against them. Is there a way to parallelize my tests? Each test test less than a few ms, but I have hundreds of checks I need to run.

My code looks like this

import unittest
import testinfra

class Test(unittest.TestCase):
    def setUp(self):
        self.host = testinfra.get_host("paramiko://user@localhost")

    def test_foo_config(self):
        self.assertEqual(self.host.run("/tmp/f.sh").rc,0)


if __name__=="__main__":
    unittest.main()

Any help in organizing code, tips, and recommendations would be much appreciated.

Great tool BTW

TheKushIsGood avatar Jul 01 '23 12:07 TheKushIsGood

Use pytest-xdist as documented in https://testinfra.readthedocs.io/en/latest/invocation.html#parallel-execution ?

philpep avatar Aug 24 '23 21:08 philpep