mnojek commented on a change in pull request #18494:
URL: https://github.com/apache/airflow/pull/18494#discussion_r716376092



##########
File path: airflow/providers/google/cloud/example_dags/example_cloud_sql.py
##########
@@ -48,8 +49,8 @@
 from airflow.utils.dates import days_ago
 
 GCP_PROJECT_ID = os.environ.get('GCP_PROJECT_ID', 'example-project')
-INSTANCE_NAME = os.environ.get('GCSQL_MYSQL_INSTANCE_NAME', 'test-mysql')
-INSTANCE_NAME2 = os.environ.get('GCSQL_MYSQL_INSTANCE_NAME2', 'test-mysql2')
+INSTANCE_NAME = os.environ.get('GCSQL_MYSQL_INSTANCE_NAME', 'test-mysql') + 
str(random.getrandbits(16))

Review comment:
       I added this because the instance name is unique only for the specific 
Airflow container so each time I run the test within 1 Airflow run, it's the 
same. The problem was that if this system test failed before deleting the 
instance, it couldn't be run again because it wanted to create instance with 
the same instance while it was still present. That's why I added it. So it 
works only when it passes within the first execution.
   That is a simple workaround to make each test execution independent but 
overall it's not the desired solution. Can you point me where else this value 
is used?
   
   Ideally, I would want to have independent tests and also a mechanism that 
will cleanup all the values created by the test if it fails in the middle. This 
is not the scope of this PR, but in near future I plan to work on that.




-- 
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.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to