mirror of
https://github.com/valitydev/yandex-tank.git
synced 2024-11-06 10:25:17 +00:00
LUNAPARK-1466 - fail-lock parameter
This commit is contained in:
parent
f9d0417032
commit
3576bb8d7f
@ -398,7 +398,6 @@ class MonitoringCollector:
|
||||
|
||||
if command == 'uninstall':
|
||||
for agent in agents:
|
||||
logging.debug('Uninstall monitoring agent. Host: %s' % agent.host)
|
||||
agent.uninstall()
|
||||
logging.debug("Remove: %s" % agent.path['TEMP_CONFIG'])
|
||||
if os.path.isfile(agent.path['TEMP_CONFIG']):
|
||||
|
@ -183,6 +183,8 @@ class ConsoleTank:
|
||||
def configure(self):
|
||||
if not self.options.ignore_lock:
|
||||
while self.there_is_locks():
|
||||
if self.options.lock_fail:
|
||||
raise RuntimeError("Lock file present, cannot continue")
|
||||
self.log.info("Waiting for 5s for retry...")
|
||||
time.sleep(5)
|
||||
else:
|
||||
|
10
Tank/Core.py
10
Tank/Core.py
@ -37,6 +37,8 @@ class TankCore:
|
||||
|
||||
self.artifacts_base_dir = self.get_option(self.SECTION, "artifacts_base_dir", tempfile.gettempdir())
|
||||
self.artifacts_dir = self.get_option(self.SECTION, "artifacts_dir", "")
|
||||
if self.artifacts_dir:
|
||||
self.artifacts_dir=os.path.expanduser(self.artifacts_dir)
|
||||
|
||||
for (plugin_name, plugin_path) in self.config.get_options(self.SECTION, self.PLUGIN_PREFIX):
|
||||
if not plugin_path:
|
||||
@ -196,11 +198,17 @@ class TankCore:
|
||||
self.log.warning("No artifacts dir configured")
|
||||
return
|
||||
|
||||
self.log.debug("Collecting file: %s to %s", filename, self.artifacts_dir + '/' + os.path.basename(filename))
|
||||
dest=self.artifacts_dir + '/' + os.path.basename(filename)
|
||||
self.log.debug("Collecting file: %s to %s", filename, dest)
|
||||
if not filename or not os.path.exists(filename):
|
||||
self.log.warning("File not found to collect: %s", filename)
|
||||
return
|
||||
|
||||
if os.path.exists(dest):
|
||||
# FIXME: find a way to store artifacts anyway
|
||||
self.log.warning("File already exists: %s", dest)
|
||||
return
|
||||
|
||||
if keep_original:
|
||||
shutil.copy(filename, self.artifacts_dir)
|
||||
else:
|
||||
|
@ -19,3 +19,4 @@ class FakeOptions(object):
|
||||
config = []
|
||||
option = ['testsection.testoption=testvalue']
|
||||
ignore_lock = True
|
||||
lock_fail=False
|
3
tank.py
3
tank.py
@ -11,7 +11,8 @@ if __name__ == "__main__":
|
||||
parser = OptionParser()
|
||||
parser.add_option('-c', '--config', action='append', help="Path to INI file containing run options, multiple options accepted")
|
||||
# TODO: --non-interactive
|
||||
parser.add_option('-i', '--ignore-lock', action='store_true', dest='ignore_lock', help="Ignore lock files from concurrent instances")
|
||||
parser.add_option('-i', '--ignore-lock', action='store_true', dest='ignore_lock', help="Ignore lock files from concurrent instances, has precedence before --lock-fail")
|
||||
parser.add_option('-f', '--fail-lock', action='store_true', dest='lock_fail', help="Don't wait for lock to release, fail test instead")
|
||||
parser.add_option('-l', '--log', action='store', default="tank.log", help="Tank log file location")
|
||||
parser.add_option('-o', '--option', action='append', help="Set config option, multiple options accepted, example: -o 'shellexec.start=pwd'")
|
||||
parser.add_option('-q', '--quiet', action='store_true', help="Less console output, only errors and warnings")
|
||||
|
Loading…
Reference in New Issue
Block a user