Exemple #1
0
 def test_diagnostics(self):
     obj = PBenchExecutor()
     obj.engine = EngineEmul()
     obj.settings = BetterDict()
     obj.engine.config.merge({
         "provisioning":
         "test",
         ScenarioExecutor.EXEC: [{
             "throughput": 10,
             "hold-for": 30,
             "scenario": {
                 "default-address": "http://blazedemo.com/",
                 "requests": ["/"]
             }
         }]
     })
     obj.execution = obj.engine.config['execution'][0]
     obj.settings.merge({
         "path": RESOURCES_DIR + "pbench/phantom.sh",
     })
     obj.prepare()
     obj.startup()
     for _ in range(3):
         obj.check()
     obj.shutdown()
     obj.post_process()
     self.assertIsNotNone(obj.get_error_diagnostics())
Exemple #2
0
        def test_simple(self):
            obj = PBenchExecutor()
            obj.engine = EngineEmul()
            obj.engine.aggregator = ConsolidatingAggregator()
            obj.engine.aggregator.add_listener(DataPointLogger())
            obj.engine.config.merge({"provisioning": "test"})

            if os.path.exists("/home/undera/Sources/phantom"):  # FIXME: not good, get rid of it
                obj.settings.merge(
                    {
                        "path": "/home/undera/Sources/phantom/bin/phantom",
                        "modules-path": "/home/undera/Sources/phantom/lib/phantom",
                    }
                )
            else:
                obj.settings.merge({"path": os.path.join(os.path.dirname(__file__), "..", "phantom.sh")})

            obj.execution.merge(
                {
                    "log-responses": "proto_error",
                    # "iterations": 5000000,
                    "concurrency": 10,
                    "throughput": 1000,
                    "ramp-up": "1m",
                    # "steps": 5,
                    "hold-for": "15",
                    "scenario": {
                        "timeout": 1,
                        "default-address": "http://localhost:33",
                        "headers": {"Connection": "close"},
                        "requests": [
                            # "/",
                            {
                                "url": "/api",
                                "method": "POST",
                                "headers": {"Content-Length": 0},
                                "body": {"param": "value"},
                            }
                        ],
                    },
                }
            )
            obj.engine.aggregator.prepare()
            obj.prepare()

            obj.engine.aggregator.startup()
            obj.startup()

            while not obj.check():
                logging.debug("Running...")
                obj.engine.aggregator.check()
                time.sleep(1)

            obj.shutdown()
            obj.engine.aggregator.shutdown()

            obj.post_process()
            obj.engine.aggregator.post_process()
Exemple #3
0
        def test_simple(self):
            obj = PBenchExecutor()
            obj.engine = EngineEmul()
            obj.engine.aggregator = ConsolidatingAggregator()
            obj.engine.aggregator.add_listener(DataPointLogger())
            obj.engine.config.merge({"provisioning": "test"})

            if os.path.exists("/home/undera/Sources/phantom"):  # FIXME: not good, get rid of it
                obj.settings.merge({
                    "path": "/home/undera/Sources/phantom/bin/phantom",
                    "modules-path": "/home/undera/Sources/phantom/lib/phantom"})
            else:
                obj.settings.merge({
                    "path": os.path.join(os.path.dirname(__file__), "..", "resources", "pbench", "phantom.sh")})

            obj.execution.merge({
                "log-responses": "proto_error",
                # "iterations": 5000000,
                "concurrency": 10,
                "throughput": 1000,
                "ramp-up": "1m",
                # "steps": 5,
                "hold-for": "15",
                "scenario": {
                    "timeout": 1,
                    "default-address": "http://localhost:33",
                    "headers": {
                        "Connection": "close"
                    },
                    "requests": [
                        # "/",
                        {
                            "url": "/api",
                            "method": "POST",
                            "headers": {
                                "Content-Length": 0
                            },
                            "body": {
                                "param": "value"}}]}})
            obj.engine.aggregator.prepare()
            obj.prepare()

            obj.engine.aggregator.startup()
            obj.startup()

            while not obj.check():
                logging.debug("Running...")
                obj.engine.aggregator.check()
                time.sleep(1)

            obj.shutdown()
            obj.engine.aggregator.shutdown()

            obj.post_process()
            obj.engine.aggregator.post_process()