-
Notifications
You must be signed in to change notification settings - Fork 112
feat(users): user wf tests #1935
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
feat(users): user wf tests #1935
Conversation
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
How to use the Graphite Merge QueueAdd the label merge-queue to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
c562f66
to
7c0e8aa
Compare
0faf1d5
to
eef480c
Compare
Deploying rivet with
|
Latest commit: |
0964bef
|
Status: | ✅ Deploy successful! |
Preview URL: | https://6426e848.rivet.pages.dev |
Branch Preview URL: | https://01-22-feat-users-user-wf-tes.rivet.pages.dev |
7c0e8aa
to
c70fe90
Compare
883775d
to
49cc103
Compare
c70fe90
to
e62fbcd
Compare
49cc103
to
c7df546
Compare
e62fbcd
to
f129825
Compare
c7df546
to
ba97929
Compare
f129825
to
af1c2e9
Compare
ba97929
to
8ed4f56
Compare
af1c2e9
to
1854f2f
Compare
1215ed1
to
6d9b376
Compare
1854f2f
to
65dbb93
Compare
6d9b376
to
9277340
Compare
65dbb93
to
d1e1fb6
Compare
9277340
to
cfaabb0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This PR introduces a new faker package for generating test data in the Rivet codebase, focusing on user workflow testing. Here's a concise summary of the key changes:
- Added new
faker
service package in/packages/services/faker
for generating test data with user operations - Implemented user workflow tests using the new faker operations for consistent test data generation
- Modified existing user tests to use
ctx.op(faker::ops::user::Input {})
instead ofop!([ctx] faker_user {})
- Added user registry to workflow worker setup for proper workflow integration
- Updated monolith-workflow-worker to include user workspace dependency
The changes improve test consistency and provide better infrastructure for user-related testing across the codebase.
20 file(s) reviewed, 4 comment(s)
Edit PR Review Bot Settings | Greptile
d1e1fb6
to
fa080dd
Compare
cfaabb0
to
975b507
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- remove unneeded use of compat in faker
fa080dd
to
277d41a
Compare
975b507
to
0964bef
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
Based on the provided context, I'll focus on the most recent changes that haven't been covered in previous reviews:
This PR continues the implementation of user workflow testing with the following key updates:
- Added workflow test in
/packages/services/faker/tests/user.rs
to verify basic user creation functionality - Implemented user workflow registration in
/packages/services/user/src/lib.rs
for proper workflow integration - Enhanced user workflow module in
/packages/services/user/src/workflows/user/mod.rs
with improved logging and activity tracking - Added helper functions for generating display names and IDs with proper randomization
The changes demonstrate a focus on improving test infrastructure and workflow management for user-related operations.
20 file(s) reviewed, 5 comment(s)
Edit PR Review Bot Settings | Greptile
@@ -0,0 +1 @@ | |||
pub mod user; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: ensure user module is properly documented with rustdoc comments explaining its purpose and usage
[dependencies] | ||
chirp-workflow.workspace = true | ||
user.workspace = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Dependencies look correct based on usage in tests, but consider adding util/faker as a dependency since it's used in the user tests (e.g. util::faker::email())
use chirp_workflow::prelude::*; | ||
|
||
#[workflow_test] | ||
async fn empty(ctx: TestCtx) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: function name 'empty' is not descriptive of what the test actually does
// TODO: Remove compat once ctx.workflow, ctx.subscribe exist on OpCtx | ||
let mut creation_sub = chirp_workflow::compat::subscribe::< | ||
user::workflows::user::CreateComplete, _ | ||
>(&ctx.op_ctx(), ("user_id", user_id)).await?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: subscription is created before workflow dispatch but not cleaned up if workflow dispatch fails. Consider using a try-finally pattern or RAII to ensure subscription cleanup.
.dispatch() | ||
.await?; | ||
|
||
creation_sub.next().await?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: no timeout on creation_sub.next() could potentially hang indefinitely if workflow fails silently
Changes