-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Only update crawler tags if present in config dict #32331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Adaverse
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes and corresponding test coverage LGTM.
| mock_config_missing_tags.pop("Tags") | ||
| mock_get_conn.return_value.get_crawler.return_value = {"Crawler": mock_config_missing_tags} | ||
|
|
||
| assert self.hook.update_crawler(**mock_config_missing_tags) is False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also add a testcase for when Tags key is in the config? Not sure if it's already covered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think test_replace_tag function is testing the above case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah. Can you double check it @utkarsharma2 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya, they are covered. I got confused by these lines, it seems like they don't add any value to the test. Test seems to work even after removing them.
airflow/tests/providers/amazon/aws/hooks/test_glue_crawler.py
Lines 169 to 170 in d012483
| mock_config_two = deepcopy(mock_config) | |
| mock_config_two.pop("Tags") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed those two lines
|
Can we also do this cleanup i.e in test |
what do you mean by lying :) ? |
The variable |
Adaverse
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Closes: #32330
This PR modifies the GlueCrawlerHook to only update the crawlers tags if the
Tagskey is present in theconfigdict. This prevent situations where tags that are set by external processes are overwritten whenever the crawler is run from Airflow.