def test_get_all_runnable_tests(test_resource_dir):
    # Test: Pass file with no tests; Expect return 0
    no_tests = JasmineManifest([], [], [])
    assert len(no_tests.get_all_runnable_tests()) == 0

    # Test: Pass file path to recourses directory; Expected return more than 0
    more_tests = JasmineManifest([test_resource_dir + '*.ts'], [], [])
    assert len(more_tests.get_all_runnable_tests()) > 0
Exemplo n.º 2
0
def put_manifest_sdb(creds, sdb_domain, config_dict):
    sdb_client = boto3.client(
        'sdb',
        region_name='us-east-1',
        aws_access_key_id=creds['Credentials']['AccessKeyId'],
        aws_secret_access_key=creds['Credentials']['SecretAccessKey'],
        aws_session_token=creds['Credentials']['SessionToken'],
    )
    local_source_root = config_dict['localSourceRoot']
    lambda_source_root = config_dict['lambdaSourceRoot']

    manifest = JasmineManifest(config_dict['testGlobs'],
                               config_dict['includeTags'],
                               config_dict['excludeTags'])

    every_test = manifest.get_all_runnable_tests()
    tests = every_test

    test_index = 1
    job_id = config_dict['executionName']

    for test in tests:
        db_key = str(test_index) + '/' + job_id
        test_path = test.test_path.replace(local_source_root,
                                           lambda_source_root)
        put_manifest_task_simple_db(sdb_client, sdb_domain, db_key, job_id,
                                    str(test_index).zfill(8), test_path,
                                    test.test_name, test.test_class_name)
        if config_dict["maxTestsToRun"] == "1":
            print("RUNNING JOB IN SMOKE MODE! ONLY SCHEDULING ONE TASK IN DB")
            break
        test_index = test_index + 1