Skip to content

test(e2e): fix TestAddNodeOriginAdvanced flakiness and improve observability#389

Merged
tsivaprasad merged 1 commit into
mainfrom
PLAT-617-enhance-add-node-data-safety-e-2-e-test-case
May 20, 2026
Merged

test(e2e): fix TestAddNodeOriginAdvanced flakiness and improve observability#389
tsivaprasad merged 1 commit into
mainfrom
PLAT-617-enhance-add-node-data-safety-e-2-e-test-case

Conversation

@tsivaprasad
Copy link
Copy Markdown
Contributor

@tsivaprasad tsivaprasad commented May 20, 2026

Summary

This PR enhance TestAddNodeOriginAdvanced E2E test reliability and observability by increasing context timeout to 10 minutes and adding comprehensive step-by-step logging.

Changes

  • Add comprehensive step-by-step logging at each operation:
    • Step 1: Database creation with ID logging
    • Step 2: Test data insertion confirmation
    • Step 3: Node addition with expected duration note
    • Step 3b: Replication completion wait
    • Step 4: Replication origin verification with actual LSN value
  • Add WaitForReplication() call after node update to ensure sync completes before assertion

Testing

make test-e2e E2E_FIXTURE=lima E2E_RUN=TestAddNodeOriginAdvanced
/Users/sivat/go/bin/gotestsum
--format-hide-empty-pkg
--format standard-verbose
--rerun-fails=0
--rerun-fails-max-failures=4
--packages='./e2e/...'
--
-tags=e2e_test -count=1 -timeout=45m -parallel 4 -run TestAddNodeOriginAdvanced -args -fixture lima
2026/05/20 15:16:18 initializing cluster
2026/05/20 15:16:18 cluster initialized
=== RUN TestAddNodeOriginAdvanced
=== PAUSE TestAddNodeOriginAdvanced
=== CONT TestAddNodeOriginAdvanced
add_node_data_safety_test.go:40: Step 1: Creating 2-node database fixture
add_node_data_safety_test.go:58: Database created: 65567e2d-c4cb-484b-b54f-b8e034b7a781
add_node_data_safety_test.go:62: Step 2: Writing 100 test rows to n2
add_node_data_safety_test.go:77: Test data written successfully
add_node_data_safety_test.go:80: Step 3: Adding n3 node with n1 as source
add_node_data_safety_test.go:86: Starting database update to add n3 (this may take several minutes)
add_node_data_safety_test.go:88: Database update completed, n3 node added successfully
add_node_data_safety_test.go:90: Step 3b: Waiting for replication to complete across all nodes
database_test.go:357: [TestAddNodeOriginAdvanced] waiting for replication to catch up on all nodes
add_node_data_safety_test.go:92: Replication complete
add_node_data_safety_test.go:97: Step 4: Checking replication origin on n3 (slot name: spk_origin_adv_db_n2_sub_n2_n3)
add_node_data_safety_test.go:116: Replication origin LSN: 0/1D569A0 (expected: not 0/0)
add_node_data_safety_test.go:123: Test completed successfully
fixture_test.go:200: cleaning up database 65567e2d-c4cb-484b-b54f-b8e034b7a781
--- PASS: TestAddNodeOriginAdvanced (543.14s)
PASS
ok github.com/pgEdge/control-plane/e2e 543.641s

DONE 1 tests in 543.611s

Checklist

  • Tests added or updated (unit and/or e2e, as needed)

PLAT-617

@codacy-production
Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cb2543a1-9a06-4d22-aad3-20a885ce806f

📥 Commits

Reviewing files that changed from the base of the PR and between ad61785 and c75f206.

📒 Files selected for processing (1)
  • e2e/add_node_data_safety_test.go

📝 Walkthrough

Walkthrough

This PR enhances the TestAddNodeOriginAdvanced e2e test with improved diagnostics and test flow control. Context timeout was increased, step logging was added throughout the replication sequence, explicit waits were added before origin verification, and the final LSN assertion now logs the observed value before comparing it to 0/0.

Changes

E2E Test Flow and Diagnostics

Layer / File(s) Summary
Test initialization and context setup
e2e/add_node_data_safety_test.go
Context timeout is increased and step logging is added before creating the 2-node test fixture.
Data generation and replication flow
e2e/add_node_data_safety_test.go
Test writes rows on node n2 with logged output, orchestrates node addition with explicit step logs and completion markers, and waits for replication to finish before querying the subscriber-side replication origin.
Replication origin verification
e2e/add_node_data_safety_test.go
After fetching the replication origin LSN, the test logs the observed value and asserts it is not 0/0.

Poem

🐰 A test that logs with care so bright,
Waits for replication through the night,
Origin tracked from source to clone,
Each checkpoint marked, each LSN shown,
Diagnostics bloom where bugs are known!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main changes: fixing flakiness and improving observability in a specific E2E test.
Description check ✅ Passed The description follows the required template with all major sections completed: Summary, Changes, Testing, and Checklist. Issue is linked (PLAT-617).
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch PLAT-617-enhance-add-node-data-safety-e-2-e-test-case

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.

@tsivaprasad tsivaprasad merged commit 00fd2d7 into main May 20, 2026
3 checks passed
@tsivaprasad tsivaprasad deleted the PLAT-617-enhance-add-node-data-safety-e-2-e-test-case branch May 20, 2026 14:14
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