Skip to content
Merged
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
15 changes: 13 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ jobs:
# Secrets are unavailable to workflows from forks.
if: ${{ (github.event.pull_request.head.repo.full_name == '' || github.event.pull_request.head.repo.full_name == 'temporalio/sdk-ruby') && github.actor != 'dependabot[bot]' }}
runs-on: ubuntu-latest
timeout-minutes: 45
timeout-minutes: 20
Comment thread
THardy98 marked this conversation as resolved.
env:
TEMPORAL_TEST_ENV_CONFIG_SERVER: "1"
TEMPORAL_CLIENT_CLOUD_API_VERSION: v0.19.1
Expand Down Expand Up @@ -241,7 +241,9 @@ jobs:
env:
TEMPORAL_ADDRESS: ${{ steps.create-cloud-namespace.outputs.namespace }}.tmprl.cloud:7233
TEMPORAL_NAMESPACE: ${{ steps.create-cloud-namespace.outputs.namespace }}
run: bundle exec rake test TEST=test/worker_workflow_test.rb TESTOPTS="--name=/WorkerWorkflowTest#test_simple/"
run: |
mkdir -p tmp
TESTOPTS="--verbose" bundle exec rake test:cloud 2>&1 | tee tmp/cloud-test.log

- name: Delete Cloud namespace
id: delete-cloud-namespace
Expand All @@ -255,3 +257,12 @@ jobs:
- name: Report Cloud namespace cleanup failure
if: ${{ always() && steps.delete-cloud-namespace.outcome == 'failure' }}
run: echo "::warning title=Cloud namespace cleanup failed::Failed to delete Cloud namespace ${{ steps.create-cloud-namespace.outputs.namespace }}"

- name: Upload Cloud test output
if: ${{ always() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: cloud-test-${{ github.run_id }}-${{ github.run_attempt }}
path: temporalio/tmp/cloud-test.log
if-no-files-found: warn
retention-days: 14
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1491,6 +1491,14 @@ E.g. show all test names while executing:

bundle exec rake test TESTOPTS="--verbose"

To list source tests excluded from Cloud, grouped by reason and note:

bundle exec rake test:cloud_inventory

To run the Cloud-eligible suite against an envconfig-defined server:

bundle exec rake test:cloud

### Code Formatting and Type Checking

This project uses `rubocop`:
Expand Down
19 changes: 19 additions & 0 deletions temporalio/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,25 @@ Rake::TestTask.new(:test) do |t|
t.test_files = FileList['test/**/*_test.rb', 'extra/release/test/**/*_test.rb']
end

namespace :test do
desc 'List tests excluded from Temporal Cloud by reason'
task :cloud_inventory do
ENV['TESTOPTS'] = [
ENV.fetch('TESTOPTS', nil),
'--cloud-inventory',
'--name=/CloudTestInventoryTest#test_report/'
].compact.join(' ')
Rake::Task[:test].invoke
end

desc 'Run tests eligible for Temporal Cloud using envconfig'
task :cloud do
ENV['TEMPORAL_TEST_ENV_CONFIG_SERVER'] = '1'
ENV['TESTOPTS'] = [ENV.fetch('TESTOPTS', nil), '--cloud'].compact.join(' ')
Rake::Task[:test].invoke
end
end

require 'rubocop/rake_task'

RuboCop::RakeTask.new
Expand Down
14 changes: 14 additions & 0 deletions temporalio/test/client_activity_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,8 @@ def test_start_activity_rejects_negative_start_delay
assert_match(/start_delay must be non-negative/i, err.message)
end

exclude_from_cloud :requires_cloud_provisioning,
'Requires Standalone Activity start delay to be enabled in the Cloud namespace.'
def test_start_activity_with_start_delay_dispatches_after_delay
delay = 2.0
with_activity_worker([SimpleActivity]) do |task_queue|
Expand All @@ -763,6 +765,8 @@ def test_start_activity_with_start_delay_dispatches_after_delay
end
end

exclude_from_cloud :requires_cloud_provisioning,
'Requires Standalone Activity start delay to be enabled in the Cloud namespace.'
def test_start_activity_with_zero_start_delay_dispatches_immediately
# start_delay: 0 means no delay (proto-3 default for an unset Duration); activity
# behaves exactly like one started without a start_delay kwarg.
Expand All @@ -783,6 +787,8 @@ def test_start_activity_with_zero_start_delay_dispatches_immediately
end
end

exclude_from_cloud :requires_cloud_provisioning,
'Requires Standalone Activity start delay to be enabled in the Cloud namespace.'
def test_start_activity_with_nil_start_delay_dispatches_immediately
# Explicit nil should be indistinguishable from omitting the kwarg.
with_activity_worker([SimpleActivity]) do |task_queue|
Expand All @@ -802,6 +808,8 @@ def test_start_activity_with_nil_start_delay_dispatches_immediately
end
end

exclude_from_cloud :requires_cloud_provisioning,
'Requires Standalone Activity start delay to be enabled in the Cloud namespace.'
def test_cancel_during_start_delay_transitions_to_canceled_immediately
with_activity_worker([SimpleActivity]) do |task_queue|
handle = env.client.start_activity(
Expand All @@ -818,6 +826,8 @@ def test_cancel_during_start_delay_transitions_to_canceled_immediately
end
end

exclude_from_cloud :requires_cloud_provisioning,
'Requires Standalone Activity start delay to be enabled in the Cloud namespace.'
def test_terminate_during_start_delay_transitions_to_terminated_immediately
with_activity_worker([SimpleActivity]) do |task_queue|
handle = env.client.start_activity(
Expand All @@ -834,6 +844,8 @@ def test_terminate_during_start_delay_transitions_to_terminated_immediately
end
end

exclude_from_cloud :requires_cloud_provisioning,
'Requires Standalone Activity start delay to be enabled in the Cloud namespace.'
def test_start_delay_extends_schedule_to_start_timeout
# schedule_to_start_timeout (0.5s) is shorter than start_delay (1.0s), and would fire if it
# were not properly delayed by start_delay.
Expand All @@ -850,6 +862,8 @@ def test_start_delay_extends_schedule_to_start_timeout
end
end

exclude_from_cloud :requires_cloud_provisioning,
'Requires Standalone Activity start delay to be enabled in the Cloud namespace.'
def test_start_delay_extends_schedule_to_close_timeout
# schedule_to_start_timeout (0.5s) is shorter than start_delay (1.0s), and would fire if it
# were not properly delayed by start_delay.
Expand Down
3 changes: 3 additions & 0 deletions temporalio/test/client_cloud_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
require 'test'

class ClientCloudTest < Test
exclude_class_from_cloud :requires_cloud_provisioning,
'Requires separately provisioned Cloud credentials and operations permissions.'

class SimpleWorkflow < Temporalio::Workflow::Definition
def execute(name)
"Hello, #{name}!"
Expand Down
6 changes: 6 additions & 0 deletions temporalio/test/client_schedule_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
class ClientScheduleTest < Test
also_run_all_tests_in_fiber

exclude_from_cloud :needs_cloud_adaptation,
'Requires custom search attributes and immediately consistent schedule visibility.'
def test_basics # rubocop:disable Metrics/AbcSize
expected_ids = []
assert_no_schedules
Expand Down Expand Up @@ -265,6 +267,8 @@ def test_calendar_spec_defaults
delete_schedules(handle.id) if handle
end

exclude_from_cloud :needs_cloud_adaptation,
'The Go kitchen-sink worker does not receive Cloud TLS configuration.'
def test_trigger_immediately
assert_no_schedules

Expand Down Expand Up @@ -296,6 +300,8 @@ def test_trigger_immediately
delete_schedules(handle.id) if handle
end

exclude_from_cloud :needs_cloud_adaptation,
'Relies on backfill action counts becoming immediately consistent.'
def test_backfill
assert_no_schedules

Expand Down
10 changes: 6 additions & 4 deletions temporalio/test/client_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ def test_version_number
assert !Temporalio::VERSION.nil?
end

exclude_from_cloud :needs_cloud_adaptation,
'The Go kitchen-sink worker does not receive Cloud TLS configuration.'
def test_lazy_connection
assert env.client.connection.connected?
client = Temporalio::Client.connect(env.client.connection.target_host, env.client.namespace, lazy_connect: true)
client = env.reconnect_client(lazy_connect: true)
refute client.connection.connected?
env.with_kitchen_sink_worker(client) do |task_queue|
result = client.execute_workflow(
Expand Down Expand Up @@ -140,6 +142,8 @@ def terminate_workflow(input)
end
end

exclude_from_cloud :needs_cloud_adaptation,
'The Go kitchen-sink worker does not receive Cloud TLS configuration.'
def test_interceptor
# Create client with interceptor
track = TrackCallsInterceptor.new
Expand Down Expand Up @@ -285,9 +289,7 @@ def test_fork
reader, writer = IO.pipe
pid = fork do
reader.close
client = Temporalio::Client.connect(
env.client.options.connection.target_host,
env.client.options.namespace,
client = env.reconnect_client(
runtime: Temporalio::Runtime.new,
logger: Logger.new($stdout)
)
Expand Down
38 changes: 33 additions & 5 deletions temporalio/test/client_workflow_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
class ClientWorkflowTest < Test
also_run_all_tests_in_fiber

exclude_from_cloud :needs_cloud_adaptation,
'The Go kitchen-sink worker does not receive Cloud TLS configuration.'
def test_start_simple
# Create ephemeral test server
env.with_kitchen_sink_worker do |task_queue|
Expand All @@ -26,6 +28,8 @@ def test_start_simple
end
end

exclude_from_cloud :needs_cloud_adaptation,
'The Go kitchen-sink worker does not receive Cloud TLS configuration.'
def test_result_preserves_fiber_local_context_for_history_rpc
context_key = :temporalio_test_result_context
context = :my_context
Expand Down Expand Up @@ -55,6 +59,8 @@ def test_result_preserves_fiber_local_context_for_history_rpc
Thread.current[context_key] = previous_context
end

exclude_from_cloud :needs_cloud_adaptation,
'The Go kitchen-sink worker does not receive Cloud TLS configuration.'
def test_workflow_exists
env.with_kitchen_sink_worker do |task_queue|
# Create a workflow that hangs
Expand Down Expand Up @@ -105,11 +111,7 @@ def test_workflow_exists
end

def test_lazy_connect
client = Temporalio::Client.connect(
env.client.connection.target_host,
env.client.namespace,
lazy_connect: true
)
client = env.reconnect_client(lazy_connect: true)
# Not connected until we do something
refute client.connection.connected?
client.start_workflow(
Expand All @@ -120,6 +122,8 @@ def test_lazy_connect
assert client.connection.connected?
end

exclude_from_cloud :needs_cloud_adaptation,
'Requires custom search attributes and a Go worker with Cloud TLS configuration.'
def test_describe
# Make sure all keys on server
env.ensure_common_search_attribute_keys
Expand Down Expand Up @@ -174,6 +178,8 @@ def test_describe
end
end

exclude_from_cloud :needs_cloud_adaptation,
'The Go kitchen-sink worker does not receive Cloud TLS configuration.'
def test_start_delay
env.with_kitchen_sink_worker do |task_queue|
handle = env.client.start_workflow(
Expand All @@ -194,6 +200,8 @@ def test_start_delay
end
end

exclude_from_cloud :needs_cloud_adaptation,
'The Go kitchen-sink worker does not receive Cloud TLS configuration.'
def test_failure
env.with_kitchen_sink_worker do |task_queue|
# Simple error
Expand Down Expand Up @@ -226,6 +234,8 @@ def test_failure
end
end

exclude_from_cloud :needs_cloud_adaptation,
'The Go kitchen-sink worker does not receive Cloud TLS configuration.'
def test_retry_policy
env.with_kitchen_sink_worker do |task_queue|
err = assert_raises(Temporalio::Error::WorkflowFailedError) do
Expand All @@ -245,6 +255,8 @@ def test_retry_policy
end
end

exclude_from_cloud :needs_cloud_adaptation,
'Requires custom search attributes, consistent visibility, and Go worker Cloud TLS.'
def test_list_and_count
# Make sure all keys on server
env.ensure_common_search_attribute_keys
Expand Down Expand Up @@ -325,6 +337,8 @@ def test_list_and_count
end
end

exclude_from_cloud :needs_cloud_adaptation,
'The Go kitchen-sink worker does not receive Cloud TLS configuration.'
def test_continue_as_new
env.with_kitchen_sink_worker do |task_queue|
handle = env.client.start_workflow(
Expand Down Expand Up @@ -354,6 +368,8 @@ def test_not_found
assert_equal Temporalio::Error::RPCError::Code::NOT_FOUND, err.code
end

exclude_from_cloud :needs_cloud_adaptation,
'The Go kitchen-sink worker does not receive Cloud TLS configuration.'
def test_config_change
env.with_kitchen_sink_worker do |task_queue|
# Regular query works
Expand All @@ -378,6 +394,8 @@ def test_config_change
end
end

exclude_from_cloud :needs_cloud_adaptation,
'The Go kitchen-sink worker does not receive Cloud TLS configuration.'
def test_signal
env.with_kitchen_sink_worker do |task_queue|
handle = env.client.start_workflow(
Expand All @@ -391,6 +409,8 @@ def test_signal
end
end

exclude_from_cloud :needs_cloud_adaptation,
'The Go kitchen-sink worker does not receive Cloud TLS configuration.'
def test_query
env.with_kitchen_sink_worker do |task_queue|
handle = env.client.start_workflow(
Expand All @@ -417,6 +437,8 @@ def test_query
end
end

exclude_from_cloud :needs_cloud_adaptation,
'The Go kitchen-sink worker does not receive Cloud TLS configuration.'
def test_update
env.with_kitchen_sink_worker do |task_queue|
handle = env.client.start_workflow(
Expand Down Expand Up @@ -466,6 +488,8 @@ def test_update
end
end

exclude_from_cloud :needs_cloud_adaptation,
'The Go kitchen-sink worker does not receive Cloud TLS configuration.'
def test_cancel
env.with_kitchen_sink_worker do |task_queue|
handle = env.client.start_workflow(
Expand All @@ -482,6 +506,8 @@ def test_cancel
end
end

exclude_from_cloud :needs_cloud_adaptation,
'The Go kitchen-sink worker does not receive Cloud TLS configuration.'
def test_terminate
env.with_kitchen_sink_worker do |task_queue|
handle = env.client.start_workflow(
Expand All @@ -500,6 +526,8 @@ def test_terminate
end
end

exclude_from_cloud :needs_cloud_adaptation,
'The Go kitchen-sink worker does not receive Cloud TLS configuration.'
def test_rpc_cancellation
# Start a workflow, create cancellation, cancel after 500ms in background,
# wait on complete
Expand Down
Loading
Loading