Skip to content

SUP-62: Add TAP tests for lolor dump/restore, streaming and logical replication#33

Open
danolivo wants to merge 3 commits intomainfrom
sup-62
Open

SUP-62: Add TAP tests for lolor dump/restore, streaming and logical replication#33
danolivo wants to merge 3 commits intomainfrom
sup-62

Conversation

@danolivo
Copy link
Contributor

Add TAP tests for lolor dump/restore, streaming and logical replication

Summary

  • Add 003_dump_restore.pl: verifies lolor large objects survive pg_dump/psql
    restore to a fresh instance, and that new objects can be created after restore
  • Add 004_streaming_replication.pl: verifies lolor objects created both before
    and after standby setup are accessible on a hot standby via physical streaming
    replication
  • Add 005_logical_replication.pl: verifies lolor objects replicate to a
    subscriber via logical replication, covering both initial table sync and
    ongoing WAL streaming

@danolivo danolivo self-assigned this Feb 26, 2026
@danolivo danolivo added the enhancement New feature or request label Feb 26, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 26, 2026

📝 Walkthrough

Walkthrough

Adds three new Perl test scripts validating lolor large object behavior across different PostgreSQL configurations. Tests cover dump and restore functionality, streaming replication between primary and standby clusters, and logical replication between publisher and subscriber clusters.

Changes

Cohort / File(s) Summary
Large Object Test Suite
t/003_dump_restore.pl, t/004_streaming_replication.pl, t/005_logical_replication.pl
New test scripts validating lolor large object persistence and replication. t/003_dump_restore.pl tests dump/restore across clusters; t/004_streaming_replication.pl validates streaming replication between primary and standby; t/005_logical_replication.pl verifies logical replication between publisher and subscriber.

Poem

🐰 Hops excitedly

Three new tests hop into the warren,
Checking large objects won't be forgotten!
From dumps to streams to logic's way,
Lolor objects dance and play,
PostgreSQL replication—hip hooray! 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: adding TAP tests for lolor across three replication/backup scenarios (dump/restore, streaming, logical).
Description check ✅ Passed The description is directly related to the changeset, providing a detailed summary of the three new test files and their specific purposes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sup-62

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
t/003_dump_restore.pl (1)

30-44: Consider extracting a helper for repeated LO read SQL blocks.

The same BEGIN; lo_open; loread; END; pattern appears multiple times; a local helper would reduce duplication and future edit drift.

♻️ Optional refactor sketch
+sub read_lo_text
+{
+	my ($node, $loid) = `@_`;
+	return $node->safe_psql('postgres', qq(
+	BEGIN;
+	SELECT lo_open($loid, 262144) AS fd \\gset
+	SELECT convert_from(loread(:fd, 1024), 'UTF8');
+	END;
+));
+}
+
-$result = $src->safe_psql('postgres', qq(
-	BEGIN;
-	SELECT lo_open(1, 262144) AS fd \\gset
-	SELECT convert_from(loread(:fd, 1024), 'UTF8');
-	END;
-));
+$result = read_lo_text($src, 1);
 is($result, 'lolor LO object - 1', "Verify first LO content on source");

Also applies to: 64-90

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@t/003_dump_restore.pl` around lines 30 - 44, Extract a small helper to reduce
duplication around the repeated BEGIN/lo_open/loread/END SQL pattern: create a
function (e.g., read_lo_content) that accepts the PgNode $src and an OID or LO
ID, builds and calls $src->safe_psql('postgres', ...) with the same block that
does SELECT lo_open(... ) AS fd \\gset and SELECT convert_from(loread(:fd,
1024), 'UTF8'); then replace the two direct calls that currently invoke
$src->safe_psql in the test with calls to read_lo_content($src, 1) and
read_lo_content($src, 2); ensure the helper returns the same string value so
existing is(...) assertions for "Verify first LO content on source" and "Verify
second LO content on source" keep working.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@t/003_dump_restore.pl`:
- Around line 30-44: Extract a small helper to reduce duplication around the
repeated BEGIN/lo_open/loread/END SQL pattern: create a function (e.g.,
read_lo_content) that accepts the PgNode $src and an OID or LO ID, builds and
calls $src->safe_psql('postgres', ...) with the same block that does SELECT
lo_open(... ) AS fd \\gset and SELECT convert_from(loread(:fd, 1024), 'UTF8');
then replace the two direct calls that currently invoke $src->safe_psql in the
test with calls to read_lo_content($src, 1) and read_lo_content($src, 2); ensure
the helper returns the same string value so existing is(...) assertions for
"Verify first LO content on source" and "Verify second LO content on source"
keep working.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0f5f27f and 369e0ad.

📒 Files selected for processing (3)
  • t/003_dump_restore.pl
  • t/004_streaming_replication.pl
  • t/005_logical_replication.pl

@mason-sharp mason-sharp requested a review from rasifr February 27, 2026 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants