def setUp(self): super(ReplicationTest, self).setUp() self.auth_service = local_app.LocalApplication(APP_DIR, 9500) self.replica = local_app.LocalApplication(REPLICA_APP_DIR, 9600) # Launch both first, only then wait for them to come online. apps = [self.auth_service, self.replica] for app in apps: app.start() for app in apps: app.ensure_serving() app.client.login_as_admin('*****@*****.**')
def setUp(self): super(CloudEndpointsSmokeTest, self).setUp() self.root = tempfile.mkdtemp(prefix='endpoints_smoke_test') self.app = local_app.LocalApplication(TEST_APP_DIR, 9700, False, self.root) self.app.start() self.app.ensure_serving()
def finish_setup(self): """Uploads bot_config.py and starts a bot. Should be called from test_* method (not from setUp), since if setUp fails tearDown is not getting called (and finish_setup can fail because it uses various server endpoints). """ self._server = local_app.LocalApplication(APP_DIR, 9050) self._server.start() self._server.ensure_serving() self._raw_client = self._server.client self._bot = LocalBot(self._server.url, self._log_dir) self._bot.start() # Replace bot_config.py. self._raw_client.login_as_admin('*****@*****.**') self._raw_client.url_opener.addheaders.append( ('X-XSRF-Token', self._server.client.xsrf_token)) with open(os.path.join(BOT_DIR, 'bot_config.py'), 'rb') as f: bot_config_content = f.read() + '\n' # This will restart the bot. res = self._raw_client.request('/restricted/upload/bot_config', body=urllib.urlencode( {'script': bot_config_content})) self.assertTrue(res)
def start(self): """Starts both the Swarming and Isolate servers.""" self._swarming_server = local_app.LocalApplication( APP_DIR, 9050, self._listen_all) self._swarming_server.start() # We wait for the Swarming server to be started up so the isolate server # ports do not clash. self._isolate_server = local_app.LocalApplication( os.path.join(APP_DIR, '..', 'isolate'), 10050, self._listen_all) self._isolate_server.start() self._swarming_server.ensure_serving() self._isolate_server.ensure_serving() self.http_client.login_as_admin('*****@*****.**') self.http_client.url_opener.addheaders.append( ('X-XSRF-Token', self._swarming_server.client.xsrf_token))
def setUp(self): super(CloudEndpointsSmokeTest, self).setUp() self.app = local_app.LocalApplication(TEST_APP_DIR, 9700) self.app.start() self.app.ensure_serving()