Sha256: 2ed3f7d7dbf63d659f8125f26ca007c8d2aced0a916238428d2a274727087660

Contents?: true

Size: 1.72 KB

Versions: 6826

Compression:

Stored size: 1.72 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 allow ::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

6,826 entries across 6,770 versions & 75 rubygems

Version Path
mux_ruby-3.20.0 vendor/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/bisect/server.rb
cybrid_api_bank_ruby-0.123.12 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/bisect/server.rb
cybrid_api_organization_ruby-0.123.12 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/bisect/server.rb
cybrid_api_id_ruby-0.123.12 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/bisect/server.rb
cybrid_api_bank_ruby-0.123.11 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/bisect/server.rb
cybrid_api_organization_ruby-0.123.11 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/bisect/server.rb
cybrid_api_id_ruby-0.123.11 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/bisect/server.rb
cybrid_api_id_ruby-0.123.10 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/bisect/server.rb
cybrid_api_bank_ruby-0.123.10 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/bisect/server.rb
cybrid_api_organization_ruby-0.123.10 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/bisect/server.rb
cybrid_api_organization_ruby-0.123.7 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/bisect/server.rb
cybrid_api_id_ruby-0.123.7 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/bisect/server.rb
cybrid_api_bank_ruby-0.123.7 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/bisect/server.rb
ory-client-1.15.12 vendor/bundle/ruby/3.1.0/gems/rspec-core-3.13.2/lib/rspec/core/bisect/server.rb
cybrid_api_bank_ruby-0.123.4 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/bisect/server.rb
cybrid_api_id_ruby-0.123.4 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/bisect/server.rb
cybrid_api_organization_ruby-0.123.4 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/bisect/server.rb
cybrid_api_bank_ruby-0.123.3 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/bisect/server.rb
cybrid_api_organization_ruby-0.123.3 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/bisect/server.rb
cybrid_api_id_ruby-0.123.3 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/bisect/server.rb