From 945691ff620fa75db983a138b9fce3f3e8b29c42 Mon Sep 17 00:00:00 2001 From: "Alexey Lavrenuke (load testing)" Date: Fri, 16 Aug 2013 18:32:04 +0400 Subject: [PATCH] guns and gun types --- Tank/Plugins/BFG.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Tank/Plugins/BFG.py b/Tank/Plugins/BFG.py index 586e989..31ecf87 100644 --- a/Tank/Plugins/BFG.py +++ b/Tank/Plugins/BFG.py @@ -99,7 +99,14 @@ class BFG(object): self.log = logging.getLogger(__name__) self.log.info( "BFG using gun '%s', stpd from %s", gun_type, stpd_filename) - self.gun_type = gun_type + guns = { + 'log': LogGun, + } + if gun_type in guns: + self.gun = guns[gun_type]() + else: + raise NotImplementedError( + 'No such gun type implemented: "%s"' % gun_type) self.stpd_filename = stpd_filename self.instances = int(instances) self.running = False @@ -121,9 +128,15 @@ class BFG(object): return timer_task def _shoot(self, missile, marker): - self.log.info("Executing on timer, %s", time.time()) - self.log.info("Missile: %s\n%s", marker, missile) + self.gun.shoot(missile, marker) def stop(self): self.running = False self.retcode = 0 + +class LogGun(object): + def __init__(self): + self.log = logging.getLogger(__name__) + + def shoot(self, missile, marker): + self.log.info("Missile: %s\n%s", marker, missile) \ No newline at end of file