Skip to content

eventservice: stabilize signal resolved table trigger test #4772

@hongyunyan

Description

@hongyunyan

Bug report

TestProcessTableTriggerDispatcherSendsSignalResolvedWhenNoForwardRangeAndNotInCommitStage is brittle and can look flaky when the surrounding implementation changes.

Background

The test is intended to verify the table trigger dispatcher behavior when there is no forward range and the changefeed is not in the syncpoint commit stage. In that case, the dispatcher should send a signal resolved event without advancing past the current watermark.

Problem

The current test couples that behavior to two unrelated implementation details:

  1. It assumes the dispatcher is still unhandshaked, so the first message must be a HandshakeEvent.
  2. It uses time.Now().Add(...) to bypass the resolved-ts rate limit, which makes the setup depend on wall clock timing instead of deterministic state.

Because of that, the test is validating more than its name suggests, and it becomes fragile under benign changes to handshake timing or resolved-ts throttling.

Expected behavior

The test should only assert the behavior it is named after:

  • a signal resolved event is emitted when there is no forward range
  • the resolved watermark stays at the current value
  • nextSyncPoint is unchanged

Suggested fix

Make the test deterministic by:

  • pre-marking the dispatcher as handshaked so handshake ordering is out of scope
  • using a zero lastSentResolvedTsTime to bypass the rate limit deterministically
  • asserting only the emitted resolved event and the relevant watermark state

Metadata

Metadata

Assignees

No one assigned

    Labels

    component/testUnit tests and integration tests component.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions