aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpmikus <peter.mikus@protonmail.ch>2023-02-20 10:26:38 +0000
committerPeter Mikus <peter.mikus@protonmail.ch>2023-02-20 11:14:00 +0000
commit67530f8b471514dabb5a69b3a157c0e941007746 (patch)
treee2c601fcf974c60b502c4d58875ff5f63896099b
parentc18a940c44f566b1bdaa91d9015c5730ffd57679 (diff)
feat(telemetry): Data compress
Signed-off-by: pmikus <peter.mikus@protonmail.ch> Change-Id: I652844e722e24cb49f09a3f30aabe3103e271079 (cherry picked from commit 28dc464d05d62c22ec6b3dee01fafffcd0ab754d) (cherry picked from commit ad9bf8a4651edf37214865492f3127a89abd803c)
-rw-r--r--docs/model/current/schema/test_case.info.schema.yaml4
-rw-r--r--docs/model/current/top.rst2
-rw-r--r--resources/libraries/python/Constants.py2
-rw-r--r--resources/libraries/python/model/ExportJson.py7
4 files changed, 11 insertions, 4 deletions
diff --git a/docs/model/current/schema/test_case.info.schema.yaml b/docs/model/current/schema/test_case.info.schema.yaml
index e97cd74955..5d33e0e149 100644
--- a/docs/model/current/schema/test_case.info.schema.yaml
+++ b/docs/model/current/schema/test_case.info.schema.yaml
@@ -13,7 +13,7 @@
---
-$id: https://fd.io/FIXME/CSIT/UTI/test_case/info/1.3.0
+$id: https://fd.io/FIXME/CSIT/UTI/test_case/info/1.4.0
$schema: https://json-schema.org/draft/2020-12/schema
description: >-
Schema for output of test case.
@@ -364,7 +364,7 @@ allOf:
CSIT model version (semver format)
the exporting code adhered to.
type: string
- const: 1.3.0
+ const: 1.4.0
required:
- duration
- dut_type
diff --git a/docs/model/current/top.rst b/docs/model/current/top.rst
index 3f09710ceb..721e6b2ff0 100644
--- a/docs/model/current/top.rst
+++ b/docs/model/current/top.rst
@@ -22,7 +22,7 @@ especially the export side (UTI), not import side (PAL).
Version
~~~~~~~
-This document is valid for CSIT model version 1.3.0.
+This document is valid for CSIT model version 1.4.0.
It is recommended to use semantic versioning: https://semver.org/
That means, if the new model misses a field present in the old model,
diff --git a/resources/libraries/python/Constants.py b/resources/libraries/python/Constants.py
index 4cf6681324..01e3a0154a 100644
--- a/resources/libraries/python/Constants.py
+++ b/resources/libraries/python/Constants.py
@@ -120,7 +120,7 @@ class Constants:
"""Constants used in CSIT."""
# Version for CSIT data model. See docs/model/.
- MODEL_VERSION = u"1.3.0"
+ MODEL_VERSION = u"1.4.0"
# Global off-switch in case JSON export is large or slow.
EXPORT_JSON = get_optimistic_bool_from_env(u"EXPORT_JSON")
diff --git a/resources/libraries/python/model/ExportJson.py b/resources/libraries/python/model/ExportJson.py
index bd457c00f6..478b3abb60 100644
--- a/resources/libraries/python/model/ExportJson.py
+++ b/resources/libraries/python/model/ExportJson.py
@@ -23,9 +23,11 @@ as serialization might have introduced subtle errors.
import datetime
import os.path
+from binascii import b2a_base64
from dateutil.parser import parse
from robot.api import logger
from robot.libraries.BuiltIn import BuiltIn
+from zlib import compress
from resources.libraries.python.Constants import Constants
from resources.libraries.python.jumpavg.AvgStdevStats import AvgStdevStats
@@ -357,6 +359,11 @@ class ExportJson():
Results are used to avoid future post processing, making it more
efficient to consume.
"""
+ if self.data["telemetry"]:
+ telemetry_encode = "\n".join(self.data["telemetry"]).encode()
+ telemetry_compress = compress(telemetry_encode, level=9)
+ telemetry_base64 = b2a_base64(telemetry_compress, newline=False)
+ self.data["telemetry"] = [telemetry_base64.decode()]
if u"result" not in self.data:
return
result_node = self.data[u"result"]