mik-laj commented on a change in pull request #14033:
URL: https://github.com/apache/airflow/pull/14033#discussion_r574242560



##########
File path: airflow/providers/google/cloud/example_dags/example_gcs.py
##########
@@ -151,6 +156,41 @@
     copy_file >> delete_bucket_2
     delete_files >> delete_bucket_1
 
+with models.DAG(
+    "example_gcs_sensors",
+    start_date=days_ago(1),
+    schedule_interval=None,
+    tags=['example'],
+) as dag2:
+    create_bucket = GCSCreateBucketOperator(
+        task_id="create_bucket", bucket_name=BUCKET_1, project_id=PROJECT_ID
+    )
+    upload_file = LocalFilesystemToGCSOperator(
+        task_id="upload_file",
+        src=PATH_TO_UPLOAD_FILE,
+        dst=BUCKET_FILE_LOCATION,
+        bucket=BUCKET_1,
+    )
+    # [START howto_sensor_object_exists_task]
+    gcs_object_exists = GCSObjectExistenceSensor(
+        bucket=BUCKET_1,
+        object=PATH_TO_UPLOAD_FILE,
+        mode='poke',
+        task_id="gcs_object_exists_task",
+    )
+    # [END howto_sensor_object_exists_task]
+    # [START howto_sensor_object_with_prefix_exists_task]
+    gcs_object_with_prefix_exists = GCSObjectsWtihPrefixExistenceSensor(
+        bucket=BUCKET_1,
+        prefix=PATH_TO_UPLOAD_FILE_PREFIX,
+        mode='poke',
+        task_id="gcs_object_with_prefix_exists_task",
+    )
+    # [END howto_sensor_object_with_prefix_exists_task]
+    delete_bucket = GCSDeleteBucketOperator(task_id="delete_bucket", 
bucket_name=BUCKET_1)
+
+    create_bucket >> upload_file >> [gcs_object_exists, 
gcs_object_with_prefix_exists] >> delete_bucket

Review comment:
       It is enough to test the green path as it will allow us to detect 99% of 
the problems.  For other cases, we have unit tests. These tests are mainly 
aimed at checking whether the operator works at a high level, e.g. API has not 
been deleted, or the parameters have not changed and this test checks it




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


Reply via email to