SameerMesiah97 commented on code in PR #72472:
URL: https://github.com/apache/airflow/pull/72472#discussion_r3927716527
##########
providers/amazon/tests/unit/amazon/aws/sensors/test_opensearch_serverless.py:
##########
@@ -57,6 +57,30 @@ def test_base_aws_op_attributes(self):
assert op.hook._config is not None
assert op.hook._config.read_timeout == 42
+ def test_deferrable_sensor_forwards_aws_configuration(self):
+ sensor = OpenSearchServerlessCollectionActiveSensor(
+ **self.default_op_kwargs,
+ deferrable=True,
+ aws_conn_id="test_conn",
+ region_name="eu-west-1",
+ verify=False,
+ botocore_config={"read_timeout": 42},
+ )
+
+ with pytest.raises(TaskDeferred) as deferred:
+ sensor.execute(None)
+
+ assert deferred.value.trigger.serialize()[1] == {
+ "collection_id": "knowledge_base_id",
+ "collection_name": None,
+ "waiter_delay": 5,
+ "waiter_max_attempts": 1,
+ "aws_conn_id": "test_conn",
+ "region_name": "eu-west-1",
+ "verify": False,
+ "botocore_config": {"read_timeout": 42},
+ }
Review Comment:
1) I don't see the need to assert every single argument given that the focus
is on the last 3.
2) The style could be more idiomatic.
I would suggest the below instead for lines 70-82 :
```
with pytest.raises(TaskDeferred) as exc:
sensor.execute(None)
trigger = exc.value.trigger
assert trigger.aws_conn_id == "test_conn"
assert trigger.region_name == "eu-west-1"
assert trigger.verify is False
assert trigger.botocore_config == {"read_timeout": 42}
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]