File: utils.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 (26 lines) | stat: -rw-r--r-- 464 bytes parent folder | download | duplicates (3)
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
def assert(text, actual, expected)
  if actual == expected
    puts "#{text}: #{actual} (Success)"
  else
    puts "#{text}: #{actual} (Failed). Expected: #{expected}"
    exit 1
  end
end

def spawn_workers(number)
  pids = []

  number.times do
    pids << spawn('sidekiq -q default -q high -q low -r ./config.rb')
  end

  pids
end

# Stop Sidekiq workers
def stop_workers(pids)
  pids.each do |pid|
    Process.kill('KILL', pid)
    Process.wait pid
  end
end