Skip to content

Add test hooks for DC replication tests#10322

Open
stephanos wants to merge 1 commit into
mainfrom
stephanos/hooks-dc
Open

Add test hooks for DC replication tests#10322
stephanos wants to merge 1 commit into
mainfrom
stephanos/hooks-dc

Conversation

@stephanos
Copy link
Copy Markdown
Contributor

What changed

  • Add testhooks for history replication DLQ writes, replication task execution/conversion, and namespace replication task execution.
  • Migrate xdc history replication DLQ and signals/updates tests from Fx decorators to testhooks.
  • Mark WithFxOptionsForService as deprecated in favor of dedicated test options or testhooks.

Validation

  • go test -tags test_dep ./tests/xdc -run '^TestHistoryReplicationDLQSuite$' -count=1
  • go test -tags test_dep ./tests/xdc -run '^TestHistoryReplicationSignalsAndUpdatesTestSuite$' -count=1
  • go test -tags test_dep ./common/namespace/nsreplication ./service/history/replication ./tests/testcore -run '^$' -count=1
  • git diff --check

@stephanos stephanos requested review from a team as code owners May 19, 2026 02:40
@stephanos stephanos force-pushed the stephanos/hooks-dc branch 3 times, most recently from 19d30ef to 726b74c Compare May 19, 2026 03:07
Comment thread common/testing/testhooks/hooks.go Outdated
Comment on lines +23 to +26
HistoryReplicationDLQWrite = newKey[func(any), namespace.ID]()
HistoryReplicationTaskInterceptor = newKey[func(any, func() error) error, namespace.ID]()
HistoryReplicationTaskAfterConvert = newKey[func(string, any, any) any, global]()
NamespaceReplicationTaskInterceptor = newKey[func(context.Context, *replicationspb.NamespaceTaskAttributes, func(context.Context, *replicationspb.NamespaceTaskAttributes) error) error, namespace.Name]()
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.

These hooks allow changing the behavior in a more surgical manner than decorating the entire module.

@stephanos stephanos force-pushed the stephanos/hooks-dc branch 5 times, most recently from deff028 to 2353183 Compare May 19, 2026 03:14
// able to route history replication tasks to test-specific (i.e. workflow-specific) buffers. Each test
// registers itself as it starts. Workflow ID is unique per test due to the use of TestVars.
testMapLock sync.Mutex
testsByWorkflowID map[string]*hrsuTest
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.

ID enforced by linter

@stephanos stephanos force-pushed the stephanos/hooks-dc branch from 2353183 to d0fed76 Compare May 19, 2026 03:20
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.

1 participant