Try to get some system information out of Travis-CI.

This commit is contained in:
Pedro Algarvio 2012-11-06 18:11:26 +00:00
parent af7ebf12f8
commit c5c637154a
3 changed files with 39 additions and 6 deletions

View file

@ -10,7 +10,7 @@ before_install:
- "if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install unittest2; fi"
install: pip install -r requirements.txt --use-mirrors
script: sudo -E python setup.py test --runtests-opts='--run-destructive -v'
script: sudo -E python setup.py test --runtests-opts='--run-destructive --sysinfo -v'
notifications:
irc:

View file

@ -118,8 +118,9 @@ class TestDaemon(object):
Set up the master and minion daemons, and run related cases
'''
def __init__(self, clean):
self.clean = clean
def __init__(self, opts=None):
self.opts = opts
self.clean = opts.clean
self.__evt_minions_connect = multiprocessing.Event()
self.__evt_minions_sync = multiprocessing.Event()
self.__minion_targets = set(['minion', 'sub_minion'])
@ -221,6 +222,21 @@ class TestDaemon(object):
self.syndic_process = multiprocessing.Process(target=syndic.tune_in)
self.syndic_process.start()
#if os.environ.get('DUMP_SALT_CONFIG', None) is not None:
# try:
# import yaml
# os.makedirs('/tmp/salttest/conf')
# except OSError:
# pass
# self.master_opts['user'] = pwd.getpwuid(os.getuid()).pw_name
# self.minion_opts['user'] = pwd.getpwuid(os.getuid()).pw_name
# open('/tmp/salttest/conf/master', 'w').write(
# yaml.dump(self.master_opts)
# )
# open('/tmp/salttest/conf/minion', 'w').write(
# yaml.dump(self.minion_opts)
# )
# Let's create a local client to ping and sync minions
self.client = salt.client.LocalClient(
os.path.join(INTEGRATION_TEST_DIR, 'files', 'conf', 'master')
@ -248,6 +264,20 @@ class TestDaemon(object):
'testing `runtests_helper` module WILL fail')
sync_minions.terminate()
if self.opts.sysinfo:
from salt import version
print_header('~~~~~~~ Versions Report ', inline=True)
print('\n'.join(version.versions_report()))
print_header(
'~~~~~~~ Minion Grains Information ', inline=True,
)
grains = self.client.cmd('minion', 'grains.items')
import pprint
pprint.pprint(grains['minion'])
print_header('', sep='=', inline=True)
return self
def __exit__(self, type, value, traceback):
@ -341,7 +371,6 @@ class TestDaemon(object):
print(' * {0} already synced??? {1}'.format(
name, output
))
print_header('', sep='=', inline=True)
evt.set()

View file

@ -101,7 +101,7 @@ def run_integration_tests(opts):
if not any([opts.client, opts.module, opts.runner,
opts.shell, opts.state, opts.name]):
return status
with TestDaemon(clean=opts.clean):
with TestDaemon(opts=opts):
if opts.name:
for name in opts.name:
results = run_suite(opts, '', name)
@ -218,12 +218,16 @@ def parse_opts():
action='store_true',
help='Do NOT show the overall tests result'
)
parser.add_option('--coverage',
default=False,
action='store_true',
help='Run tests and report code coverage'
)
parser.add_option('--sysinfo',
default=False,
action='store_true',
help='Print some system information.'
)
options, _ = parser.parse_args()