Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-2466

Remove `rake spec:prepare` requirement from test suite run

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Tests
    • None
    • Environment:
      Fedora 34 (rawhide = development version) build system Koji.
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      I am seeing the following error on latest 2.14-stable 0f54fd4f14144884d24614c4626f63518ff5d1a1 when running spec.

      It is only happens when running the spec on the build system's build where starting the mongo server and running spec are executed by a script. It might be specific environment. The issue does not happen when running on the interactive mode manually.

      An error occurred in an `after(:context)` hook.
      Failure/Error: raise "Deployment server version not known - check that connection to deployment succeeded"
      RuntimeError:
        Deployment server version not known - check that connection to deployment succeeded
      # ./spec/support/cluster_config.rb:42:in `fcv_ish'
      # ./spec/stress/connection_pool_timing_spec.rb:17:in `block (2 levels) in <top (required)>'
      

      It seems that this error happens on the following part when @server_version is nil.

      spec/support/cluster_config.rb

      ...
        def server_version
          determine_cluster_config
          @server_version
        end
      ...
        def fcv_ish
          if server_version.nil?
            raise "Deployment server version not known - check that connection to deployment succeeded"
          end 
      ...
      

      There is a logic @server_version to be set on the following part.

      spec/support/cluster_config.rb

      ...
        def determine_cluster_config
      ...
          @single_server = client.cluster.servers_list.length == 1
      
          build_info = client.database.command(buildInfo: 1).first
      
          @server_version = build_info['version']
      ...
      

      Interestingly the line build_info = client.database.command(buildInfo: 1).first raises an error. As a result the line @server_version = build_info['version'] is not executed.

      Checking the command method, I see the following warning, and

      p "[DEBUG] lib/mongo/database.rb command end result: #{result}"
      

      is not executed.

      lib/mongo/database.rb

          def command(operation, opts = {}) 
            p "[DEBUG] lib/mongo/database.rb command start"
            opts = opts.dup
      ...
            result = client.send(:with_session, opts) do |session|
              server = selector.select_server(cluster, nil, session)
              op = Operation::Command.new(
                :selector => operation.dup,
                :db_name => name,
                :read => selector,
                :session => session
              )
      
              op.execute(server, client: client, options: execution_opts)
            end
            p "[DEBUG] lib/mongo/database.rb command end result: #{result}"
            result
      
      "[DEBUG] lib/mongo/database.rb command start"
      W, [2020-12-07T11:15:45.619782 #1394]  WARN -- : MONGODB | Failed to authenticate to localhost:27017: Mongo::Auth::Unauthorized: User root-user (mechanism: scram) is not authorized to access ruby-driver (auth source: admin, used mechanism: SCRAM-SHA-1, used server: localhost:27017 (STANDALONE)): Authentication failed. (18: AuthenticationFailed)
      

      Do you have any idea to fix it?
      Thank you.

            Assignee:
            Unassigned Unassigned
            Reporter:
            jaruga@redhat.com Jun Aruga
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              None
              None
              None
              None