Skip to content

Commit 42cacf5

Browse files
fix(test): fix activity info test to avoid type error
1 parent 4b5d8ba commit 42cacf5

2 files changed

Lines changed: 24 additions & 20 deletions

File tree

temporalio/test/support/sig_applicator.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,10 @@ def configure_error_handler!
107107

108108
return if IGNORED_ERRORS.any? { |pattern| message.include?(pattern) }
109109

110-
SigApplicator.record_type_error(message)
110+
# Include location for debugging
111+
location = opts[:location]
112+
full = location ? "#{message}\n Location: #{location}" : message
113+
SigApplicator.record_type_error(full)
111114
end
112115
end
113116

@@ -124,8 +127,7 @@ def register_summary_hook!
124127
unique = errors.tally
125128
summary = "SigApplicator: #{errors.size} runtime type errors detected (#{unique.size} unique):\n"
126129
unique.sort_by { |_, count| -count }.each do |msg, count|
127-
short = msg.lines.first&.chomp || msg
128-
summary << " [#{count}x] #{short}\n"
130+
summary << " [#{count}x] #{msg}\n"
129131
end
130132
flunk summary
131133
end

temporalio/test/worker_activity_test.rb

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -257,24 +257,26 @@ def execute
257257
end
258258

259259
def test_info
260+
# The hash is round-tripped through the data converter so non-primitive
261+
# values (Time, RetryPolicy) are serialized to strings. Use string keys
262+
# from the deserialized JSON to check values directly.
260263
info_hash = execute_activity(InfoActivity)
261-
info = Temporalio::Activity::Info.new(**info_hash) # steep:ignore
262-
refute_nil info.activity_id
263-
assert_equal 'InfoActivity', info.activity_type
264-
assert_equal 1, info.attempt
265-
refute_nil info.current_attempt_scheduled_time
266-
assert_equal false, info.local?
267-
refute_nil info.retry_policy
268-
refute_nil info.schedule_to_close_timeout
269-
refute_nil info.scheduled_time
270-
refute_nil info.start_to_close_timeout
271-
refute_nil info.started_time
272-
refute_nil info.task_queue
273-
refute_nil info.task_token
274-
refute_nil info.workflow_id
275-
assert_equal env.client.namespace, info.workflow_namespace
276-
refute_nil info.workflow_run_id
277-
assert_equal 'kitchen_sink', info.workflow_type
264+
refute_nil info_hash['activity_id']
265+
assert_equal 'InfoActivity', info_hash['activity_type']
266+
assert_equal 1, info_hash['attempt']
267+
refute_nil info_hash['current_attempt_scheduled_time']
268+
assert_equal false, info_hash['local?']
269+
refute_nil info_hash['retry_policy']
270+
refute_nil info_hash['schedule_to_close_timeout']
271+
refute_nil info_hash['scheduled_time']
272+
refute_nil info_hash['start_to_close_timeout']
273+
refute_nil info_hash['started_time']
274+
refute_nil info_hash['task_queue']
275+
refute_nil info_hash['task_token']
276+
refute_nil info_hash['workflow_id']
277+
assert_equal env.client.namespace, info_hash['workflow_namespace']
278+
refute_nil info_hash['workflow_run_id']
279+
assert_equal 'kitchen_sink', info_hash['workflow_type']
278280
end
279281

280282
class CancellationActivity < Temporalio::Activity::Definition

0 commit comments

Comments
 (0)