27 lines
1.1 KiB
Python
27 lines
1.1 KiB
Python
"""Wait only for explicitly configured disposable integration services."""
|
|
import os
|
|
import time
|
|
|
|
import boto3
|
|
from botocore.config import Config
|
|
import psycopg
|
|
|
|
|
|
for attempt in range(90):
|
|
try:
|
|
with psycopg.connect(host=os.environ['TEST_PGHOST'], port=os.environ['TEST_PGPORT'],
|
|
user=os.environ['TEST_PGUSER'], password=os.environ['TEST_PGPASSWORD'],
|
|
dbname='postgres', connect_timeout=2):
|
|
pass
|
|
boto3.client('s3', endpoint_url=os.environ['TEST_S3_ENDPOINT_URL'],
|
|
aws_access_key_id=os.environ['TEST_S3_ACCESS_KEY'],
|
|
aws_secret_access_key=os.environ['TEST_S3_SECRET_KEY'], region_name='us-east-1',
|
|
config=Config(connect_timeout=2, read_timeout=2, retries={'max_attempts': 0},
|
|
s3={'addressing_style': 'path'})).list_buckets()
|
|
break
|
|
except Exception as error:
|
|
last_error = type(error).__name__
|
|
time.sleep(2)
|
|
else:
|
|
raise SystemExit('Disposable PostgreSQL/RustFS did not become ready: ' + last_error)
|