summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHanoh Haim <hhaim@cisco.com>2017-01-16 17:17:42 +0200
committerHanoh Haim <hhaim@cisco.com>2017-01-16 17:17:55 +0200
commitf22fba6e536cf2bc79ba56aa173462e27fc95067 (patch)
treebc269fcd912c81386aa610fe1c90f78911a0e415
parentcb8b3426b97f9e0e527541b2ac3f28f89aaf7ab8 (diff)
elk - add more fields
Signed-off-by: Hanoh Haim <hhaim@cisco.com>
-rw-r--r--scripts/automation/regression/trex_elk.py12
-rwxr-xr-xscripts/automation/regression/trex_unit_test.py58
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)