Esempio n. 1
0
    def test__process_main_time(self):
        result = {
            "result": [
                {"error": [], "duration": 1, "idle_duration": 2},
                {"error": True, "duration": 1, "idle_duration": 1},
                {"error": [], "duration": 2, "idle_duration": 3},
            ]
        }

        output = plot._process_main_duration(result)

        self.assertEqual(
            output,
            {
                "pie": [{"key": "success", "value": 2}, {"key": "errors", "value": 1}],
                "iter": [
                    {"key": "duration", "values": [[1, 1], [2, 0], [3, 2]]},
                    {"key": "idle_duration", "values": [[1, 2], [2, 0], [3, 3]]},
                ],
                "histogram": [
                    {"key": "task", "method": "Square Root Choice", "values": [{"x": 1, "y": 1}, {"x": 1, "y": 0}]},
                    {"key": "task", "method": "Sturges Formula", "values": [{"x": 1, "y": 1}, {"x": 1, "y": 0}]},
                    {
                        "key": "task",
                        "method": "Rice Rule",
                        "values": [{"x": 1, "y": 1}, {"x": 1, "y": 0}, {"x": 1, "y": 0}],
                    },
                    {"key": "task", "method": "One Half", "values": [{"x": 2, "y": 2}]},
                ],
            },
        )
Esempio n. 2
0
    def test__process_main_time(self):
        result = {
            "result": [
                {
                    "error": [],
                    "duration": 1,
                    "idle_duration": 2,
                    "atomic_actions": {},
                    "scenario_output": {"errors": [], "data": {}}
                },
                {
                    "error": ["some", "error", "occurred"],
                    "duration": 1,
                    "idle_duration": 1,
                    "atomic_actions": {},
                    "scenario_output": {"errors": [], "data": {}}
                },
                {
                    "error": [],
                    "duration": 2,
                    "idle_duration": 3,
                    "atomic_actions": {},
                    "scenario_output": {"errors": [], "data": {}}
                }
            ],
            "sla": "foo_sla",
            "load_duration": 1234.5,
            "full_duration": 6789.1
        }

        output = plot._process_main_duration(result,
                                             plot._prepare_data(result))

        self.assertEqual(output, {
            "pie": [
                {"key": "success", "value": 2},
                {"key": "errors", "value": 1}
            ],
            "iter": [
                {
                    "key": "duration",
                    "values": [(1, 1.0), (2, 0), (3, 2.0)]
                },
                {
                    "key": "idle_duration",
                    "values": [(1, 2.0), (2, 0), (3, 3.0)]
                }
            ],
            "histogram": [
                {
                    "key": "task",
                    "method": "Square Root Choice",
                    "values": [{"x": 1.0, "y": 1.0}, {"x": 1.0, "y": 0.0}]
                },
                {
                    "key": "task",
                    "method": "Sturges Formula",
                    "values": [{"x": 1.0, "y": 1.0}, {"x": 1.0, "y": 0.0}]
                },
                {
                    "key": "task",
                    "method": "Rice Rule",
                    "values": [{"x": 1.0, "y": 1.0}, {"x": 1.0, "y": 0.0},
                               {"x": 1.0, "y": 0.0}]
                },
                {
                    "key": "task",
                    "method": "One Half",
                    "values": [{"x": 2.0, "y": 2.0}]
                }
            ]
        })
Esempio n. 3
0
    def test__process_main_time(self):
        result = {
            "result": [
                {
                    "error": [],
                    "duration": 1,
                    "idle_duration": 2
                },
                {
                    "error": True,
                    "duration": 1,
                    "idle_duration": 1
                },
                {
                    "error": [],
                    "duration": 2,
                    "idle_duration": 3
                }
            ]
        }

        output = plot._process_main_duration(result)

        self.assertEqual(output, {
            "pie": [
                {"key": "success", "value": 2},
                {"key": "errors", "value": 1}
            ],
            "iter": [
                {
                    "key": "duration",
                    "values": [[1, 1], [2, 0], [3, 2]]
                },
                {
                    "key": "idle_duration",
                    "values": [[1, 2], [2, 0], [3, 3]]
                }
            ],
            "histogram": [
                {
                    "key": "task",
                    "method": "Square Root Choice",
                    "values": [{"x": 1, "y": 1}, {"x": 1, "y": 0}]
                },
                {
                    "key": "task",
                    "method": "Sturges Formula",
                    "values": [{"x": 1, "y": 1}, {"x": 1, "y": 0}]
                },
                {
                    "key": "task",
                    "method": "Rice Rule",
                    "values": [{"x": 1, "y": 1}, {"x": 1, "y": 0},
                               {"x": 1, "y": 0}]
                },
                {
                    "key": "task",
                    "method": "One Half",
                    "values": [{"x": 2, "y": 2}]
                }
            ]
        })
Esempio n. 4
0
    def test__process_main_time(self):
        result = {
            "result": [{
                "error": [],
                "duration": 1,
                "idle_duration": 2,
                "atomic_actions": {},
                "scenario_output": {
                    "errors": [],
                    "data": {}
                }
            }, {
                "error": ["some", "error", "occurred"],
                "duration": 1,
                "idle_duration": 1,
                "atomic_actions": {},
                "scenario_output": {
                    "errors": [],
                    "data": {}
                }
            }, {
                "error": [],
                "duration": 2,
                "idle_duration": 3,
                "atomic_actions": {},
                "scenario_output": {
                    "errors": [],
                    "data": {}
                }
            }],
            "sla":
            "foo_sla",
            "load_duration":
            1234.5,
            "full_duration":
            6789.1
        }

        output = plot._process_main_duration(result,
                                             plot._prepare_data(result))

        self.assertEqual(
            {
                "pie": [{
                    "key": "success",
                    "value": 2
                }, {
                    "key": "errors",
                    "value": 1
                }],
                "iter": [{
                    "key": "duration",
                    "values": [(1, 1.0), (2, 0), (3, 2.0)]
                }, {
                    "key": "idle_duration",
                    "values": [(1, 2.0), (2, 0), (3, 3.0)]
                }],
                "histogram": [
                    {
                        "key": "task",
                        "method": "Square Root Choice",
                        "values": [{
                            "x": 1.0,
                            "y": 1.0
                        }, {
                            "x": 1.0,
                            "y": 0.0
                        }]
                    }, {
                        "key": "task",
                        "method": "Sturges Formula",
                        "values": [{
                            "x": 1.0,
                            "y": 1.0
                        }, {
                            "x": 1.0,
                            "y": 0.0
                        }]
                    }, {
                        "key":
                        "task",
                        "method":
                        "Rice Rule",
                        "values": [{
                            "x": 1.0,
                            "y": 1.0
                        }, {
                            "x": 1.0,
                            "y": 0.0
                        }, {
                            "x": 1.0,
                            "y": 0.0
                        }]
                    }, {
                        "key": "task",
                        "method": "One Half",
                        "values": [{
                            "x": 2.0,
                            "y": 2.0
                        }]
                    }
                ]
            }, output)
Esempio n. 5
0
    def test__process_main_time(self):
        result = {
            "result": [{
                "error": [],
                "duration": 1,
                "idle_duration": 2,
                "atomic_actions": {}
            }, {
                "error": True,
                "duration": 1,
                "idle_duration": 1,
                "atomic_actions": {}
            }, {
                "error": [],
                "duration": 2,
                "idle_duration": 3,
                "atomic_actions": {}
            }]
        }

        output = plot._process_main_duration(result,
                                             plot._prepare_data(result))

        self.assertEqual(
            output, {
                "pie": [{
                    "key": "success",
                    "value": 2
                }, {
                    "key": "errors",
                    "value": 1
                }],
                "iter": [{
                    "key": "duration",
                    "values": [(1, 1.0), (2, 1.0), (3, 2.0)]
                }, {
                    "key": "idle_duration",
                    "values": [(1, 2.0), (2, 1.0), (3, 3.0)]
                }],
                "histogram": [
                    {
                        "key": "task",
                        "method": "Square Root Choice",
                        "values": [{
                            "x": 1.0,
                            "y": 1.0
                        }, {
                            "x": 1.0,
                            "y": 0.0
                        }]
                    }, {
                        "key": "task",
                        "method": "Sturges Formula",
                        "values": [{
                            "x": 1.0,
                            "y": 1.0
                        }, {
                            "x": 1.0,
                            "y": 0.0
                        }]
                    }, {
                        "key":
                        "task",
                        "method":
                        "Rice Rule",
                        "values": [{
                            "x": 1.0,
                            "y": 1.0
                        }, {
                            "x": 1.0,
                            "y": 0.0
                        }, {
                            "x": 1.0,
                            "y": 0.0
                        }]
                    }, {
                        "key": "task",
                        "method": "One Half",
                        "values": [{
                            "x": 2.0,
                            "y": 2.0
                        }]
                    }
                ]
            })
Esempio n. 6
0
    def test__process_main_time(self):
        result = {
            "result": [
                {
                    "error": [],
                    "duration": 1,
                    "idle_duration": 2,
                    "atomic_actions": {}
                },
                {
                    "error": True,
                    "duration": 1,
                    "idle_duration": 1,
                    "atomic_actions": {}
                },
                {
                    "error": [],
                    "duration": 2,
                    "idle_duration": 3,
                    "atomic_actions": {}
                }
            ]
        }

        output = plot._process_main_duration(result,
                                             plot._prepare_data(result))

        self.assertEqual(output, {
            "pie": [
                {"key": "success", "value": 2},
                {"key": "errors", "value": 1}
            ],
            "iter": [
                {
                    "key": "duration",
                    "values": [(1, 1.0), (2, 1.0), (3, 2.0)]
                },
                {
                    "key": "idle_duration",
                    "values": [(1, 2.0), (2, 1.0), (3, 3.0)]
                }
            ],
            "histogram": [
                {
                    "key": "task",
                    "method": "Square Root Choice",
                    "values": [{"x": 1.0, "y": 1.0}, {"x": 1.0, "y": 0.0}]
                },
                {
                    "key": "task",
                    "method": "Sturges Formula",
                    "values": [{"x": 1.0, "y": 1.0}, {"x": 1.0, "y": 0.0}]
                },
                {
                    "key": "task",
                    "method": "Rice Rule",
                    "values": [{"x": 1.0, "y": 1.0}, {"x": 1.0, "y": 0.0},
                               {"x": 1.0, "y": 0.0}]
                },
                {
                    "key": "task",
                    "method": "One Half",
                    "values": [{"x": 2.0, "y": 2.0}]
                }
            ]
        })