worker_spec.rb revision a9a53dbe70810d1bf7d91ed2af86dd6d39a13124
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
51
52
53
54
55
b7de308d8bc28d42249256bddb16bbace71f60favboxsyncrequire 'spec_helper'
5b281ba489ca18f0380d7efc7a5108b606cce449vboxsync# We try to be explicit when using sidekiq
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync# testing modes. However inline! is the default
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync let(:ontology) { create :single_unparsed_ontology, locid: '/test/sequential_parse' }
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync rescue ConcurrencyBalancer::UnmarkedProcessingError
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync balancer.mark_as_processing_or_complain(ontology.iri)
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync OntologyVersion.any_instance.stubs(:raw_path!).returns(
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync context 'exceeding the parallel try count of an already marked iri job' do
cf57145d4697dceca3f0542b370c20f7a2c5c6e8vboxsync it 'should put the correct job in the sequential queue' do
cf57145d4697dceca3f0542b370c20f7a2c5c6e8vboxsync rest_args = ['record', OntologyVersion.to_s, 'parse', version.id]
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync *rest_args, try_count: ConcurrencyBalancer::MAX_TRIES)
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync expect(SequentialWorker.jobs.first['args']).to eq([*rest_args])
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync context 'not exceeding the parallel try count of an already marked iri job' do
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync it 'should put the correct job in the queue once again' do
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync rest_args = ['record', OntologyVersion.to_s, 'parse', version.id]
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync *rest_args, try_count: ConcurrencyBalancer::MAX_TRIES-1)
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync *rest_args, "try_count" => ConcurrencyBalancer::MAX_TRIES])