Sha256: 1031b52b9ec9404fd985ef8140a05b70bf9116b18718864494c3de44e5e7c693

Contents?: true

Size: 1001 Bytes

Versions: 15

Compression:

Stored size: 1001 Bytes

Contents

# (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2017

require 'sidekiq/launcher'
require 'sidekiq/cli'
require 'sidekiq/api'
require 'sidekiq/processor'

require_relative 'jobs/sidekiq_job_1'
require_relative 'jobs/sidekiq_job_2'

::Instana.logger.info "Booting instrumented sidekiq worker for tests."
::Sidekiq.logger.level = ::Logger::FATAL

sidekiq_version = Gem::Specification.find_by_name('sidekiq').version
cli = ::Sidekiq::CLI.instance
cli.parse(['sidekiq', '-r', __FILE__, '-C', "#{File.dirname(__FILE__)}/config.yaml"])

config_or_options = if sidekiq_version >= Gem::Version.new('6.5.0')
                      cli.config
                    else
                      cli.send :options
                    end

sidekiq_thread = Thread.new do
  launcher = ::Sidekiq::Launcher.new(
    config_or_options
  )
  launcher.run
  Thread.current[:worker] = launcher
end

Minitest.after_run do
  ::Instana.logger.info "Killing Sidekiq worker"
  sidekiq_thread[:worker].stop
  sleep 1
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
instana-1.217.1 test/support/apps/sidekiq/worker.rb
instana-1.217.0 test/support/apps/sidekiq/worker.rb
instana-1.216.0 test/support/apps/sidekiq/worker.rb
instana-1.215.1 test/support/apps/sidekiq/worker.rb
instana-1.215.0 test/support/apps/sidekiq/worker.rb
instana-1.214.4 test/support/apps/sidekiq/worker.rb
instana-1.214.3 test/support/apps/sidekiq/worker.rb
instana-1.214.2 test/support/apps/sidekiq/worker.rb
instana-1.214.1 test/support/apps/sidekiq/worker.rb
instana-1.214.0 test/support/apps/sidekiq/worker.rb
instana-1.213.3 test/support/apps/sidekiq/worker.rb
instana-1.213.2 test/support/apps/sidekiq/worker.rb
instana-1.213.1 test/support/apps/sidekiq/worker.rb
instana-1.213.0 test/support/apps/sidekiq/worker.rb
instana-1.212.0 test/support/apps/sidekiq/worker.rb