-
Notifications
You must be signed in to change notification settings - Fork 141
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
TDL-7596: Add tap-tester test for attribution window #169
TDL-7596: Add tap-tester test for attribution window #169
Conversation
class FacebookAttributionWindow(FacebookBaseTest): | ||
|
||
# set attribution window | ||
attrubution_window = 7 |
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.
Define constants in caps like ATTRIBUTION_WINDOW
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.
Added
def name(): | ||
return "tap_tester_facebook_attribution_window" | ||
|
||
def get_properties(self, original: bool = True): |
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.
Why do we need this method here, isn't it defined in the base.py?
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.
Yes, it is defined, but here we wanted to use different values of attribution window.
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.
Then can't we add one more optional parameter?
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.
No, here only 1 argument can be passed in the function.
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.
Okay
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.
This is an unfortunate restriction of the tap-tester backend.
replication_key_value = record.get(replication_key) | ||
|
||
# Verify the sync records respect the (simulated) start date value | ||
self.assertGreaterEqual(self.parse_date(replication_key_value), self.parse_date(start_date_with_attribution_window), |
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.
@harshpatel4crest Can you please explain how does the 3 checks asked in the DoD of this ticket is accumulated in this test 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.
self.assertGreaterEqual(self.parse_date(replication_key_value), self.parse_date(start_date_with_attribution_window)
is for the 1st check.
self.assertTrue(is_between, msg="No record found between start date and attribution date.")
is for the 2nd check, where is_between
is the boolean value for the checking if any record is present between the start date and buffered start date.
3rd check is about the error message when we pass the attribution window other than {1, 7, 28}. But the UI does not allow the attribution window to be set except {1, 7, 28}. The tap is also working when we set an attribution window other than this.
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.
Please complete the 3rd assertion. If the tap does not throw an acceptable error, that is a bug and should be documented and linked in the test with a workaround.
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.
Facebook only supports those values, so even though the tap does not blow up when given a different value I think we should force an error so that we match what they claim they support. Additionally we have use cases where the tap is ran directly so, just because the UI has restrictions around the values does not mean a user will not send something crazy into the config.
FB Docs: https://www.facebook.com/business/help/395050428485124?id=428636648170202
Stitch Docs: https://www.stitchdata.com/docs/integrations/saas/facebook-ads#select-attribution-window
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.
@kspeer825 Added code change to raise an error when the attribution window is not 1, 7 or 28.
replication_key_value = record.get(replication_key) | ||
|
||
# Verify the sync records respect the (simulated) start date value | ||
self.assertGreaterEqual(self.parse_date(replication_key_value), self.parse_date(start_date_with_attribution_window), |
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.
Please complete the 3rd assertion. If the tap does not throw an acceptable error, that is a bug and should be documented and linked in the test with a workaround.
replication_key_value = record.get(replication_key) | ||
|
||
# Verify the sync records respect the (simulated) start date value | ||
self.assertGreaterEqual(self.parse_date(replication_key_value), self.parse_date(start_date_with_attribution_window), |
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.
Facebook only supports those values, so even though the tap does not blow up when given a different value I think we should force an error so that we match what they claim they support. Additionally we have use cases where the tap is ran directly so, just because the UI has restrictions around the values does not mean a user will not send something crazy into the config.
FB Docs: https://www.facebook.com/business/help/395050428485124?id=428636648170202
Stitch Docs: https://www.stitchdata.com/docs/integrations/saas/facebook-ads#select-attribution-window
import unittest | ||
import tap_facebook.__init__ as tap_facebook | ||
|
||
class TestAttributionWindow(unittest.TestCase): |
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.
It's fine to leave in this unittest, but this should be a tap-tester case. We want to prove the error is thrown during discovery.
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.
@kspeer825 Added integration test for verifying error is thrown in discovery mode.
* TDL-9728: Stream `ads_insights_age_gender` has unexpected datatype for replication key field `date_start` (#172) * added format as date-time in schema file * added code coverage * added check for date format in the bookmark test * added the check for first sync messages Co-authored-by: namrata270998 <namrata.brahmbhatt@crestdatasys.com> * TDL-9809: `forced-replication-method` missing from metadata for some streams and TDL-9872: replication keys are not specified as expected in discoverable metadata (#167) * added valid replication keys in catalog * modified the code * TDL-9809: Added replication keys in metadata * adde code coverage * Resolved review comments Co-authored-by: harshpatel4_crest <harsh.patel4@crestdatasys.com> Co-authored-by: namrata270998 <namrata.brahmbhatt@crestdatasys.com> * TDL-7455: Add tap-tester test to verify replication of deleted records (#168) * TDL-7455: Added archived data integration test * TDL-7455: Updated integration test * added code coverage * Resolved review comment Co-authored-by: namrata270998 <namrata.brahmbhatt@crestdatasys.com> * TDL-7596: Add tap-tester test for attribution window (#169) * added tap tester test for attribution window * updated the code * added code coverage * updated the code according to the comments * updated code to raise error when attribution window is not 1, 7, 28 * test: run invalid attribution window intergation test * updated test case * test: updated test case code * test: test invalid attribution window * test: test invalid attribution window * test: test invalid attribution window * test: test invalid attribution window * test: run invalid attribution window test case * added intergation test for invalid sttribution window Co-authored-by: namrata270998 <namrata.brahmbhatt@crestdatasys.com> Co-authored-by: namrata270998 <namrata.brahmbhatt@crestdatasys.com> Co-authored-by: savan-chovatiya <80703490+savan-chovatiya@users.noreply.github.com>
* TDL-9728: Stream `ads_insights_age_gender` has unexpected datatype for replication key field `date_start` (singer-io#172) * added format as date-time in schema file * added code coverage * added check for date format in the bookmark test * added the check for first sync messages Co-authored-by: namrata270998 <namrata.brahmbhatt@crestdatasys.com> * TDL-9809: `forced-replication-method` missing from metadata for some streams and TDL-9872: replication keys are not specified as expected in discoverable metadata (singer-io#167) * added valid replication keys in catalog * modified the code * TDL-9809: Added replication keys in metadata * adde code coverage * Resolved review comments Co-authored-by: harshpatel4_crest <harsh.patel4@crestdatasys.com> Co-authored-by: namrata270998 <namrata.brahmbhatt@crestdatasys.com> * TDL-7455: Add tap-tester test to verify replication of deleted records (singer-io#168) * TDL-7455: Added archived data integration test * TDL-7455: Updated integration test * added code coverage * Resolved review comment Co-authored-by: namrata270998 <namrata.brahmbhatt@crestdatasys.com> * TDL-7596: Add tap-tester test for attribution window (singer-io#169) * added tap tester test for attribution window * updated the code * added code coverage * updated the code according to the comments * updated code to raise error when attribution window is not 1, 7, 28 * test: run invalid attribution window intergation test * updated test case * test: updated test case code * test: test invalid attribution window * test: test invalid attribution window * test: test invalid attribution window * test: test invalid attribution window * test: run invalid attribution window test case * added intergation test for invalid sttribution window Co-authored-by: namrata270998 <namrata.brahmbhatt@crestdatasys.com> Co-authored-by: namrata270998 <namrata.brahmbhatt@crestdatasys.com> Co-authored-by: savan-chovatiya <80703490+savan-chovatiya@users.noreply.github.com>
Description of change
TDL-7596: Add tap-tester test for attribution window
NOTE: The UI does not allow the attribution window to be set except {1, 7, 28}. The tap is also working when we set an attribution window other than this.
Manual QA steps
Risks
Rollback steps