-
Notifications
You must be signed in to change notification settings - Fork 86
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
Expose count_workflow_executions on the temporal client #272
Changes from 2 commits
09eca23
f8dd685
17660a3
be52fa7
35bad5d
29e7b78
cbf1008
3239f9a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module Temporal | ||
class Workflow | ||
class CountWorkflowAggregation | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ooc, why "Aggregation" as the suffix instead of a more neutral "Result" or "Response"? Does aggregation mean it is aggregating all of the fields in the |
||
def initialize(count:) | ||
@count = count | ||
end | ||
|
||
attr_reader :count | ||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1102,4 +1102,28 @@ class NamespacedWorkflow < Temporal::Workflow | |
end | ||
end | ||
end | ||
|
||
describe '#count_workflow_executions' do | ||
let(:response) do | ||
Temporalio::Api::WorkflowService::V1::CountWorkflowExecutionsResponse.new( | ||
count: 5 | ||
) | ||
end | ||
|
||
before do | ||
allow(connection) | ||
.to receive(:count_workflow_executions) | ||
.and_return(response) | ||
end | ||
|
||
it 'returns the count' do | ||
resp = subject.count_workflow_executions(namespace, '') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: having a non-empty query makes the test slightly more realistic (at least I don't think an empty query works on the real server) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Believe it or not, an empty query does work on the real server (see slack), but I've gone ahead and modified the test to be more realistic (there's very few scenarios during which you'd do an empty query). |
||
|
||
expect(connection) | ||
.to have_received(:count_workflow_executions) | ||
.with(namespace: namespace, query: '') | ||
|
||
expect(resp.count).to eq(5) | ||
end | ||
end | ||
end |
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.
it would be nice to have a short doc-comment with the types of the parameters/return value (even if it isn't enforced without Sorbet, and in this case the types are fairly trivial). I know a lot of the other methods don't have it, but I'm putting my type evangelist hat on 🤠.