Skip to content

[fix][flaky] Fix flakyness in testAutoSchemaFunction - #17353

Merged
nicoloboschi merged 1 commit into
apache:masterfrom
cbornet:fix-testAutoSchemaFunction
Aug 31, 2022
Merged

nicoloboschi merged 1 commit into
apache:masterfrom
cbornet:fix-testAutoSchemaFunction

Conversation

@cbornet

@cbornet cbornet commented Aug 30, 2022 •

Copy link
Copy Markdown
Contributor

Motivation

testAutoSchemaFunction is flaky because ensureSubscriptionCreated will create a consumer to create the subscription.
By doing so it also adds a schema on the topic.
But that leads to a race when the function consumer uses AUTO_SCHEMA because the new schema is seen as incompatible if the function consumer is already subscribed (We get IncompatibleSchemaException : Topic does not have schema to check).
Note: the issue with the IncompatibleSchemaException is a bug and will be fixed in another PR (see issue #17354)

Modifications

Move the call to ensureSubscriptionCreated before creating the function.

Verifying this change

  • Make sure that the change passes the CI checks.

This change is already covered by existing tests, such as PulsarFunctionsTest

Does this pull request potentially affect one of the following parts:

no

If yes was chosen, please highlight the changes

  • Dependencies (does it add or upgrade a dependency): (yes / no)
  • The public API: (yes / no)
  • The schema: (yes / no / don't know)
  • The default values of configurations: (yes / no)
  • The wire protocol: (yes / no)
  • The rest endpoints: (yes / no)
  • The admin cli options: (yes / no)
  • Anything that affects deployment: (yes / no / don't know)

Documentation

Check the box below or label this PR directly.

Need to update docs?

  • doc-required
    (Your PR needs to update docs and you will update later)

  • doc-not-needed
    fix

  • doc
    (Your PR contains doc changes)

  • doc-complete
    (Docs have been already added)

@eolivelli eolivelli left a comment

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.

LGTM

@eolivelli eolivelli added this to the 2.12.0 milestone Aug 30, 2022
@eolivelli eolivelli added the doc-not-needed Your PR changes do not impact docs label Aug 30, 2022
@cbornet

cbornet commented Aug 30, 2022

Copy link
Copy Markdown
Contributor Author

I hope it fixes the CI. Not totally sure about that. At least it now works on my machine...

@cbornet
cbornet force-pushed the fix-testAutoSchemaFunction branch from cfc7867 to 7f67508 Compare August 30, 2022 16:55
@cbornet
cbornet requested review from eolivelli and removed request for dlg99, lhotari, nicoloboschi and zymap August 30, 2022 16:56
…before the function.

Otherwise if the function creates the subscription, there is no schema on the topic
and because of a bug a compatibility check fails on the new schema and the new consumer
can't be creatd
@cbornet
cbornet force-pushed the fix-testAutoSchemaFunction branch from 7f67508 to 6c59956 Compare August 31, 2022 06:57
@nicoloboschi
nicoloboschi merged commit 7dd2c79 into apache:master Aug 31, 2022
@cbornet
cbornet deleted the fix-testAutoSchemaFunction branch August 31, 2022 08:54
Technoboy- pushed a commit to Technoboy-/pulsar that referenced this pull request Feb 8, 2023
…before the function. (apache#17353)

Otherwise if the function creates the subscription, there is no schema on the topic
and because of a bug a compatibility check fails on the new schema and the new consumer
can't be creatd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants