def tearDownClass(cls):
     if os.path.exists(TEARDOWN_LOCK_FILE_QUERY):
         print("Skip deleting instances as they were created manually (helps to iterate on tests)")
     else:
         helper = CloudSqlQueryTestHelper()
         gcp_authenticator = GcpAuthenticator(gcp_key=GCP_CLOUDSQL_KEY)
         gcp_authenticator.gcp_authenticate()
         helper.delete_instances(instance_suffix=QUERY_SUFFIX)
 def setUpClass(cls):
     SQL_QUERY_TEST_HELPER.set_ip_addresses_in_env()
     if os.path.exists(TEARDOWN_LOCK_FILE_QUERY):
         print("Skip creating and setting up instances as they were created manually "
               "(helps to iterate on tests)")
     else:
         helper = CloudSqlQueryTestHelper()
         gcp_authenticator = GcpAuthenticator(gcp_key=GCP_CLOUDSQL_KEY)
         gcp_authenticator.gcp_store_authentication()
         try:
             gcp_authenticator.gcp_authenticate()
             helper.create_instances(instance_suffix=QUERY_SUFFIX)
             helper.setup_instances(instance_suffix=QUERY_SUFFIX)
         finally:
             gcp_authenticator.gcp_restore_authentication()
示例#3
0
        ])


if __name__ == '__main__':
    parser = argparse.ArgumentParser(
        description='Create or delete Cloud SQL instances for system tests.')
    parser.add_argument('--action',
                        required=True,
                        choices=('create', 'delete', 'setup-instances',
                                 'create2', 'delete2', 'setup-instances2',
                                 'before-tests', 'after-tests',
                                 'delete-service-accounts-acls'))
    action = parser.parse_args().action

    helper = CloudSqlQueryTestHelper()
    gcp_authenticator = GcpAuthenticator(GCP_CLOUDSQL_KEY)
    helper.log.info('Starting action: {}'.format(action))

    gcp_authenticator.gcp_store_authentication()
    try:
        gcp_authenticator.gcp_authenticate()
        if action == 'before-tests':
            pass
        elif action == 'after-tests':
            pass
        elif action == 'create':
            helper.create_instances()
        elif action == 'delete':
            helper.delete_instances()
        elif action == 'create2':
            helper.create_instances(instance_suffix="2")

if __name__ == '__main__':
    parser = argparse.ArgumentParser(
        description=
        'Create or delete GCE instances/instance groups for system tests.')
    parser.add_argument(
        '--action',
        dest='action',
        required=True,
        choices=('create-instance', 'delete-instance', 'create-instance-group',
                 'delete-instance-group', 'before-tests', 'after-tests'))
    action = parser.parse_args().action

    helper = GCPComputeTestHelper()
    gcp_authenticator = GcpAuthenticator(GCP_COMPUTE_KEY)
    helper.log.info('Starting action: {}'.format(action))

    gcp_authenticator.gcp_store_authentication()
    try:
        gcp_authenticator.gcp_authenticate()
        if action == 'before-tests':
            pass
        elif action == 'after-tests':
            pass
        elif action == 'create-instance':
            helper.create_instance()
        elif action == 'delete-instance':
            helper.delete_instance()
        elif action == 'create-instance-group':
            helper.create_instance_group_and_template()

if __name__ == "__main__":
    parser = argparse.ArgumentParser(
        description="Create and delete bucket for system tests.")
    parser.add_argument(
        "--action",
        dest="action",
        required=True,
        choices=("create-bucket", "delete-bucket", "before-tests",
                 "after-tests"),
    )
    action = parser.parse_args().action

    helper = GCPCloudMemorystoreTestHelper()
    gcp_authenticator = GcpAuthenticator(GCP_GCS_TRANSFER_KEY)
    helper.log.info("Starting action: %s", action)

    gcp_authenticator.gcp_store_authentication()
    try:
        gcp_authenticator.gcp_authenticate()
        if action == "before-tests":
            pass
        elif action == "after-tests":
            pass
        elif action == "create-bucket":
            helper.create_bucket()
        elif action == "delete-bucket":
            helper.delete_bucket()
        else:
            raise Exception("Unknown action: {}".format(action))

if __name__ == "__main__":
    parser = argparse.ArgumentParser(
        description="Create and delete bucket for system tests.")
    parser.add_argument(
        "--action",
        dest="action",
        required=True,
        choices=("create-bucket", "delete-bucket", "before-tests",
                 "after-tests"),
    )
    action = parser.parse_args().action

    helper = GCPBigQueryTestHelper()
    gcp_authenticator = GcpAuthenticator(GCP_BIGQUERY_KEY)
    helper.log.info("Starting action: %s", action)

    gcp_authenticator.gcp_store_authentication()
    try:
        gcp_authenticator.gcp_authenticate()
        if action == "before-tests":
            pass
        elif action == "after-tests":
            pass
        elif action == "create-bucket":
            helper.create_repository_and_bucket()
        elif action == "delete-bucket":
            helper.delete_bucket()
        else:
            raise Exception("Unknown action: {}".format(action))
            '--verbosity=none', 'instances', 'delete', CBT_INSTANCE
        ])


if __name__ == '__main__':
    parser = argparse.ArgumentParser(
        description='Create or delete spanner instances for system tests.')
    parser.add_argument('--action',
                        dest='action',
                        required=True,
                        choices=('delete-instance', 'before-tests',
                                 'after-tests'))
    action = parser.parse_args().action

    helper = GCPBigtableTestHelper()
    gcp_authenticator = GcpAuthenticator(GCP_SPANNER_KEY)
    helper.log.info('Starting action: {}'.format(action))

    gcp_authenticator.gcp_store_authentication()
    try:
        gcp_authenticator.gcp_authenticate()
        if action == 'before-tests':
            pass
        elif action == 'after-tests':
            pass
        elif action == 'delete-instance':
            helper.delete_instance()
        else:
            raise Exception("Unknown action: {}".format(action))
    finally:
        gcp_authenticator.gcp_restore_authentication()