Skip to content

Commit 7a21947

Browse files
committed
lint fixes and test skip on certain envs
1 parent 8215915 commit 7a21947

3 files changed

Lines changed: 48 additions & 42 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# frozen_string_literal: true
2+
3+
require 'test'
4+
require 'securerandom'
5+
require 'temporalio/testing'
6+
require 'temporalio/worker'
7+
require 'polling/infrequent/greeting_workflow'
8+
require 'polling/infrequent/compose_greeting_activity'
9+
require 'polling/infrequent/test_service'
10+
11+
module Polling
12+
module Infrequent
13+
class GreetingWorkflowTest < Test
14+
def test_workflow_completes_after_polling
15+
skip_if_not_x86!
16+
task_queue = "tq-#{SecureRandom.uuid}"
17+
18+
Temporalio::Testing::WorkflowEnvironment.start_time_skipping do |env|
19+
worker = Temporalio::Worker.new(
20+
client: env.client,
21+
task_queue: task_queue,
22+
activities: [Polling::Infrequent::ComposeGreetingActivity],
23+
workflows: [Polling::Infrequent::GreetingWorkflow]
24+
)
25+
26+
handle = env.client.start_workflow(
27+
Polling::Infrequent::GreetingWorkflow,
28+
'Temporal',
29+
id: "wf-#{SecureRandom.uuid}",
30+
task_queue: task_queue
31+
)
32+
33+
worker.run do
34+
# Advance time forward to allow for the 4 retries (4 * 60s) plus a buffer
35+
env.sleep(241)
36+
37+
# Wait for the workflow to complete and assert its result
38+
result = handle.result
39+
assert_equal('Hello, Temporal!', result)
40+
end
41+
end
42+
end
43+
end
44+
end
45+
end

test/polling/infrequent_polling_test.rb

Lines changed: 0 additions & 42 deletions
This file was deleted.

test/test.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@
33
require 'minitest/autorun'
44

55
class Test < Minitest::Test
6+
def skip_if_not_x86!
7+
skip('Test only supported on x86') unless RbConfig::CONFIG['host_cpu'] == 'x86_64'
8+
end
69
end

0 commit comments

Comments
 (0)