File: test_term_signal.rb

package info (click to toggle)
ruby-gitlab-sidekiq-fetcher 0.9.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 204 kB
  • sloc: ruby: 760; makefile: 3
file content (25 lines) | stat: -rwxr-xr-x 577 bytes parent folder | download | duplicates (4)
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
# frozen_string_literal: true

require 'sidekiq'
require_relative 'config'
require_relative '../support/utils'

EXPECTED_NUM_TIMES_BEEN_RUN = 3
NUM_WORKERS = EXPECTED_NUM_TIMES_BEEN_RUN + 1

Sidekiq.redis(&:flushdb)

pids = spawn_workers(NUM_WORKERS)

RetryTestWorker.perform_async('TERM', 60)

sleep 300

Sidekiq.redis do |redis|
  times_has_been_run = redis.get('times_has_been_run').to_i
  assert 'The job has been run', times_has_been_run, EXPECTED_NUM_TIMES_BEEN_RUN
end

assert 'Found interruption exhausted jobs', Sidekiq::InterruptedSet.new.size, 1

stop_workers(pids)