Skip to content

Commit

Permalink
Skip event update test until TDL-24065 is done (#187)
Browse files Browse the repository at this point in the history
* Skip event update test until TDL-24065 is done

* Modify bookmark test not to expect update TDL-24065

* Add second assertion skip with jira check

* Fix imports

* Update another assertion that depends on updates
  • Loading branch information
bhtowles authored Sep 18, 2023
1 parent c60e813 commit e69c1b5
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 8 deletions.
13 changes: 12 additions & 1 deletion tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

from tap_tester import connections, menagerie, runner, LOGGER
from tap_tester.base_case import BaseCase
from tap_tester.jira_client import JiraClient as jira_client
from tap_tester.jira_client import CONFIGURATION_ENVIRONMENT as jira_config

JIRA_CLIENT = jira_client({ **jira_config })


class BaseTapTest(BaseCase):
Expand Down Expand Up @@ -550,6 +554,13 @@ def __init__(self, *args, **kwargs):
self.start_date = self.get_properties().get('start_date')
self.maxDiff=None


def dt_to_ts(self, dtime):
return parser.parse(dtime).timestamp()

def skipUntilDone(jira_ticket):
def wrap(test_method):
# statusCategory keys https://jira.talendforge.org/rest/api/2/statuscategory/
is_done = JIRA_CLIENT.get_status_category(jira_ticket) == "done"
return BaseCase.skipUnless(is_done, jira_ticket)(test_method)

return wrap
37 changes: 30 additions & 7 deletions tests/test_bookmarks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Test tap sets a bookmark and respects it for the next sync of a stream
"""
import base
import math
import json
from pathlib import Path
Expand Down Expand Up @@ -326,11 +327,18 @@ def test_run(self):
sync_pk_values = [sync_record.get('id')
for sync_record in second_sync_data
if sync_record.get('id') == expected_pk_value]
self.assertTrue(
len(sync_pk_values) > 0,
msg="A record is missing from our sync: \nSTREAM: {}\tPK: {}".format(stream, expected_pk_value)
)
self.assertIn(expected_pk_value, sync_pk_values)
if stream != 'invoice_items':
self.assertTrue(len(sync_pk_values) > 0,
msg = ("A record is missing from module import symbol "
"our sync: \nSTREAM: {}\tPK: {}".format(
stream, expected_pk_value))
)
self.assertIn(expected_pk_value, sync_pk_values)
else:
is_done = base.JIRA_CLIENT.get_status_category("TDL-24065") == 'done'
assert_message = ("JIRA ticket has moved to done, remove the "
"if stream != 'invoice_items' line above.")
assert is_done == False, assert_message

# Verify updated fields are replicated as expected
if stream == "payment_intents":
Expand All @@ -345,12 +353,27 @@ def test_run(self):
self.assertIsNotNone(sync_records_payment_method[0])
else:
for updated_record in updated_records[stream]:
if stream == 'invoice_items':
is_done = base.JIRA_CLIENT.get_status_category("TDL-24065") == 'done'
assert_message = ("JIRA ticket has moved to done, remove the "
"if stream != 'invoice_items' line above.")
assert is_done == False, assert_message

continue

expected_updated_key = 'metadata'
expected_updated_value_substring = 'bob'
updated_pk_value = updated_record.get('id')
sync_records_metadata = [sync_record.get('metadata')
for sync_record in second_sync_data
if sync_record.get('id') == updated_pk_value]
self.assertTrue(len(sync_records_metadata) == 1)
self.assertIn(expected_updated_value_substring,
sync_records_metadata[0].get('test_value'))

if base.JIRA_CLIENT.get_status_category("TDL-24065") == 'done':
assert_message = ("JIRA ticket has moved to done, uncomment the "
"assertion below.")
assert True == False, assert_message

# uncomment when TDL-24065 is completed and updates test is stable
# self.assertIn(expected_updated_value_substring,
# sync_records_metadata[0].get('test_value'))
2 changes: 2 additions & 0 deletions tests/test_event_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def get_properties(self, *args):
props['date_window_size'] = 30 # An optional config param to collect data of newly created records in specified date window.
return props

@BaseTapTest.skipUntilDone("TDL-24065")
def test_run(self):
"""
Verify that each record is from the last 30 days.
Expand Down Expand Up @@ -75,6 +76,7 @@ class EventUpdatesTest(BaseTapTest):
def name():
return "tt_stripe_event_updates"

@BaseTapTest.skipUntilDone("TDL-24065")
def test_run(self):
"""
Verify that the sync only sent records to the target for selected streams
Expand Down

0 comments on commit e69c1b5

Please sign in to comment.