Sha256: cfd0a7790119fdfff126f445667d14ffb1e479896a5ad1cfbcb03665ee7e1afc

Contents?: true

Size: 1.71 KB

Versions: 65

Compression:

Stored size: 1.71 KB

Contents

require 'drb/drb'
require 'drb/acl'
RSpec::Support.require_rspec_core "bisect/utilities"

module RSpec
  module Core
    # @private
    module Bisect
      # @private
      # A DRb server that receives run results from a separate RSpec process
      # started by the bisect process.
      class Server
        def self.run
          server = new
          server.start
          yield server
        ensure
          server.stop
        end

        def capture_run_results(files_or_directories_to_run=[], expected_failures=[])
          self.expected_failures  = expected_failures
          self.files_or_directories_to_run = files_or_directories_to_run
          self.latest_run_results = nil
          run_output = yield

          if latest_run_results.nil? || latest_run_results.all_example_ids.empty?
            raise BisectFailedError.for_failed_spec_run(run_output)
          end

          latest_run_results
        end

        def start
          # Only allow remote DRb requests from this machine.
          DRb.install_acl ACL.new(%w[ deny all allow localhost allow 127.0.0.1 ])

          # We pass `nil` as the first arg to allow it to pick a DRb port.
          @drb = DRb.start_service(nil, self)
        end

        def stop
          @drb.stop_service
        end

        def drb_port
          @drb_port ||= Integer(@drb.uri[/\d+$/])
        end

        # Fetched via DRb by the BisectDRbFormatter to determine when to abort.
        attr_accessor :expected_failures

        # Set via DRb by the BisectDRbFormatter with the results of the run.
        attr_accessor :latest_run_results

        # Fetched via DRb to tell clients which files to run
        attr_accessor :files_or_directories_to_run
      end
    end
  end
end

Version data entries

65 entries across 64 versions & 16 rubygems

Version Path
logstash-output-scalyr-0.1.9 vendor/bundle/jruby/2.5.0/gems/rspec-core-3.8.2/lib/rspec/core/bisect/server.rb
logstash-output-scalyr-0.1.8 vendor/bundle/jruby/2.5.0/gems/rspec-core-3.8.2/lib/rspec/core/bisect/server.rb
logstash-output-scalyr-0.1.7 vendor/bundle/jruby/2.5.0/gems/rspec-core-3.8.2/lib/rspec/core/bisect/server.rb
logstash-output-scalyr-0.1.6 vendor/bundle/jruby/2.5.0/gems/rspec-core-3.8.2/lib/rspec/core/bisect/server.rb
logstash-output-scalyr-0.1.5 vendor/bundle/jruby/2.5.0/gems/rspec-core-3.8.2/lib/rspec/core/bisect/server.rb
logstash-output-scalyr-0.1.4 vendor/bundle/jruby/2.5.0/gems/rspec-core-3.8.2/lib/rspec/core/bisect/server.rb
logstash-output-scalyr-0.1.3 vendor/bundle/jruby/2.5.0/gems/rspec-core-3.8.2/lib/rspec/core/bisect/server.rb
logstash-output-scalyr-0.1.2 vendor/bundle/jruby/2.5.0/gems/rspec-core-3.8.2/lib/rspec/core/bisect/server.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/rspec-core-3.8.1/lib/rspec/core/bisect/server.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/rspec-core-3.8.2/lib/rspec/core/bisect/server.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/rspec-core-3.8.2/lib/rspec/core/bisect/server.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/rspec-core-3.8.2/lib/rspec/core/bisect/server.rb
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/rspec-core-3.8.2/lib/rspec/core/bisect/server.rb
cloudsmith-api-0.44.4 vendor/bundle/ruby/2.3.0/gems/rspec-core-3.8.2/lib/rspec/core/bisect/server.rb
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/rspec-core-3.8.2/lib/rspec/core/bisect/server.rb
zuora_connect_ui-0.8.2 vendor/ruby/2.6.0/gems/rspec-core-3.8.2/lib/rspec/core/bisect/server.rb
zuora_connect_ui-0.8.1 vendor/ruby/2.6.0/gems/rspec-core-3.8.2/lib/rspec/core/bisect/server.rb
zuora_connect_ui-0.8.0 vendor/ruby/2.6.0/gems/rspec-core-3.8.2/lib/rspec/core/bisect/server.rb
dadapush_client-1.0.1 vendor/bundle/ruby/2.3.0/gems/rspec-core-3.8.0/lib/rspec/core/bisect/server.rb
zuora_connect_ui-0.7.1 vendor/ruby/2.6.0/gems/rspec-core-3.8.2/lib/rspec/core/bisect/server.rb