def test_node_run_tests(instance_name='ocgis-test-node', branch='next', failed='false'): am = AwsManager() instance = am.get_instance_by_name(instance_name) tcenv = 'test-ocgis' texclude = '!slow,!remote,!esmpy7' tgdal_data = '/home/ubuntu/anaconda/envs/{0}/share/gdal'.format(tcenv) tocgis_dir_shpcabinet = '/home/ubuntu/data/ocgis_test_data/shp' tocgis_dir_test_data = '/home/ubuntu/data/ocgis_test_data/' tsrc = '~/git/ocgis/src' def _run_(): senv = dict(OCGIS_DIR_SHPCABINET=tocgis_dir_shpcabinet, OCGIS_DIR_TEST_DATA=tocgis_dir_test_data, GDAL_DATA=tgdal_data) with shell_env(**senv): with prefix('source activate {0}'.format(tcenv)): with cd(tsrc): run('git checkout next') run('git pull') if failed == 'true': cmd = 'cp .noseids /tmp; git checkout {tbranch}; git pull; nosetests -vs --failed --with-id -a {texclude} ocgis/test' else: cmd = 'cp .noseids /tmp; rm .noseids; git checkout {tbranch}; git pull; nosetests -vs --with-id -a {texclude} ocgis/test' cmd = cmd.format(tbranch=branch, texclude=texclude) run(cmd) am.do_task(_run_, instance=instance)
def test_node_ebs_mount(instance_name='ocgis-test-node', ebs_mount_name='/dev/xvdg', ebs_mount_dir='~/data'): am = AwsManager() instance = am.get_instance_by_name(instance_name) kwargs = {'mount_name': ebs_mount_name, 'mount_dir': ebs_mount_dir} am.do_task(ebs_mount, instance=instance, kwargs=kwargs)
def test_run_bash_script(self): def _exists_(): with cd('~/a-new-directory'): self.assertTrue(True) _, script = mkstemp() try: with open(script, 'w') as f: f.write('mkdir ~/a-new-directory\n') m = AwsManager(CONF_PATH) assert self.shared_instance m.do_task(run_bash_script, name=self.shared_instance_name, args=(script,)) m.do_task(_exists_, name=self.shared_instance_name) finally: os.remove(script)