mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
add success and failure count in assertions (#318)
This commit is contained in:
parent
e7203bebb5
commit
d595d4a8c4
1 changed files with 5 additions and 0 deletions
|
|
@ -78,6 +78,8 @@ UPDATE_HIGHLIGHT_SQL = f'''
|
|||
def assertData(conn, client):
|
||||
# get all users from postgres
|
||||
try:
|
||||
success = 0
|
||||
failure = 0
|
||||
cursor = conn.cursor(cursor_factory=RealDictCursor)
|
||||
cursor.execute('''SELECT id FROM omnivore.user''')
|
||||
result = cursor.fetchall()
|
||||
|
|
@ -90,11 +92,14 @@ def assertData(conn, client):
|
|||
index='pages', body={'query': {'term': {'userId': userId}}})['count']
|
||||
|
||||
if countInPostgres == countInElastic:
|
||||
success += 1
|
||||
print(f'User {userId} OK')
|
||||
else:
|
||||
failure += 1
|
||||
print(
|
||||
f'User {userId} ERROR: postgres: {countInPostgres}, elastic: {countInElastic}')
|
||||
cursor.close()
|
||||
print(f'Asserted data, success: {success}, failure: {failure}')
|
||||
except Exception as err:
|
||||
print('Assert data ERROR:', err)
|
||||
exit(1)
|
||||
|
|
|
|||
Loading…
Reference in a new issue