INNER CODE UNIT · Python
wait_for_chartmuseum
helm/chartmuseum · acceptance_tests/lib/ChartMuseum.py:49
def wait_for_chartmuseum(self):
seconds_waited = 0
while True:
with contextlib.closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock:
result = sock.connect_ex(('localhost', common.PORT))
if result == 0:
break
if seconds_waited == common.MAX_WAIT_SECONDS:
raise Exception('Reached max time (%d seconds) waiting for chartmuseum to come up' % common.MAX_WAIT_SECONDS)
time.sleep(1)
seconds_waited += 1
def stop_chartmuseum(self):
self.run_command('pkill -9 chartmuseum')
shutil.rmtree(common.STORAGE_DIR, ignore_errors=True)
def remove_chartmuseum_logs(self):
os.chdir(self.rootdir)