You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "bkossakowska (via GitHub)" <gi...@apache.org> on 2023/08/16 13:11:06 UTC
[GitHub] [airflow] bkossakowska opened a new pull request, #33440: Fix for the test in the Dataplex DQ.
bkossakowska opened a new pull request, #33440:
URL: https://github.com/apache/airflow/pull/33440
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
This PR is a hotfix for `Add Dataplex Data Quality operators.` https://github.com/apache/airflow/pull/32256
There was a problem in the tests for the DataplexDataQualityJobStatusSensor in the internal CI.
<!--
Thank you for contributing! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
Feel free to ping committers for the review!
In case of an existing issue, reference it using one of the following:
closes: #ISSUE
related: #ISSUE
How to write a good git commit message:
http://chris.beams.io/posts/git-commit/
-->
<!-- Please keep an empty line above the dashes. -->
---
**^ Add meaningful description above**
Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
In case of backwards incompatible changes please leave a note in a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [newsfragments](https://github.com/apache/airflow/tree/main/newsfragments).
--
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-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] moiseenkov commented on a diff in pull request #33440: Fix for the test in the Dataplex DQ.
Posted by "moiseenkov (via GitHub)" <gi...@apache.org>.
moiseenkov commented on code in PR #33440:
URL: https://github.com/apache/airflow/pull/33440#discussion_r1298079515
##########
tests/providers/google/cloud/sensors/test_dataplex.py:
##########
@@ -144,3 +145,47 @@ def test_done(self, mock_hook):
)
assert result
+
+ def test_start_sensor_time(self):
+ sensor = DataplexDataQualityJobStatusSensor(
+ task_id=TASK_ID,
+ project_id=PROJECT_ID,
+ job_id=TEST_JOB_ID,
+ data_scan_id=TEST_DATA_SCAN_ID,
+ region=REGION,
+ api_version=API_VERSION,
+ gcp_conn_id=GCP_CONN_ID,
+ impersonation_chain=IMPERSONATION_CHAIN,
+ timeout=TIMEOUT,
+ )
+
+ assert sensor.start_sensor_time is None
+
+ duration_1 = sensor._duration()
+ duration_2 = sensor._duration()
+
+ assert bool(sensor.start_sensor_time)
+ assert duration_1 > 0
+ assert duration_2 > 0
Review Comment:
I updated the condition just to cover more cases:
```python
assert 0 < duration_1 < duration_2
```
--
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-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] moiseenkov commented on pull request #33440: Fix for the test in the Dataplex DQ.
Posted by "moiseenkov (via GitHub)" <gi...@apache.org>.
moiseenkov commented on PR #33440:
URL: https://github.com/apache/airflow/pull/33440#issuecomment-1682264175
Thanks for the suggestion. Added two unit tests.
@potiuk , @hussein-awala , @o-nikolas , please take a look
--
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-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] potiuk commented on pull request #33440: Fix for the test in the Dataplex DQ.
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #33440:
URL: https://github.com/apache/airflow/pull/33440#issuecomment-1680624340
Any chance for a test that would detect it /avoid future regressions?
--
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-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] moiseenkov commented on a diff in pull request #33440: Fix for the test in the Dataplex DQ.
Posted by "moiseenkov (via GitHub)" <gi...@apache.org>.
moiseenkov commented on code in PR #33440:
URL: https://github.com/apache/airflow/pull/33440#discussion_r1298077309
##########
tests/providers/google/cloud/sensors/test_dataplex.py:
##########
@@ -144,3 +145,47 @@ def test_done(self, mock_hook):
)
assert result
+
+ def test_start_sensor_time(self):
+ sensor = DataplexDataQualityJobStatusSensor(
+ task_id=TASK_ID,
+ project_id=PROJECT_ID,
+ job_id=TEST_JOB_ID,
+ data_scan_id=TEST_DATA_SCAN_ID,
+ region=REGION,
+ api_version=API_VERSION,
+ gcp_conn_id=GCP_CONN_ID,
+ impersonation_chain=IMPERSONATION_CHAIN,
+ timeout=TIMEOUT,
+ )
+
+ assert sensor.start_sensor_time is None
+
+ duration_1 = sensor._duration()
+ duration_2 = sensor._duration()
+
+ assert bool(sensor.start_sensor_time)
Review Comment:
sure, thanks
--
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-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] o-nikolas commented on pull request #33440: Fix for the test in the Dataplex DQ.
Posted by "o-nikolas (via GitHub)" <gi...@apache.org>.
o-nikolas commented on PR #33440:
URL: https://github.com/apache/airflow/pull/33440#issuecomment-1681440095
Looks like the patch has passed our CI.
Though I agree with the unit test requested by @potiuk and suggested by @hussein-awala
--
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-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] potiuk merged pull request #33440: Fix for the test in the Dataplex DQ.
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk merged PR #33440:
URL: https://github.com/apache/airflow/pull/33440
--
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-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] o-nikolas commented on a diff in pull request #33440: Fix for the test in the Dataplex DQ.
Posted by "o-nikolas (via GitHub)" <gi...@apache.org>.
o-nikolas commented on code in PR #33440:
URL: https://github.com/apache/airflow/pull/33440#discussion_r1297548126
##########
tests/providers/google/cloud/sensors/test_dataplex.py:
##########
@@ -144,3 +145,47 @@ def test_done(self, mock_hook):
)
assert result
+
+ def test_start_sensor_time(self):
+ sensor = DataplexDataQualityJobStatusSensor(
+ task_id=TASK_ID,
+ project_id=PROJECT_ID,
+ job_id=TEST_JOB_ID,
+ data_scan_id=TEST_DATA_SCAN_ID,
+ region=REGION,
+ api_version=API_VERSION,
+ gcp_conn_id=GCP_CONN_ID,
+ impersonation_chain=IMPERSONATION_CHAIN,
+ timeout=TIMEOUT,
+ )
+
+ assert sensor.start_sensor_time is None
+
+ duration_1 = sensor._duration()
+ duration_2 = sensor._duration()
+
+ assert bool(sensor.start_sensor_time)
Review Comment:
The float by itself will be truthy (unless it's 0.0 of course, then it's falsey), no need to wrap in `bool`
--
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-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] hussein-awala commented on a diff in pull request #33440: Fix for the test in the Dataplex DQ.
Posted by "hussein-awala (via GitHub)" <gi...@apache.org>.
hussein-awala commented on code in PR #33440:
URL: https://github.com/apache/airflow/pull/33440#discussion_r1297759617
##########
tests/providers/google/cloud/sensors/test_dataplex.py:
##########
@@ -144,3 +145,47 @@ def test_done(self, mock_hook):
)
assert result
+
+ def test_start_sensor_time(self):
+ sensor = DataplexDataQualityJobStatusSensor(
+ task_id=TASK_ID,
+ project_id=PROJECT_ID,
+ job_id=TEST_JOB_ID,
+ data_scan_id=TEST_DATA_SCAN_ID,
+ region=REGION,
+ api_version=API_VERSION,
+ gcp_conn_id=GCP_CONN_ID,
+ impersonation_chain=IMPERSONATION_CHAIN,
+ timeout=TIMEOUT,
+ )
+
+ assert sensor.start_sensor_time is None
+
+ duration_1 = sensor._duration()
+ duration_2 = sensor._duration()
+
+ assert bool(sensor.start_sensor_time)
+ assert duration_1 > 0
+ assert duration_2 > 0
Review Comment:
The last check is sufficient because `duration_2 > duration_1 > 0`
```suggestion
```
--
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-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] o-nikolas commented on pull request #33440: Fix for the test in the Dataplex DQ.
Posted by "o-nikolas (via GitHub)" <gi...@apache.org>.
o-nikolas commented on PR #33440:
URL: https://github.com/apache/airflow/pull/33440#issuecomment-1681433997
Pulling [this convo](https://github.com/apache/airflow/pull/32256#issuecomment-1680581832) into this PR:
> Hi @o-nikolas ,
> I have prepared a hotfix for the problem in the tests for the DataplexDataQualityJobStatusSensor.
> The PR with the fix can be found here: https://github.com/apache/airflow/pull/33440
> I would be grateful if you could check if the hotfix solves current problem.
Running it through our CI now. I tested a similar change myself and it fixed the issue. So I think this should work.
--
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-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org