Beispiel #1
0
    def test_task_get_detailed_last(self):
        task1 = self._create_task()
        key = {"name": "atata"}
        data = {"a": "b", "c": "d"}

        db.task_result_create(task1["uuid"], key, data)
        task1_full = db.task_get_detailed_last()
        results = task1_full["results"]
        self.assertEqual(len(results), 1)
        self.assertEqual(results[0]["key"], key)
        self.assertEqual(results[0]["data"], data)
Beispiel #2
0
    def test_task_get_detailed_last(self):
        task1 = self._create_task()
        key = {"name": "atata"}
        data = {"a": "b", "c": "d"}

        db.task_result_create(task1["uuid"], key, data)
        task1_full = db.task_get_detailed_last()
        results = task1_full["results"]
        self.assertEqual(len(results), 1)
        self.assertEqual(results[0]["key"], key)
        self.assertEqual(results[0]["data"], data)
Beispiel #3
0
    def test_task_get_detailed_last(self):
        task1 = self._create_task()
        key = {
            "name": "atata",
            "description": "tatata",
            "pos": 0,
            "kw": {
                "args": {"a": "A"},
                "context": {"c": "C"},
                "sla": {"s": "S"},
                "runner": {"r": "R", "type": "T"},
                "hooks": [],
            }
        }
        data = {
            "sla": [
                {"s": "S", "success": True},
                {"1": "2", "success": True},
                {"a": "A", "success": True}
            ],
            "load_duration": 13,
            "full_duration": 42,
            "hooks": [],
        }

        subtask = db.subtask_create(task1["uuid"], title="foo")
        workload = db.workload_create(task1["uuid"], subtask["uuid"], key)
        db.workload_data_create(
            task1["uuid"], workload["uuid"], 0, {"raw": []})
        db.workload_set_results(workload["uuid"], data)

        task1_full = db.task_get_detailed_last()
        results = task1_full["results"]
        self.assertEqual(1, len(results))
        self.assertEqual(key, results[0]["key"])
        self.assertEqual({
            "raw": [],
            "sla": [
                {"s": "S", "success": True},
                {"1": "2", "success": True},
                {"a": "A", "success": True}
            ],
            "load_duration": 13,
            "full_duration": 42,
            "hooks": [],
        }, results[0]["data"])
Beispiel #4
0
    def test_task_get_detailed_last(self):
        task1 = self._create_task()
        key = {
            "name": "atata",
            "pos": 0,
            "kw": {
                "args": {
                    "a": "A"
                },
                "context": {
                    "c": "C"
                },
                "sla": {
                    "s": "S"
                },
                "runner": {
                    "r": "R",
                    "type": "T"
                }
            }
        }
        data = {
            "raw": [],
            "sla": [{
                "s": "S",
                "success": True
            }, {
                "1": "2",
                "success": True
            }, {
                "a": "A",
                "success": True
            }],
            "load_duration":
            13,
            "full_duration":
            42,
            "hooks": [],
        }

        db.task_result_create(task1["uuid"], key, data)
        task1_full = db.task_get_detailed_last()
        results = task1_full["results"]
        self.assertEqual(1, len(results))
        self.assertEqual(key, results[0]["key"])
        self.assertEqual(data, results[0]["data"])