Пример #1
0
testcase.parser.add_argument('--platform', dest='platform', help='"Linux" or "Windows", default: "linux"' , default=None)
testcase.parser.add_argument('--uploaded_manifest', dest='upload_manifest', help='bucket/prefix location of manifest to register' , default=None)
testcase.parser.add_argument('--bundle_manifest', dest='bundle_manifest', help='file path on worker to bundle manifest to upload' , default=None)
testcase.parser.add_argument('--overwrite', help='Will overwrite files in matching work dir on worker machine if found', action='store_true', default=False)

testcase.parser.add_argument('--time_per_gig', help='Time allowed per image size in GB before timing out. Default:300 seconds', default=300)

testcase.get_args()

retries = 12
retry_delay = 10
req = Request(testcase.args.url)
for x in range(retries + 1):
    try:
        response = urlopen(req)
        testcase.debug('URL: ' + str(testcase.args.url) + ' is valid and reachable!')
    except URLError, e:
        if x < retries:
            if hasattr(e, 'reason'):
                testcase.debug("Retrying to resolve " + str(testcase.args.url) + " and got: " + str(e.reason))
            elif hasattr(e, 'code'):
                testcase.debug("Retrying to resolve " + str(testcase.args.url) + " and got: " + str(e.code))
            time.sleep(retry_delay)
            continue
        else:
            if hasattr(e, 'reason'):
                raise AssertionError("INVALID URL: " + str(testcase.args.url) + "  " + str(e.reason))
            elif hasattr(e, 'code'):
                raise AssertionError("INVALID REQUEST: " + str(testcase.args.url) + "  " + str(e.code))
    break
Пример #2
0
testcase.args.worker_password = testcase.args.worker_password or testcase.args.password
testcase.args.worker_keypath = testcase.args.worker_keypath or testcase.args.keypair

if (not testcase.args.url and not testcase.args.filepath) or (testcase.args.url and testcase.args.filepath):
    raise Exception('Must specify either a URL or FILE path to create Windows EMI from')

#Set kernel to 'windows'. This result in the platform type resulting in 'windows' after registration.
if str(testcase.args.image_type).lower() == "windows":
    testcase.args.kernel = "windows"

def make_image_public():
    emi = image_utils.tester.test_resources['images'][0]
    emi.set_launch_permissions(group_names=['all'])
    testcase.debug('\n---------------------------\nCreated EMI:' + str(emi) +'\n---------------------------')

#Create an ImageUtils helper from the arguments provided in this testcase...
image_utils = testcase.do_with_args(ImageUtils)

#Create a single testcase to wrap and run the EMI creation task. Note by default all the overlapping args from
# this testcase are fed to the testunit method when ran.
test1 = testcase.create_testunit_from_method(image_utils.create_emi)
test2 = testcase.create_testunit_from_method(make_image_public)
result = testcase.run_test_case_list([test1, test2], eof=True, clean_on_exit=False, printresults=True)

#By default created resources are stored in the eucaops/tester object's test_resources dict. See if our image is
#prsent. If so print it out...
if image_utils.tester.test_resources['images']:
    emi = image_utils.tester.test_resources['images'].pop()
    testcase.debug('\n---------------------------\nCreated EMI:' + str(emi) +'\n---------------------------')

exit(result)
Пример #3
0
testcase.parser.add_argument(
    '--time_per_gig',
    help=
    'Time allowed per image size in GB before timing out. Default:300 seconds',
    default=300)

testcase.get_args()

retries = 12
retry_delay = 10
req = Request(testcase.args.url)
for x in range(retries + 1):
    try:
        response = urlopen(req)
        testcase.debug('URL: ' + str(testcase.args.url) +
                       ' is valid and reachable!')
    except URLError, e:
        if x < retries:
            if hasattr(e, 'reason'):
                testcase.debug("Retrying to resolve " +
                               str(testcase.args.url) + " and got: " +
                               str(e.reason))
            elif hasattr(e, 'code'):
                testcase.debug("Retrying to resolve " +
                               str(testcase.args.url) + " and got: " +
                               str(e.code))
            time.sleep(retry_delay)
            continue
        else:
            if hasattr(e, 'reason'):
                raise AssertionError("INVALID URL: " + str(testcase.args.url) +