Add initial jenkins python script for jenkins tests

This commit is contained in:
Thomas S Hatch 2013-08-10 01:14:57 -06:00
parent 82e6ccf9cd
commit d50d438545

31
tests/jenkins.py Normal file
View file

@ -0,0 +1,31 @@
#!/usr/bin/env python
'''
This script is used to test salt from a jenkins server, specifically
jenkins.satstack.com.
This script is intended to be shell centric!!
'''
import subprocess
import hashlib
import random
import optparse
def run(platform, provider):
'''
RUN!
'''
htag = hashlib.md5(str(random.randint(1, 100000000))).hexdigest()[:6]
vm_name = '{0}{1}'.format(platform, htag)
subprocess.call(
'salt-cloud -p {0}_{1} {2}'.format(provider, platform, vm_name),
shell=True)
# Run tests here
subprocess.call(
'salt {0} state.sls testrun'.format(vm_name),
shell=True)
# Clean up the vm
subprocess.call(
'salt-cloud -d {0} -y'.format(vm_name),
shell=True)