Skip to content
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

ftltest support for PubSub #1598

Closed
Tracked by #1597
matt2e opened this issue May 29, 2024 · 2 comments · Fixed by #1736
Closed
Tracked by #1597

ftltest support for PubSub #1598

matt2e opened this issue May 29, 2024 · 2 comments · Fixed by #1736
Assignees

Comments

@matt2e
Copy link
Collaborator

matt2e commented May 29, 2024

No description provided.

@matt2e matt2e mentioned this issue May 29, 2024
14 tasks
@github-actions github-actions bot added the triage Issue needs triaging label May 29, 2024
@ftl-robot ftl-robot mentioned this issue May 29, 2024
@matt2e matt2e removed the triage Issue needs triaging label May 29, 2024
@matt2e
Copy link
Collaborator Author

matt2e commented Jun 6, 2024

Brainstorming things that could be useful:

  • Disable all subscribers by default & a way to enable the subscriber(s) you are testing
  • A way to post to topics in other modules from the test code (normally this would fail), so that you can test consuming events even if the topic is external
  • A way to wait for a subscription to consume all events (useful to wait before doing test checks)
  • A way to get processed/pending events for a subscription
  • A way to get all published events for a topic (useful when testing a publisher to make sure the correct events were published)

@matt2e matt2e self-assigned this Jun 6, 2024
@matt2e
Copy link
Collaborator Author

matt2e commented Jun 6, 2024

thoughts @alecthomas?

matt2e added a commit that referenced this issue Jun 12, 2024
closes #1598

Adds:
- By default, disables all subscribers during unit tests
- Subscribers can be manually added per unit test
- Subscribers can be actual sinks, or ad-hoc ones defined in the test
(just define a `func` in the argument)
- Check what events were published to a topic
- Check what events were consumed by a subscription, and whether an
error occured
- Allow the unit test to wait for all events to be consumed
- Unit tests can publish to external module's topics
- And conversely, added a runtime check to disallow publishing to
external modules when not in a unit test. fixes #1703
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 a pull request may close this issue.

1 participant