-
Notifications
You must be signed in to change notification settings - Fork 15
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-24162 Log based inclusivity updates #90
Conversation
Why do we still have test_sync_fully.py in the repo? Can I delete it? |
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 have a couple of questions
expected_count['log_based_interruptible_dbo_int_and_bool_data'] = 2 | ||
expected_count['log_based_interruptible_dbo_int_data'] = 14 |
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 don't see what changed to make this expectation to change? What am I missing?
tests/base.py
Outdated
stream_pks = {tuple(m.get('data', {}).get(pk) for pk in primary_keys) | ||
for m in recs['messages'] | ||
if m['action'] == 'upsert'} | ||
|
||
# remove any failed get() entries from the set to correct pk count | ||
stream_pks.difference(set(tuple(None for pk in primary_keys))) | ||
|
||
pk_count_by_stream[strm] = len(stream_pks) |
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.
Similar test code to before
primary_keys = ["pk1", "pk2"]
recs = {
"messages": [
{
"action": "upsert",
"data":{"pk1": "a", "pk2": "2",}
},
{
"action": "upsert",
"data":{"pk1": "a", "pk2": "2",}
},
{
"action": "upsert",
"data":{"pk1": "a", "pk2": "2",}
},
{
"action": "upsert",
"data":{"pk1": "a", "pk2": "3",}
},
{
"action": "upsert",
"data":{"pk1": "a",}
},
{
"action": "upsert",
"data":{"pk1": "a", "pk2": None,}
},
]
}
stream_pks = {tuple(m.get('data', {}).get(pk) for pk in primary_keys)
for m in recs['messages']
if m['action'] == 'upsert'}
print(f"before difference: {stream_pks}")
stream_pks.difference(set(tuple(None for pk in primary_keys)))
print(f"after difference: {stream_pks}")
print(f"Got {len(stream_pks)} unique pks")
Results:
before difference: {('a', None), ('a', '3'), ('a', '2')}
after difference: {('a', None), ('a', '3'), ('a', '2')}
Got 3 unique pks
set().difference()
doesn't modify the set its called on
- But I'm not sure I understand
# remove any failed get() entries from the set to correct pk count
anyway - Seems like the test needs to fail if any PK returns null
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 idea was to filter out any bad upserts, we carded out an upstream verification but I do like just failing the test if we find a bad upsert here. Commit incomming.
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 left comments, but they're all for formatting things I don't care to follow up on
from database import create_database, create_table, create_view, delete_by_pk, \ | ||
drop_all_user_databases, enable_database_tracking, insert, mssql_cursor_context_manager, \ | ||
update_by_pk |
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.
Looks like this was only alphabetized? I don't see any additions or deletions?
@@ -5,9 +5,9 @@ | |||
|
|||
from tap_tester import menagerie, runner, LOGGER |
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.
But this wasn't alphabetized too?
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.
In general I tend to only alphabetize things when the list gets long enough that looking for an item isn't trivial. If it spans two lines or has a bunch of small values in random order for example.
'selected-by-default': True, | ||
'inclusion': 'automatic'}}, | ||
{'info': { | ||
'sql-datatype': 'int', 'selected-by-default': True, 'inclusion': 'available'}}], |
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.
Any reason why this was left condensed?
{'pk': { | ||
'sql-datatype': 'int', 'selected-by-default': True, 'inclusion': 'automatic'}}, | ||
{'data': { | ||
'sql-datatype': 'int', 'selected-by-default': True, 'inclusion': 'available'}}], |
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.
Or why these are condensed too?
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.
All line length
{'pk': { | ||
'sql-datatype': 'int', 'selected-by-default': True, 'inclusion': 'automatic'}}, | ||
{'data': { | ||
'sql-datatype': 'int', 'selected-by-default': True, 'inclusion': 'available'}}], |
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.
Seems like we like it condensed, so maybe that first one is the sore thumb and needs to change
tests/test_sync_logical_pks.py
Outdated
else: | ||
# the row wasn't deleted so we can either not pass the column or it can be None | ||
# row wasn't deleted so dont pass the column or let it be None |
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.
# row wasn't deleted so dont pass the column or let it be None | |
# row wasn't deleted so don't pass the column or let it be None |
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.
Updated
Uncomment all record count assertions, fix with pk count where needed, new method
Description of change
(write a short description here or paste a link to JIRA)
QA steps
Risks
Rollback steps