From e69c1b5c9e8aba0334cf71f96ec381bbb1dded40 Mon Sep 17 00:00:00 2001 From: bhtowles Date: Mon, 18 Sep 2023 13:28:35 -0500 Subject: [PATCH] Skip event update test until TDL-24065 is done (#187) * 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 --- tests/base.py | 13 ++++++++++++- tests/test_bookmarks.py | 37 ++++++++++++++++++++++++++++++------- tests/test_event_updates.py | 2 ++ 3 files changed, 44 insertions(+), 8 deletions(-) diff --git a/tests/base.py b/tests/base.py index 8f837de4..c229dc9d 100644 --- a/tests/base.py +++ b/tests/base.py @@ -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): @@ -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 diff --git a/tests/test_bookmarks.py b/tests/test_bookmarks.py index 9f55f0be..ca7f0e38 100644 --- a/tests/test_bookmarks.py +++ b/tests/test_bookmarks.py @@ -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 @@ -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": @@ -345,6 +353,14 @@ 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') @@ -352,5 +368,12 @@ def test_run(self): 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')) diff --git a/tests/test_event_updates.py b/tests/test_event_updates.py index ecfab7b4..ff184488 100644 --- a/tests/test_event_updates.py +++ b/tests/test_event_updates.py @@ -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. @@ -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