Files
ubicloud/spec/prog/page_nexus_spec.rb
Enes Cakir 6944422dff Nap 6 hours while waiting for the semaphore to increase
When we increase the semaphore, we have already scheduled the strand for
now.

If the label is just waiting for the semaphore to increase, there's no
need for short naps.

Most of our wait labels are just waiting for the semaphore to increase,
so I extended their naps to 6 hours.

It will help decrease the load on the respirate on production

[^1]: 28dacb968b/model/semaphore.rb (L10)
2025-03-24 09:10:18 +03:00

34 lines
737 B
Ruby

# frozen_string_literal: true
require_relative "../model/spec_helper"
RSpec.describe Prog::PageNexus do
subject(:pn) {
described_class.new(Strand.new).tap {
_1.instance_variable_set(:@page, pg)
}
}
let(:pg) { Page.new }
describe "#start" do
it "triggers page and hops" do
expect(pg).to receive(:trigger)
expect { pn.start }.to hop("wait")
end
end
describe "#wait" do
it "exits when resolved" do
expect(pn).to receive(:when_resolve_set?).and_yield
expect(pg).to receive(:resolve)
expect(pg).to receive(:destroy)
expect { pn.wait }.to exit({"msg" => "page is resolved"})
end
it "naps" do
expect { pn.wait }.to nap(6 * 60 * 60)
end
end
end