Skip to content

source: introduce mock source for unit testing #6427

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
xx01cyx opened this issue Nov 17, 2022 · 7 comments
Closed

source: introduce mock source for unit testing #6427

xx01cyx opened this issue Nov 17, 2022 · 7 comments
Assignees
Labels
A-test Area: Testing framework & misc tests not belonging to any specific component. type/feature Type: New feature.

Comments

@xx01cyx
Copy link
Contributor

xx01cyx commented Nov 17, 2022

Is your feature request related to a problem? Please describe.

Currently, there is no way to write unit tests for streaming source in source executor.

Describe the solution you'd like

A MockSource could be introduced, which mocks the behavior of external source.

Describe alternatives you've considered

No response

Additional context

No response

@xx01cyx xx01cyx added the type/feature Type: New feature. label Nov 17, 2022
@github-actions github-actions bot added this to the release-0.1.15 milestone Nov 17, 2022
@xx01cyx xx01cyx changed the title Introduce mock source for testing test: introduce mock source for testing Nov 17, 2022
@xx01cyx xx01cyx changed the title test: introduce mock source for testing source: introduce mock source for testing Nov 17, 2022
@tabVersion
Copy link
Contributor

Then what is the expected behavior? I think datagen is what you are looking for.

@TennyZhuang
Copy link
Contributor

Then what is the expected behavior? I think datagen is what you are looking for.

datagen is not friendly for UT.

@fuyufjh fuyufjh removed this from the release-0.1.15 milestone Nov 28, 2022
@fuyufjh fuyufjh added the A-test Area: Testing framework & misc tests not belonging to any specific component. label Nov 28, 2022
@github-actions
Copy link
Contributor

This issue has been open for 60 days with no activity. Could you please update the status? Feel free to continue discussion or close as not planned.

@xxchan xxchan changed the title source: introduce mock source for testing source: introduce mock source for unit testing Jan 28, 2023
@xx01cyx
Copy link
Contributor Author

xx01cyx commented Feb 1, 2023

Due to our code design, if we are to construct a mock source for source executor, we must pass a Receiver (or sth. alike) into connector properties (which impls Serialization & Deserialization) before the construction of the source executor. Via the offline discussion with @tabVersion , there are 2 solutions for now:

  1. Pass an HTTP endpoint (not good to include such network stuff in unit testing)
  2. Construct the Receiver beforehand and pass its memory address (seems hack)

Wonder if there's any better solution for this.

cc. @xxchan @fuyufjh @BugenZhao @TennyZhuang

@fuyufjh
Copy link
Collaborator

fuyufjh commented Feb 2, 2023

To test the streaming operators, I think "append-only table source" is enough, which allows you to insert values to form an append-only stream.

Can you please explain more about the motivation for this issue?

By the way, Tao has once proposed to introduce an HTTP endpoint to allow users to POST data (e.g. JSON) into RisingWave. It sounds similar, but it's a user-facing feature rather than designed for testing.

@fuyufjh
Copy link
Collaborator

fuyufjh commented Feb 2, 2023

Just guess: If you are thinking about testing watermark, the append-only table source should support it after #6952 is done.

@xx01cyx
Copy link
Contributor Author

xx01cyx commented Feb 2, 2023

To test the streaming operators, I think "append-only table source" is enough, which allows you to insert values to form an append-only stream.

Can you please explain more about the motivation for this issue?

By the way, Tao has once proposed to introduce an HTTP endpoint to allow users to POST data (e.g. JSON) into RisingWave. It sounds similar, but it's a user-facing feature rather than designed for testing.

This is just for testing source executor, and is not for testing watermark. For now, we use datagen for source executor ut, which generates data in a background task asynchronously following a predefined pattern. I'm actually thinking of a foreground way of generating source data, and this issue limits the scope to unit testing.

Actually, datagen is working well in source executor ut (though not perfect). Maybe we can keep this as it is, and instead of implementing the mock source, we could broaden the scope beyond unit testing by introducing the HTTP source.

@xxchan xxchan closed this as not planned Won't fix, can't repro, duplicate, stale May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-test Area: Testing framework & misc tests not belonging to any specific component. type/feature Type: New feature.
Projects
None yet
Development

No branches or pull requests

5 participants