nuclearpinguin commented on a change in pull request #6299: [AIRFLOW-5631]
Change way of running GCP system tests
URL: https://github.com/apache/airflow/pull/6299#discussion_r336893648
##########
File path: tests/gcp/operators/test_cloud_sql_system.py
##########
@@ -17,42 +17,34 @@
# specific language governing permissions and limitations
# under the License.
import os
-import unittest
from airflow import AirflowException
from tests.gcp.operators.test_cloud_sql_system_helper import
CloudSqlQueryTestHelper
-from tests.gcp.utils.base_gcp_system_test_case import SKIP_TEST_WARNING,
TestDagGcpSystem
from tests.gcp.utils.gcp_authenticator import GCP_CLOUDSQL_KEY
+from tests.test_utils.gcp_system_helpers import GCP_DAG_FOLDER,
provide_gcp_context, skip_gcp_system
+from tests.test_utils.system_tests_class import SystemTest
GCP_PROJECT_ID = os.environ.get('GCP_PROJECT_ID', 'project-id')
SQL_QUERY_TEST_HELPER = CloudSqlQueryTestHelper()
[email protected](TestDagGcpSystem.skip_check(GCP_CLOUDSQL_KEY),
SKIP_TEST_WARNING)
-class CloudSqlExampleDagsIntegrationTest(TestDagGcpSystem):
- def __init__(self, method_name='runTest'):
- super().__init__(
- method_name,
- dag_id='example_gcp_sql',
- gcp_key=GCP_CLOUDSQL_KEY)
-
+@skip_gcp_system(GCP_CLOUDSQL_KEY, require_local_executor=True)
+class CloudSqlExampleDagsIntegrationTest(SystemTest):
+ @provide_gcp_context(GCP_CLOUDSQL_KEY)
def tearDown(self):
# Delete instances just in case the test failed and did not cleanup
after itself
- self.gcp_authenticator.gcp_authenticate()
- try:
-
SQL_QUERY_TEST_HELPER.delete_instances(instance_suffix="-failover-replica")
-
SQL_QUERY_TEST_HELPER.delete_instances(instance_suffix="-read-replica")
- SQL_QUERY_TEST_HELPER.delete_instances()
- SQL_QUERY_TEST_HELPER.delete_instances(instance_suffix="2")
- SQL_QUERY_TEST_HELPER.delete_service_account_acls()
- finally:
- self.gcp_authenticator.gcp_revoke_authentication()
+
SQL_QUERY_TEST_HELPER.delete_instances(instance_suffix="-failover-replica")
Review comment:
I think the helpers need some more discussion. Many of them performs same
thing like create a bucket or delete a bucket, so maybe it's worth to rethink
our overall approach. If we are going to migrate to pytest then helpers should
be replaced by fixtures.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services