import os
import time
import shutil
+import logging
import tempfile
import subprocess
+log = logging.getLogger(__name__)
class Timeout(RuntimeError):
pass
+class FailedToLaunch(RuntimeError):
+ pass
class JenkinsLauncher(object):
'''
Launches jenkins and waits while it's ready.
'''
+ log.info("Atempting to launch Jenkins...")
self.jenkins_home = tempfile.mkdtemp(prefix='jenkins-home-')
os.environ['JENKINS_HOME'] = self.jenkins_home
jenkins_command = 'java -jar jenkins.war'
start_time = time.time()
while time.time() - start_time < self.timeout:
line = self.jenkins_process.stderr.readline().strip()
+ log.info('Jenkins: %s' % line)
+
+ if 'Winstone shutdown successfully' in line:
+ raise FailedToLaunch()
+
if line == 'INFO: Jenkins is fully up and running':
return
raise Timeout('Timeout error occured while waiting for Jenkins start.')
def tearDownPackage():
- launcher.stop()
\ No newline at end of file
+ launcher.stop()
artifacts = b.get_artifact_dict()
self.assertIsInstance(artifacts, dict)
- import ipdb
- ipdb.set_trace()
-
artB = artifacts['b.txt']
self.assertTrue(artB.get_data().strip(), param_B)