summaryrefslogtreecommitdiffstats
path: root/doctor_tests/consumer
diff options
context:
space:
mode:
authordongwenjuan <dong.wenjuan@zte.com.cn>2018-03-20 15:13:14 +0800
committerdongwenjuan <dong.wenjuan@zte.com.cn>2018-03-20 16:27:19 +0800
commit631c3f99f0e499edd1adcbc7550dd3d0de393e31 (patch)
treeba85640e823956ea02c2ae045909e74b80c06ec1 /doctor_tests/consumer
parent5bbd044650de0ab4179101bb3156dd315be9391f (diff)
optimize the fault notification test
Change-Id: I47572b4515049c49f9aa04bf7984757779a605f3 Signed-off-by: dongwenjuan <dong.wenjuan@zte.com.cn>
Diffstat (limited to 'doctor_tests/consumer')
-rw-r--r--doctor_tests/consumer/base.py9
-rw-r--r--doctor_tests/consumer/sample.py4
2 files changed, 12 insertions, 1 deletions
diff --git a/doctor_tests/consumer/base.py b/doctor_tests/consumer/base.py
index b6c4b34e..e21b0802 100644
--- a/doctor_tests/consumer/base.py
+++ b/doctor_tests/consumer/base.py
@@ -16,6 +16,15 @@ class BaseConsumer(object):
def __init__(self, conf, log):
self.conf = conf
self.log = log
+ self._notified_time = None
+
+ @property
+ def notified_time(self):
+ return self._notified_time
+
+ @notified_time.setter
+ def notified_time(self, notified_time):
+ self._notified_time = notified_time
@abc.abstractmethod
def start(self):
diff --git a/doctor_tests/consumer/sample.py b/doctor_tests/consumer/sample.py
index eaf5fabd..c7dcf4f9 100644
--- a/doctor_tests/consumer/sample.py
+++ b/doctor_tests/consumer/sample.py
@@ -54,7 +54,9 @@ class ConsumerApp(Thread):
@app.route('/failure', methods=['POST'])
def event_posted():
- self.log.info('doctor consumer notified at %s' % time.time())
+ notified_time = time.time()
+ self.log.info('doctor consumer notified at %s' % notified_time)
+ self.consumer.notified_time = notified_time
data = json.loads(request.data.decode('utf8'))
self.log.info('sample consumer received data = %s' % data)
return 'OK'