Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(zenko-702) Add MPU to CRR #185

Merged
merged 1 commit into from
Jul 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions tests/create_buckets.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
import time
import sys
import os
import logging

logging.basicConfig(level=logging.INFO)
_log = logging.getLogger('create_buckets')

def get_env(key, default=None, error=False):
if not error:
Expand All @@ -16,9 +19,9 @@ def bucket_safe_create(bucket):
try:
bucket.create()
except bucket.meta.client.exceptions.BucketAlreadyOwnedByYou:
print('Bucket %s already exists!' % bucket.name)
_log.info('Bucket %s already exists!' % bucket.name)
except Exception as exp: # pylint: disable=broad-except
print('Error creating bucket %s - %s' % (bucket.name, str(exp)))
_log.info('Error creating bucket %s - %s' % (bucket.name, str(exp)))
raise exp


Expand Down Expand Up @@ -48,7 +51,7 @@ def bucket_safe_create(bucket):
endpoint_url=ZENKO_ENDPOINT,
verify=VERIFY_CERTIFICATES)

print('Creating testing buckets...')
_log.info('Creating testing buckets...')
timeout = time.time() + TIMEOUT
backoff = 1
created = False
Expand All @@ -59,28 +62,34 @@ def bucket_safe_create(bucket):
created = True
break
except Exception:
print('Failed to create buckets, backing off and trying again')
_log.warn('Failed to create buckets, backing off and trying again')
time.sleep(backoff)
backoff = backoff ** 2

if not created:
print('Failed to create buckets and %i secs has elasped!' % TIMEOUT)
_log.critical('Failed to create buckets and %i secs has elasped!' % TIMEOUT)
sys.exit(1)
else:
print('Created buckets')
_log.info('Created buckets')
# Wait for all containers to become ready
config.load_incluster_config()

v1 = client.CoreV1Api()

delete_opt = client.V1DeleteOptions()
delete_opt.grace_period_seconds = 0

timeout = time.time() + TIMEOUT
while time.time() < timeout:
ret = v1.list_namespaced_pod(K8S_NAMESPACE)
passed = True
for i in ret.items:
for container in i.status.container_statuses:
if not container.ready:
print('%s is not ready' % container.name)
if container.state.waiting and \
container.state.waiting.reason == 'CrashLoopBackOff':
_log.info('%s is in CrashLoopBackOff, restarting.' % container.name)
v1.delete_namespaced_pod(i.metadata.name, K8S_NAMESPACE, delete_opt)
passed = False
break
if not passed:
Expand All @@ -91,5 +100,5 @@ def bucket_safe_create(bucket):
break

if not passed:
print('Containers have not become ready and TIMEOUT has elasped')
_log.info('Containers have not become ready and TIMEOUT has elasped')
sys.exit(1)
25 changes: 15 additions & 10 deletions tests/zenko_e2e/cloudserver/test_replication.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,45 @@
datefmt='%S')


@pytest.mark.parametrize('datafile', [testfile, mpufile])
@pytest.mark.conformance
def test_aws_1_1(aws_crr_bucket, aws_crr_target_bucket, testfile, objkey):
def test_aws_1_1(aws_crr_bucket, aws_crr_target_bucket, objkey, datafile):
util.mark_test('AWS 1-1 REPLICATION')
data = datafile()
aws_crr_bucket.put_object(
Body=testfile,
Body=data,
Key=objkey
)
print(aws_crr_bucket.name)
assert util.check_object(
objkey, testfile, aws_crr_bucket, aws_crr_target_bucket, timeout=30)
objkey, data, aws_crr_bucket, aws_crr_target_bucket, timeout=30)


@pytest.mark.parametrize('datafile', [testfile, mpufile])
@pytest.mark.conformance
def test_gcp_1_1(gcp_crr_bucket, gcp_crr_target_bucket, testfile, objkey):
def test_gcp_1_1(gcp_crr_bucket, gcp_crr_target_bucket, objkey, datafile):
util.mark_test('GCP 1-1 REPLICATION')
data = datafile()
gcp_crr_bucket.put_object(
Body=testfile,
Body=data,
Key=objkey
)
assert util.check_object(
objkey, testfile, gcp_crr_bucket, gcp_crr_target_bucket, timeout=30)
objkey, data, gcp_crr_bucket, gcp_crr_target_bucket, timeout=30)


@pytest.mark.parametrize('datafile', [testfile, mpufile])
@pytest.mark.conformance
def test_azure_1_1(
azure_crr_bucket, azure_crr_target_bucket, testfile, objkey):
azure_crr_bucket, azure_crr_target_bucket, objkey, datafile):
util.mark_test('AZURE 1-1 REPLICATION')
data = datafile()
azure_crr_bucket.put_object(
Body=testfile,
Body=data,
Key=objkey
)
assert util.check_object(
objkey,
testfile,
data,
azure_crr_bucket,
azure_crr_target_bucket,
timeout=30)
Expand Down