def run_operations(installer_name, app_name): deploy_dir = tc.get_randomized_deploy_dir('test_install_') master_password_file = join(deploy_dir, 'master_password') operations = INSTALLERS[installer_name][app_name].keys() for operation in OPERATIONS: # retain correct order if operation not in operations: continue config_map = tc.get_config(INSTALLERS[installer_name][app_name][operation]) config_map['Installer'] = installer_name config_map['Install directory'] = deploy_dir if operation == 'install': assert tc.port_is_available(tc.get_netloc(config_map)) tc.bootstrap(deploy_dir) tc.write_master_password(master_password_file) config_dir = tc.ensure_subdir(deploy_dir, 'config') config_path = tc.write_config_file(config_dir, config_map) if 'password_map' in config_map: create_password_db(deploy_dir, tc.DEFAULT_MASTER_PASSWORD, config_map['password_map']) exit_code = tc.install(deploy_dir, config_path, master_password_file) elif operation == 'upgrade': exit_code = tc.upgrade(deploy_dir, tc.ENGAGE_DIR, config_map[APPLICATION_ARCHIVE_PROP], master_password_file) assert config_map['expected_exit_code'] == exit_code time.sleep(1) # allow for delayed start assert app_is_available(config_map) if operation == 'upgrade' or len(operations) == 1: # only shutdown on install if it's the only operation tc.stop(tc.get_init_script(config_map), master_password_file) assert tc.port_is_available(tc.get_netloc(config_map)) tc.logger.info('removing %s' % (deploy_dir)) shutil.rmtree(deploy_dir)
def setup(self): tc.bootstrap(self.dh)