You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: helper.rb
    path of file: ./repos/dd-trace-rb/spec/datadog/tracing/contrib/sidekiq/support
    
    the code of the file until where you have to start completion: require 'datadog/core/utils'
require 'datadog/tracing'
require 'datadog/tracing/contrib/sidekiq/client_tracer'
require 'datadog/tracing/contrib/sidekiq/server_tracer'
require 'sidekiq/testing'

RSpec.shared_context 'Sidekiq testing' do
  include SidekiqTestingConfiguration

  before { configure_sidekiq }

  let!(:empty_worker) do
    stub_const(
      'EmptyWorker',
      Class.new do
        include Sidekiq::Worker
        def perform; end
      end
   
    
  def expect_in_sidekiq_server(wait_until: nil)
    app_tempfile = Tempfile.new(['sidekiq-server-app', '.rb'])

    expect_in_fork do
      # NB: This is needed because we want to patch within a forked process.
      if Datadog::Tracing::Contrib::Sidekiq::Patcher.instance_variable_get(:@patch_only_once)
        Datadog::Tracing::Contrib::Sidekiq::Patcher
          .instance_variable_get(:@patch_only_once)
          .send(:reset_ran_once_state_for_tests)
      end

      require 'sidekiq/cli'

      configure_sidekiq

      t = Thread.new do
        cli = Sidekiq::CLI.instance
        cli.parse(['--require', app_tempfile.path, '--concurrency', '1']) # boot the "app"

        # Sidekiq waits between 5-15 seconds, and we cannot reduce it to less
        # than 5 seconds through configuration alone.
        # @see https://github.com/sidekiq/sidekiq/blob/fcc9406c02b809d18af419e164a8840630d60d23/lib/sidekiq/scheduled.rb#L219-L224
        #
        # Instead, we override the `#initial_wait` method to ensure it does not wait 5+ seconds.
        #
        # This is an `expect` instead of an `allow` because if Sidekiq's `#initial_wait`
        # logic moves somewhere else, the failure will be an obscure timeout error without
        # this assertion.
        expect_any_instance_of(Sidekiq::Scheduled::Poller).to receive(:initial_wait)

        cli.run
      end

      try_wait_until(seconds: 10) { wait_until.call } if wait_until

      Thread.kill(t)

      yield
    end
  ensure
    app_tempfile.close
    app_tempfile.unlink
  end