In funkload, is it possible to do set up variables in setUpCycle() and have it accessible in the test itself?

I'm trying to write some performance tests in funkload. I would like to do some service discovery in the test setUpCycle() and then have that information passed to every thread the benchmark starts. However setting a variable in the setUpCycle() or setupBench() does not propagate to the test itself. Is there any way to do this?

class PerfTest(FunkLoadTestCase):
  def setUpCycle(self):
    self.service = service_discover() # this is a costly operation

  def test_Get(self):
    print self.service

Running fl-run-bench on this test fails with “'PerfTest' has no attribute 'service'.

0 votes

1 answers



Hi, yes this is correct, setUpBench and setUpCycle are called with a private instance of the testcase.

If you need to share data between the running threads you can put your data in a file during the setUpCycle and read the file from the setUp method.

Thanks for your feedback, I will update the docs to make this clear.


0 votes