-
Notifications
You must be signed in to change notification settings - Fork 89
/
delete_schedule_spec.rb
50 lines (42 loc) · 1.54 KB
/
delete_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
45
46
47
48
49
50
require "temporal/errors"
require "temporal/schedule/schedule"
require "temporal/schedule/schedule_spec"
require "temporal/schedule/start_workflow_action"
describe "Temporal.delete_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 delete schedules" 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.action.start_workflow.workflow_type.name).to(eq("HelloWorldWorkflow"))
Temporal.delete_schedule(namespace, schedule_id)
# Now that the schedule is delted it should raise a not found error
expect do
Temporal.describe_schedule(namespace, schedule_id)
end
.to(raise_error(Temporal::NotFoundFailure))
end
it "raises a NotFoundFailure if a schedule doesn't exist" do
namespace = integration_spec_namespace
expect do
Temporal.delete_schedule(namespace, "some-invalid-schedule-id")
end
.to(raise_error(Temporal::NotFoundFailure))
end
end