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

timeskipping server works #331

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@ PROTO_ROOT := proto
PROTO_FILES = $(shell find $(PROTO_ROOT) -name "*.proto")
PROTO_DIRS = $(sort $(dir $(PROTO_FILES)))
PROTO_OUT := lib/gen
PROTO_TESTING_ROOT := lib/temporal/testing/proto
PROTO_TESTING_FILES = $(shell find $(PROTO_TESTING_ROOT) -name "*.proto")
PROTO_TESTING_DIRS = $(sort $(dir $(PROTO_TESTING_FILES)))

proto:
$(foreach PROTO_DIR,$(PROTO_DIRS),bundle exec grpc_tools_ruby_protoc -Iproto --ruby_out=$(PROTO_OUT) --grpc_out=$(PROTO_OUT) $(PROTO_DIR)*.proto;)

.PHONY: proto
proto-testing:
$(foreach PROTO_DIR,$(PROTO_TESTING_DIRS),bundle exec grpc_tools_ruby_protoc --proto_path="lib/temporal/testing/proto" --ruby_out=$(PROTO_OUT) --grpc_out=$(PROTO_OUT) $(PROTO_DIR)*.proto;)

.PHONY: proto, proto-testing
10 changes: 6 additions & 4 deletions lib/gen/dependencies/gogoproto/gogo_pb.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions lib/gen/temporal/api/testservice/v1/request_response_pb.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions lib/gen/temporal/api/testservice/v1/service_pb.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

91 changes: 91 additions & 0 deletions lib/gen/temporal/api/testservice/v1/service_services_pb.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions lib/temporal/testing/client.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# frozen_string_literal: true
module Temporal
module Testing
# TestingClient expects the java `temporal-test-server` to be running and to have been
# enabled with timeskipping with
# `./temporal-test-server {port} --enable-time-skipping`
class Client < Temporal::Client
def initialize(config = {})
super(config)
@timeskipping_connection = Connection.new(config.host, config.port)
end

def sleep(duration)
@timeskipping_connection.unlock_time_skipping_with_sleep(duration)
end

def await_workflow_result(workflow, workflow_id:, run_id: nil, timeout: nil, namespace: nil)
begin
# WorkflowTaskTimeout seems to happen with this SDK so sleep as workaround
sleep(0.25)
@timeskipping_connection.unlock_time_skipping
super
ensure
@timeskipping_connection.lock_time_skipping
end
end
end
end

end
Loading