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()
]) 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 bucket for system tests.") parser.add_argument( "--action", dest="action", required=True, choices=("create-buckets", "delete-buckets", "before-tests", "after-tests"), ) action = parser.parse_args().action helper = GcsToSFTPTestHelper() gcp_authenticator = GcpAuthenticator(GCP_GCS_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-buckets": helper.create_buckets() elif action == "delete-buckets": helper.delete_buckets() else: raise Exception("Unknown action: {}".format(action))
dest="action", required=True, choices=( "create-repo-and-bucket", "delete-repo", "delete-bucket", "delete-docker-images", "delete-repo-and-bucket-and-docker-images", "before-tests", "after-tests", ), ) action = parser.parse_args().action helper = GCPCloudBuildTestHelper() gcp_authenticator = GcpAuthenticator(GCP_CLOUD_BUILD_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-repo-and-bucket": helper.create_repository_and_bucket() elif action == "delete-repo-and-bucket-and-docker-images": helper.delete_repo() helper.delete_bucket() helper.delete_docker_images()
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))
if __name__ == '__main__': parser = argparse.ArgumentParser( description='Create and remove a 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 = GCPVisionTestHelper() gcp_authenticator = GcpAuthenticator(GCP_AI_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-bucket': helper.create_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()
from tests.providers.google.cloud.operators.test_cloud_sql_system_helper import CloudSqlQueryTestHelper from tests.providers.google.cloud.utils.gcp_authenticator import GCP_CLOUDSQL_KEY, GcpAuthenticator QUERY_SUFFIX = "_QUERY" 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', 'before-tests', 'after-tests')) action = parser.parse_args().action helper = CloudSqlQueryTestHelper() gcp_authenticator = GcpAuthenticator(gcp_key=GCP_CLOUDSQL_KEY) helper.log.info('Starting action: {}'.format(action)) gcp_authenticator.gcp_store_authentication() try: gcp_authenticator.gcp_authenticate() if action == 'before-tests': helper.create_instances(instance_suffix=QUERY_SUFFIX) helper.setup_instances(instance_suffix=QUERY_SUFFIX) elif action == 'after-tests': helper.delete_instances(instance_suffix=QUERY_SUFFIX) elif action == 'create': helper.create_instances(instance_suffix=QUERY_SUFFIX) elif action == 'delete': helper.delete_instances(instance_suffix=QUERY_SUFFIX) elif action == 'setup-instances': helper.setup_instances(instance_suffix=QUERY_SUFFIX)