From f22fba6e536cf2bc79ba56aa173462e27fc95067 Mon Sep 17 00:00:00 2001 From: Hanoh Haim Date: Mon, 16 Jan 2017 17:17:42 +0200 Subject: elk - add more fields Signed-off-by: Hanoh Haim --- scripts/automation/regression/trex_elk.py | 12 ++--- scripts/automation/regression/trex_unit_test.py | 58 ++++++++++++------------- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/scripts/automation/regression/trex_elk.py b/scripts/automation/regression/trex_elk.py index ddca474e..a5ef7a88 100644 --- a/scripts/automation/regression/trex_elk.py +++ b/scripts/automation/regression/trex_elk.py @@ -291,11 +291,13 @@ class TRexEs(object): "test" : { "properties": { - "name" : { "type": "text" }, # name of the test - "type" : { "type": "keyword" }, # stateless,stateful, other - "duration_sec" : { "type": "double" }, # sec - "result" : { "type": "keyword" }, # PASS,FAIL,SKIP - "stdout" : { "type": "text" }, # output in case of faliue + "name" : { "type" : "text" }, # name of the test + "name_key" : { "type" : "keyword" }, # name of the test + "name_full" : { "type" : "keyword" }, # full name of the test + "type" : { "type" : "keyword" }, # stateless,stateful, other + "duration_sec" : { "type": "double" }, # sec + "result" : { "type" : "keyword" }, # PASS,FAIL,SKIP + "stdout" : { "type" : "text" }, # output in case of faliue } } } diff --git a/scripts/automation/regression/trex_unit_test.py b/scripts/automation/regression/trex_unit_test.py index c1fc416b..99790fed 100755 --- a/scripts/automation/regression/trex_unit_test.py +++ b/scripts/automation/regression/trex_unit_test.py @@ -208,28 +208,22 @@ class CTRexTestConfiguringPlugin(Plugin): return '' def addError(self, test, err, capt=None): - - taken = self._timeTaken() - - if issubclass(err[0], SkipTest): - _type = 'SKIPPED' - else: - _type = 'ERROR' - - tb = format_exception(err, self.encoding) - id = test.id() - err_msg=self._getCapturedStdout()+self._getCapturedStderr(); - name=id_split(id)[-1] - elk = CTRexScenario.elk if elk: + taken = self._timeTaken() + id = test.id() + err_msg=self._getCapturedStdout()+self._getCapturedStderr(); + name=id_split(id)[-1] + elk_obj = trex.copy_elk_info () elk_obj['test']={ "name" : name, - "type" : self.get_operation_mode (), - "duration_sec" : taken, - "result" : _type, - "stdout" : err_msg, + "name_key" : name, + "name_full" : id, + "type" : self.get_operation_mode (), + "duration_sec" : taken, + "result" : "ERROR", + "stdout" : err_msg, }; #pprint(elk_obj['test']); elk.reg.push_data(elk_obj) @@ -237,17 +231,19 @@ class CTRexTestConfiguringPlugin(Plugin): def addFailure(self, test, err, capt=None, tb_info=None): - taken = self._timeTaken() - tb = format_exception(err, self.encoding) - id = test.id() - err_msg=self._getCapturedStdout()+self._getCapturedStderr(); - name=id_split(id)[-1] - elk = CTRexScenario.elk if elk: + taken = self._timeTaken() + tb = format_exception(err, self.encoding) + id = test.id() + err_msg=self._getCapturedStdout()+self._getCapturedStderr(); + name=id_split(id)[-1] + elk_obj = trex.copy_elk_info () elk_obj['test']={ "name" : name, + "name_key" : name, + "name_full" : id, "type" : self.get_operation_mode (), "duration_sec" : taken, "result" : "FAILURE", @@ -259,18 +255,20 @@ class CTRexTestConfiguringPlugin(Plugin): def addSuccess(self, test, capt=None): - taken = self._timeTaken() - id = test.id() - name=id_split(id)[-1] elk = CTRexScenario.elk if elk: + taken = self._timeTaken() + id = test.id() + name=id_split(id)[-1] elk_obj = trex.copy_elk_info () elk_obj['test']={ "name" : name, - "type" : self.get_operation_mode (), - "duration_sec" : taken, - "result" : "PASS", - "stdout" : "", + "name_key" : name, + "name_full" : id, + "type" : self.get_operation_mode (), + "duration_sec" : taken, + "result" : "PASS", + "stdout" : "", }; #pprint(elk_obj['test']); elk.reg.push_data(elk_obj) -- cgit 1.2.3-korg