-
Notifications
You must be signed in to change notification settings - Fork 89
/
pause_schedule_spec.rb
44 lines (37 loc) · 1.48 KB
/
pause_schedule_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
require "temporal/schedule/schedule"
require "temporal/schedule/calendar"
require "temporal/schedule/schedule_spec"
require "temporal/schedule/schedule_policies"
require "temporal/schedule/schedule_state"
require "temporal/schedule/start_workflow_action"
describe "Temporal.pause_schedule", :integration do
let(:example_schedule) do
Temporal::Schedule::Schedule.new(
spec: Temporal::Schedule::ScheduleSpec.new(
cron_expressions: ["@hourly"],
# Set an end time so that the test schedule doesn't run forever
end_time: Time.now + 600
),
action: Temporal::Schedule::StartWorkflowAction.new(
"HelloWorldWorkflow",
"Test",
options: {
task_queue: integration_spec_task_queue
}
)
)
end
it "can pause and unpause a schedule" do
namespace = integration_spec_namespace
schedule_id = SecureRandom.uuid
Temporal.create_schedule(namespace, schedule_id, example_schedule)
describe_response = Temporal.describe_schedule(namespace, schedule_id)
expect(describe_response.schedule.state.paused).to(eq(false))
Temporal.pause_schedule(namespace, schedule_id)
describe_response = Temporal.describe_schedule(namespace, schedule_id)
expect(describe_response.schedule.state.paused).to(eq(true))
Temporal.unpause_schedule(namespace, schedule_id)
describe_response = Temporal.describe_schedule(namespace, schedule_id)
expect(describe_response.schedule.state.paused).to(eq(false))
end
end