Skip to content

add postgres connector test to pytest#212

Merged
grantzhou merged 12 commits into
Hornetlabs:synchdb-develfrom
caryhuang:synchdb-devel
Jan 20, 2026
Merged

add postgres connector test to pytest#212
grantzhou merged 12 commits into
Hornetlabs:synchdb-develfrom
caryhuang:synchdb-devel

Conversation

@caryhuang
Copy link
Copy Markdown
Contributor

  • pytest testing is updated to support postgres connector test
  • github CI also modified to test postgres connector
  • addressed issues reported by claude code
  • resolved a crash with bit and varbit handling when the value is too long

/* 8 bits per byte + extra zeros + terminating null */
out = (char *) palloc0((tmpoutlen * 8) + extrazeros + 1);

elog(WARNING, "in len = %d, extrazero = %d, typmod = %d, trim = %d", (tmpoutlen * 8),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be debug information and shouldn’t appear in production code. Consider deleting or changing it to DEBUG1.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it is indeed debug message that should not be at warning level

assert len(rows) > 0
for row in rows:
assert row[0].lower() == row[1]
# check attname mappings
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mixed use of tabs and spaces, Python is sensitive to indentation, which may lead to runtime errors

assert len(rows) > 0
for row in rows:
assert verify_default_type_mappings(row[0], row[1], dbvendor) == True
# check data type mappings
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mixed use of tabs and spaces, Python is sensitive to indentation, which may lead to runtime errors

for row in rows:
assert verify_default_type_mappings(row[0], row[1], dbvendor) == True
# check data type mappings
rows = run_pg_query(pg_cursor, f"SELECT ext_atttypename, pg_atttypename FROM synchdb_att_view WHERE name = '{name}' AND type = '{dbvendor}'")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mixed use of tabs and spaces, Python is sensitive to indentation, which may lead to runtime errors

Comment thread src/test/pytests/synchdbtests/conftest.py
elif dbvendor == "postgres":
isfdw = run_pg_query_one(pg_cursor, f"SELECT EXISTS ( SELECT 1 FROM pg_available_extensions WHERE name = 'postgres_fdw' ) AS postgres_fdw_available")
if isfdw[0] == False:
print ("test_InitialSnapshotFDW_asis kipped - postgres_fdw not available for install")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo, kipped should be skipped

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed

@grantzhou grantzhou merged commit 375c8fb into Hornetlabs:synchdb-devel Jan 20, 2026
37 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants