bson 5.0.0-java → 5.0.1-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/README.md +91 -7
 - data/Rakefile +63 -39
 - data/lib/bson/decimal128/builder.rb +1 -1
 - data/lib/bson/object_id.rb +11 -1
 - data/lib/bson/version.rb +2 -1
 - data/lib/bson-ruby.jar +0 -0
 - data/spec/bson/object_id_spec.rb +14 -0
 - metadata +99 -172
 - checksums.yaml.gz.sig +0 -0
 - data/spec/shared/LICENSE +0 -20
 - data/spec/shared/bin/get-mongodb-download-url +0 -17
 - data/spec/shared/bin/s3-copy +0 -45
 - data/spec/shared/bin/s3-upload +0 -69
 - data/spec/shared/lib/mrss/child_process_helper.rb +0 -80
 - data/spec/shared/lib/mrss/cluster_config.rb +0 -231
 - data/spec/shared/lib/mrss/constraints.rb +0 -378
 - data/spec/shared/lib/mrss/docker_runner.rb +0 -298
 - data/spec/shared/lib/mrss/eg_config_utils.rb +0 -51
 - data/spec/shared/lib/mrss/event_subscriber.rb +0 -210
 - data/spec/shared/lib/mrss/lite_constraints.rb +0 -238
 - data/spec/shared/lib/mrss/server_version_registry.rb +0 -113
 - data/spec/shared/lib/mrss/session_registry.rb +0 -69
 - data/spec/shared/lib/mrss/session_registry_legacy.rb +0 -60
 - data/spec/shared/lib/mrss/spec_organizer.rb +0 -179
 - data/spec/shared/lib/mrss/utils.rb +0 -37
 - data/spec/shared/share/Dockerfile.erb +0 -321
 - data/spec/shared/share/haproxy-1.conf +0 -16
 - data/spec/shared/share/haproxy-2.conf +0 -17
 - data/spec/shared/shlib/config.sh +0 -27
 - data/spec/shared/shlib/distro.sh +0 -74
 - data/spec/shared/shlib/server.sh +0 -416
 - data/spec/shared/shlib/set_env.sh +0 -169
 - data.tar.gz.sig +0 -0
 - metadata.gz.sig +0 -0
 
| 
         @@ -1,231 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # frozen_string_literal: true
         
     | 
| 
       2 
     | 
    
         
            -
            # encoding: utf-8
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            # ClusterConfig requires ClientRegistry class provided by the host project.
         
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
            require 'singleton'
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
            module Mrss
         
     | 
| 
       9 
     | 
    
         
            -
              class ClusterConfig
         
     | 
| 
       10 
     | 
    
         
            -
                include Singleton
         
     | 
| 
       11 
     | 
    
         
            -
                include RSpec::Core::Pending
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
                def single_server?
         
     | 
| 
       14 
     | 
    
         
            -
                  determine_cluster_config
         
     | 
| 
       15 
     | 
    
         
            -
                  @single_server
         
     | 
| 
       16 
     | 
    
         
            -
                end
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
                def sharded_ish?
         
     | 
| 
       19 
     | 
    
         
            -
                  determine_cluster_config
         
     | 
| 
       20 
     | 
    
         
            -
                  @topology == :sharded || @topology == :load_balanced
         
     | 
| 
       21 
     | 
    
         
            -
                end
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
                def replica_set_name
         
     | 
| 
       24 
     | 
    
         
            -
                  determine_cluster_config
         
     | 
| 
       25 
     | 
    
         
            -
                  @replica_set_name
         
     | 
| 
       26 
     | 
    
         
            -
                end
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
                def server_version
         
     | 
| 
       29 
     | 
    
         
            -
                  determine_cluster_config
         
     | 
| 
       30 
     | 
    
         
            -
                  @server_version
         
     | 
| 
       31 
     | 
    
         
            -
                end
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
                def enterprise?
         
     | 
| 
       34 
     | 
    
         
            -
                  determine_cluster_config
         
     | 
| 
       35 
     | 
    
         
            -
                  @enterprise
         
     | 
| 
       36 
     | 
    
         
            -
                end
         
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
                def short_server_version
         
     | 
| 
       39 
     | 
    
         
            -
                  server_version.split('.')[0..1].join('.')
         
     | 
| 
       40 
     | 
    
         
            -
                end
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
                def fcv
         
     | 
| 
       43 
     | 
    
         
            -
                  determine_cluster_config
         
     | 
| 
       44 
     | 
    
         
            -
                  @fcv
         
     | 
| 
       45 
     | 
    
         
            -
                end
         
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
                # Per https://jira.mongodb.org/browse/SERVER-39052, working with FCV
         
     | 
| 
       48 
     | 
    
         
            -
                # in sharded topologies is annoying. Also, FCV doesn't exist in servers
         
     | 
| 
       49 
     | 
    
         
            -
                # less than 3.4. This method returns FCV on 3.4+ servers when in single
         
     | 
| 
       50 
     | 
    
         
            -
                # or RS topologies, and otherwise returns the major.minor server version.
         
     | 
| 
       51 
     | 
    
         
            -
                def fcv_ish
         
     | 
| 
       52 
     | 
    
         
            -
                  if server_version.nil?
         
     | 
| 
       53 
     | 
    
         
            -
                    raise "Deployment server version not known - check that connection to deployment succeeded"
         
     | 
| 
       54 
     | 
    
         
            -
                  end
         
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
                  if server_version >= '3.4' && !sharded_ish?
         
     | 
| 
       57 
     | 
    
         
            -
                    fcv
         
     | 
| 
       58 
     | 
    
         
            -
                  else
         
     | 
| 
       59 
     | 
    
         
            -
                    if short_server_version == '4.1'
         
     | 
| 
       60 
     | 
    
         
            -
                      '4.2'
         
     | 
| 
       61 
     | 
    
         
            -
                    else
         
     | 
| 
       62 
     | 
    
         
            -
                      short_server_version
         
     | 
| 
       63 
     | 
    
         
            -
                    end
         
     | 
| 
       64 
     | 
    
         
            -
                  end
         
     | 
| 
       65 
     | 
    
         
            -
                end
         
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
                # @return [ Mongo::Address ] The address of the primary in the deployment.
         
     | 
| 
       68 
     | 
    
         
            -
                def primary_address
         
     | 
| 
       69 
     | 
    
         
            -
                  determine_cluster_config
         
     | 
| 
       70 
     | 
    
         
            -
                  @primary_address
         
     | 
| 
       71 
     | 
    
         
            -
                end
         
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
     | 
    
         
            -
                def primary_address_str
         
     | 
| 
       74 
     | 
    
         
            -
                  determine_cluster_config
         
     | 
| 
       75 
     | 
    
         
            -
                  @primary_address.seed
         
     | 
| 
       76 
     | 
    
         
            -
                end
         
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
       78 
     | 
    
         
            -
                def primary_address_host
         
     | 
| 
       79 
     | 
    
         
            -
                  both = primary_address_str
         
     | 
| 
       80 
     | 
    
         
            -
                  both.split(':').first
         
     | 
| 
       81 
     | 
    
         
            -
                end
         
     | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
       83 
     | 
    
         
            -
                def primary_address_port
         
     | 
| 
       84 
     | 
    
         
            -
                  both = primary_address_str
         
     | 
| 
       85 
     | 
    
         
            -
                  both.split(':')[1] || 27017
         
     | 
| 
       86 
     | 
    
         
            -
                end
         
     | 
| 
       87 
     | 
    
         
            -
             
     | 
| 
       88 
     | 
    
         
            -
                def primary_description
         
     | 
| 
       89 
     | 
    
         
            -
                  determine_cluster_config
         
     | 
| 
       90 
     | 
    
         
            -
                  @primary_description
         
     | 
| 
       91 
     | 
    
         
            -
                end
         
     | 
| 
       92 
     | 
    
         
            -
             
     | 
| 
       93 
     | 
    
         
            -
                def server_parameters
         
     | 
| 
       94 
     | 
    
         
            -
                  determine_cluster_config
         
     | 
| 
       95 
     | 
    
         
            -
                  @server_parameters
         
     | 
| 
       96 
     | 
    
         
            -
                end
         
     | 
| 
       97 
     | 
    
         
            -
             
     | 
| 
       98 
     | 
    
         
            -
                # Try running a command on the admin database to see if the mongod was
         
     | 
| 
       99 
     | 
    
         
            -
                # started with auth.
         
     | 
| 
       100 
     | 
    
         
            -
                def auth_enabled?
         
     | 
| 
       101 
     | 
    
         
            -
                  if @auth_enabled.nil?
         
     | 
| 
       102 
     | 
    
         
            -
                    @auth_enabled = begin
         
     | 
| 
       103 
     | 
    
         
            -
                      basic_client.use(:admin).command(getCmdLineOpts: 1).first["argv"].include?("--auth")
         
     | 
| 
       104 
     | 
    
         
            -
                    rescue => e
         
     | 
| 
       105 
     | 
    
         
            -
                      e.message =~ /(not authorized)|(unauthorized)|(no users authenticated)|(requires authentication)/
         
     | 
| 
       106 
     | 
    
         
            -
                    end
         
     | 
| 
       107 
     | 
    
         
            -
                  end
         
     | 
| 
       108 
     | 
    
         
            -
                  @auth_enabled
         
     | 
| 
       109 
     | 
    
         
            -
                end
         
     | 
| 
       110 
     | 
    
         
            -
             
     | 
| 
       111 
     | 
    
         
            -
                def topology
         
     | 
| 
       112 
     | 
    
         
            -
                  determine_cluster_config
         
     | 
| 
       113 
     | 
    
         
            -
                  @topology
         
     | 
| 
       114 
     | 
    
         
            -
                end
         
     | 
| 
       115 
     | 
    
         
            -
             
     | 
| 
       116 
     | 
    
         
            -
                def storage_engine
         
     | 
| 
       117 
     | 
    
         
            -
                  @storage_engine ||= begin
         
     | 
| 
       118 
     | 
    
         
            -
                    # 2.6 does not have wired tiger
         
     | 
| 
       119 
     | 
    
         
            -
                    if short_server_version == '2.6'
         
     | 
| 
       120 
     | 
    
         
            -
                      :mmapv1
         
     | 
| 
       121 
     | 
    
         
            -
                    else
         
     | 
| 
       122 
     | 
    
         
            -
                      client = ClientRegistry.instance.global_client('root_authorized')
         
     | 
| 
       123 
     | 
    
         
            -
                      if sharded_ish?
         
     | 
| 
       124 
     | 
    
         
            -
                        shards = client.use(:admin).command(listShards: 1).first
         
     | 
| 
       125 
     | 
    
         
            -
                        if shards['shards'].empty?
         
     | 
| 
       126 
     | 
    
         
            -
                          raise 'Shards are empty'
         
     | 
| 
       127 
     | 
    
         
            -
                        end
         
     | 
| 
       128 
     | 
    
         
            -
                        shard = shards['shards'].first
         
     | 
| 
       129 
     | 
    
         
            -
                        address_str = shard['host'].sub(/^.*\//, '').sub(/,.*/, '')
         
     | 
| 
       130 
     | 
    
         
            -
                        client = ClusterTools.instance.direct_client(address_str,
         
     | 
| 
       131 
     | 
    
         
            -
                          SpecConfig.instance.test_options.merge(SpecConfig.instance.auth_options).merge(connect: :direct))
         
     | 
| 
       132 
     | 
    
         
            -
                      end
         
     | 
| 
       133 
     | 
    
         
            -
                      rv = client.use(:admin).command(serverStatus: 1).first
         
     | 
| 
       134 
     | 
    
         
            -
                      rv = rv['storageEngine']['name']
         
     | 
| 
       135 
     | 
    
         
            -
                      rv_map = {
         
     | 
| 
       136 
     | 
    
         
            -
                        'wiredTiger' => :wired_tiger,
         
     | 
| 
       137 
     | 
    
         
            -
                        'mmapv1' => :mmapv1,
         
     | 
| 
       138 
     | 
    
         
            -
                      }
         
     | 
| 
       139 
     | 
    
         
            -
                      rv_map[rv] || rv
         
     | 
| 
       140 
     | 
    
         
            -
                    end
         
     | 
| 
       141 
     | 
    
         
            -
                  end
         
     | 
| 
       142 
     | 
    
         
            -
                end
         
     | 
| 
       143 
     | 
    
         
            -
             
     | 
| 
       144 
     | 
    
         
            -
                # This method returns an alternate address for connecting to the configured
         
     | 
| 
       145 
     | 
    
         
            -
                # deployment. For example, if the replica set is configured with nodes at
         
     | 
| 
       146 
     | 
    
         
            -
                # of localhost:27017 and so on, this method will return 127.0.0.:27017.
         
     | 
| 
       147 
     | 
    
         
            -
                #
         
     | 
| 
       148 
     | 
    
         
            -
                # Note that the "alternate" refers to replica set configuration, not the
         
     | 
| 
       149 
     | 
    
         
            -
                # addresses specified in test suite configuration. If the deployment topology
         
     | 
| 
       150 
     | 
    
         
            -
                # is not a replica set, "alternate" refers to test suite configuration as
         
     | 
| 
       151 
     | 
    
         
            -
                # this is the only configuration available.
         
     | 
| 
       152 
     | 
    
         
            -
                def alternate_address
         
     | 
| 
       153 
     | 
    
         
            -
                  @alternate_address ||= begin
         
     | 
| 
       154 
     | 
    
         
            -
                    address = primary_address_host
         
     | 
| 
       155 
     | 
    
         
            -
                    str = case address
         
     | 
| 
       156 
     | 
    
         
            -
                    when '127.0.0.1'
         
     | 
| 
       157 
     | 
    
         
            -
                      'localhost'
         
     | 
| 
       158 
     | 
    
         
            -
                    when /^(\d+\.){3}\d+$/
         
     | 
| 
       159 
     | 
    
         
            -
                      skip 'This test requires a hostname or 127.0.0.1 as address'
         
     | 
| 
       160 
     | 
    
         
            -
                    else
         
     | 
| 
       161 
     | 
    
         
            -
                      # We don't know if mongod is listening on ipv4 or ipv6, in principle.
         
     | 
| 
       162 
     | 
    
         
            -
                      # Our tests use ipv4, so hardcode that for now.
         
     | 
| 
       163 
     | 
    
         
            -
                      # To support both we need to try both addresses which will make this
         
     | 
| 
       164 
     | 
    
         
            -
                      # test more complicated.
         
     | 
| 
       165 
     | 
    
         
            -
                      #
         
     | 
| 
       166 
     | 
    
         
            -
                      # JRuby chokes on primary_address_port as the port (e.g. 27017).
         
     | 
| 
       167 
     | 
    
         
            -
                      # Since the port does not actually matter, use a common port like 80.
         
     | 
| 
       168 
     | 
    
         
            -
                      resolved_address = Addrinfo.getaddrinfo(address, 80, Socket::PF_INET).first.ip_address
         
     | 
| 
       169 
     | 
    
         
            -
                      if resolved_address.include?(':')
         
     | 
| 
       170 
     | 
    
         
            -
                        "[#{resolved_address}]"
         
     | 
| 
       171 
     | 
    
         
            -
                      else
         
     | 
| 
       172 
     | 
    
         
            -
                        resolved_address
         
     | 
| 
       173 
     | 
    
         
            -
                      end
         
     | 
| 
       174 
     | 
    
         
            -
                    end + ":#{primary_address_port}"
         
     | 
| 
       175 
     | 
    
         
            -
                    Mongo::Address.new(str)
         
     | 
| 
       176 
     | 
    
         
            -
                  end
         
     | 
| 
       177 
     | 
    
         
            -
                end
         
     | 
| 
       178 
     | 
    
         
            -
             
     | 
| 
       179 
     | 
    
         
            -
                private
         
     | 
| 
       180 
     | 
    
         
            -
             
     | 
| 
       181 
     | 
    
         
            -
                def determine_cluster_config
         
     | 
| 
       182 
     | 
    
         
            -
                  return if @primary_address
         
     | 
| 
       183 
     | 
    
         
            -
             
     | 
| 
       184 
     | 
    
         
            -
                  # Run all commands to figure out the cluster configuration from the same
         
     | 
| 
       185 
     | 
    
         
            -
                  # client. This is somewhat wasteful when running a single test, but reduces
         
     | 
| 
       186 
     | 
    
         
            -
                  # test runtime for the suite overall because all commands are sent on the
         
     | 
| 
       187 
     | 
    
         
            -
                  # same connection rather than each command connecting to the cluster by
         
     | 
| 
       188 
     | 
    
         
            -
                  # itself.
         
     | 
| 
       189 
     | 
    
         
            -
                  client = ClientRegistry.instance.global_client('root_authorized')
         
     | 
| 
       190 
     | 
    
         
            -
             
     | 
| 
       191 
     | 
    
         
            -
                  primary = client.cluster.next_primary
         
     | 
| 
       192 
     | 
    
         
            -
                  @primary_address = primary.address
         
     | 
| 
       193 
     | 
    
         
            -
                  @primary_description = primary.description
         
     | 
| 
       194 
     | 
    
         
            -
                  @replica_set_name = client.cluster.topology.replica_set_name
         
     | 
| 
       195 
     | 
    
         
            -
             
     | 
| 
       196 
     | 
    
         
            -
                  @topology ||= begin
         
     | 
| 
       197 
     | 
    
         
            -
                    topology = client.cluster.topology.class.name.sub(/.*::/, '')
         
     | 
| 
       198 
     | 
    
         
            -
                    topology = topology.gsub(/([A-Z])/) { |match| '_' + match.downcase }.sub(/^_/, '')
         
     | 
| 
       199 
     | 
    
         
            -
                    if topology =~ /^replica_set/
         
     | 
| 
       200 
     | 
    
         
            -
                      topology = 'replica_set'
         
     | 
| 
       201 
     | 
    
         
            -
                    end
         
     | 
| 
       202 
     | 
    
         
            -
                    topology.to_sym
         
     | 
| 
       203 
     | 
    
         
            -
                  end
         
     | 
| 
       204 
     | 
    
         
            -
             
     | 
| 
       205 
     | 
    
         
            -
                  @single_server = client.cluster.servers_list.length == 1
         
     | 
| 
       206 
     | 
    
         
            -
             
     | 
| 
       207 
     | 
    
         
            -
                  build_info = client.database.command(buildInfo: 1).first
         
     | 
| 
       208 
     | 
    
         
            -
             
     | 
| 
       209 
     | 
    
         
            -
                  @server_version = build_info['version']
         
     | 
| 
       210 
     | 
    
         
            -
                  @enterprise = build_info['modules'] && build_info['modules'].include?('enterprise')
         
     | 
| 
       211 
     | 
    
         
            -
             
     | 
| 
       212 
     | 
    
         
            -
                  @server_parameters = begin
         
     | 
| 
       213 
     | 
    
         
            -
                    client.use(:admin).command(getParameter: '*').first
         
     | 
| 
       214 
     | 
    
         
            -
                  rescue => e
         
     | 
| 
       215 
     | 
    
         
            -
                    STDERR.puts("WARNING: Failed to obtain server parameters: #{e.class}: #{e.message}")
         
     | 
| 
       216 
     | 
    
         
            -
                    {}
         
     | 
| 
       217 
     | 
    
         
            -
                  end
         
     | 
| 
       218 
     | 
    
         
            -
             
     | 
| 
       219 
     | 
    
         
            -
                  if !sharded_ish? && short_server_version >= '3.4'
         
     | 
| 
       220 
     | 
    
         
            -
                    rv = @server_parameters['featureCompatibilityVersion']
         
     | 
| 
       221 
     | 
    
         
            -
                    @fcv = rv['version'] || rv
         
     | 
| 
       222 
     | 
    
         
            -
                  end
         
     | 
| 
       223 
     | 
    
         
            -
                end
         
     | 
| 
       224 
     | 
    
         
            -
             
     | 
| 
       225 
     | 
    
         
            -
                def basic_client
         
     | 
| 
       226 
     | 
    
         
            -
                  # Do not cache the result here so that if the client gets closed,
         
     | 
| 
       227 
     | 
    
         
            -
                  # client registry reconnects it in subsequent tests
         
     | 
| 
       228 
     | 
    
         
            -
                  ClientRegistry.instance.global_client('basic')
         
     | 
| 
       229 
     | 
    
         
            -
                end
         
     | 
| 
       230 
     | 
    
         
            -
              end
         
     | 
| 
       231 
     | 
    
         
            -
            end
         
     | 
| 
         @@ -1,378 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # frozen_string_literal: true
         
     | 
| 
       2 
     | 
    
         
            -
            # encoding: utf-8
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            module Mrss
         
     | 
| 
       5 
     | 
    
         
            -
              module Constraints
         
     | 
| 
       6 
     | 
    
         
            -
                def min_server_version(version)
         
     | 
| 
       7 
     | 
    
         
            -
                  parsed_version = Gem::Version.new(version)
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       10 
     | 
    
         
            -
                    if parsed_version > Gem::Version.new(ClusterConfig.instance.server_version)
         
     | 
| 
       11 
     | 
    
         
            -
                      skip "Server version #{version} or higher required, we have #{ClusterConfig.instance.server_version}"
         
     | 
| 
       12 
     | 
    
         
            -
                    end
         
     | 
| 
       13 
     | 
    
         
            -
                  end
         
     | 
| 
       14 
     | 
    
         
            -
                end
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
                def max_server_version(version)
         
     | 
| 
       17 
     | 
    
         
            -
                  parsed_version = Gem::Version.new(version)
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       20 
     | 
    
         
            -
                    if parsed_version < Gem::Version.new(ClusterConfig.instance.server_version)
         
     | 
| 
       21 
     | 
    
         
            -
                      skip "Server version #{version} or lower required, we have #{ClusterConfig.instance.server_version}"
         
     | 
| 
       22 
     | 
    
         
            -
                    end
         
     | 
| 
       23 
     | 
    
         
            -
                  end
         
     | 
| 
       24 
     | 
    
         
            -
                end
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                def min_server_fcv(version)
         
     | 
| 
       27 
     | 
    
         
            -
                  parsed_version = Gem::Version.new(version)
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       30 
     | 
    
         
            -
                    unless Gem::Version.new(ClusterConfig.instance.fcv_ish) >= parsed_version
         
     | 
| 
       31 
     | 
    
         
            -
                      skip "FCV #{version} or higher required, we have #{ClusterConfig.instance.fcv_ish} (server #{ClusterConfig.instance.server_version})"
         
     | 
| 
       32 
     | 
    
         
            -
                    end
         
     | 
| 
       33 
     | 
    
         
            -
                  end
         
     | 
| 
       34 
     | 
    
         
            -
                end
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
                def max_server_fcv(version)
         
     | 
| 
       37 
     | 
    
         
            -
                  parsed_version = Gem::Version.new(version)
         
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       40 
     | 
    
         
            -
                    if parsed_version < Gem::Version.new(ClusterConfig.instance.fcv_ish)
         
     | 
| 
       41 
     | 
    
         
            -
                      skip "FCV #{version} or lower required, we have #{ClusterConfig.instance.fcv_ish} (server #{ClusterConfig.instance.server_version})"
         
     | 
| 
       42 
     | 
    
         
            -
                    end
         
     | 
| 
       43 
     | 
    
         
            -
                  end
         
     | 
| 
       44 
     | 
    
         
            -
                end
         
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
                def require_topology(*topologies)
         
     | 
| 
       47 
     | 
    
         
            -
                  invalid_topologies = topologies - [:single, :replica_set, :sharded, :load_balanced]
         
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
                  unless invalid_topologies.empty?
         
     | 
| 
       50 
     | 
    
         
            -
                    raise ArgumentError, "Invalid topologies requested: #{invalid_topologies.join(', ')}"
         
     | 
| 
       51 
     | 
    
         
            -
                  end
         
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       54 
     | 
    
         
            -
                    unless topologies.include?(topology = ClusterConfig.instance.topology)
         
     | 
| 
       55 
     | 
    
         
            -
                      skip "Topology #{topologies.join(' or ')} required, we have #{topology}"
         
     | 
| 
       56 
     | 
    
         
            -
                    end
         
     | 
| 
       57 
     | 
    
         
            -
                  end
         
     | 
| 
       58 
     | 
    
         
            -
                end
         
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
                def max_example_run_time(timeout)
         
     | 
| 
       61 
     | 
    
         
            -
                  around do |example|
         
     | 
| 
       62 
     | 
    
         
            -
                    TimeoutInterrupt.timeout(timeout, TimeoutInterrupt::Error.new("Test execution terminated after #{timeout} seconds")) do
         
     | 
| 
       63 
     | 
    
         
            -
                      example.run
         
     | 
| 
       64 
     | 
    
         
            -
                    end
         
     | 
| 
       65 
     | 
    
         
            -
                  end
         
     | 
| 
       66 
     | 
    
         
            -
                end
         
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
                def require_transaction_support
         
     | 
| 
       69 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       70 
     | 
    
         
            -
                    case ClusterConfig.instance.topology
         
     | 
| 
       71 
     | 
    
         
            -
                    when :single
         
     | 
| 
       72 
     | 
    
         
            -
                      skip 'Transactions tests require a replica set (4.0+) or a sharded cluster (4.2+)'
         
     | 
| 
       73 
     | 
    
         
            -
                    when :replica_set
         
     | 
| 
       74 
     | 
    
         
            -
                      unless ClusterConfig.instance.server_version >= '4.0'
         
     | 
| 
       75 
     | 
    
         
            -
                        skip 'Transactions tests in a replica set topology require server 4.0+'
         
     | 
| 
       76 
     | 
    
         
            -
                      end
         
     | 
| 
       77 
     | 
    
         
            -
                    when :sharded, :load_balanced
         
     | 
| 
       78 
     | 
    
         
            -
                      unless ClusterConfig.instance.server_version >= '4.2'
         
     | 
| 
       79 
     | 
    
         
            -
                        skip 'Transactions tests in a sharded cluster topology require server 4.2+'
         
     | 
| 
       80 
     | 
    
         
            -
                      end
         
     | 
| 
       81 
     | 
    
         
            -
                    else
         
     | 
| 
       82 
     | 
    
         
            -
                      raise NotImplementedError
         
     | 
| 
       83 
     | 
    
         
            -
                    end
         
     | 
| 
       84 
     | 
    
         
            -
                  end
         
     | 
| 
       85 
     | 
    
         
            -
                end
         
     | 
| 
       86 
     | 
    
         
            -
             
     | 
| 
       87 
     | 
    
         
            -
                # Fail command fail point was added to mongod in 4.0 and to mongos in 4.2.
         
     | 
| 
       88 
     | 
    
         
            -
                def require_fail_command
         
     | 
| 
       89 
     | 
    
         
            -
                  require_transaction_support
         
     | 
| 
       90 
     | 
    
         
            -
                end
         
     | 
| 
       91 
     | 
    
         
            -
             
     | 
| 
       92 
     | 
    
         
            -
                def require_tls
         
     | 
| 
       93 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       94 
     | 
    
         
            -
                    unless SpecConfig.instance.ssl?
         
     | 
| 
       95 
     | 
    
         
            -
                      skip "SSL not enabled"
         
     | 
| 
       96 
     | 
    
         
            -
                    end
         
     | 
| 
       97 
     | 
    
         
            -
                  end
         
     | 
| 
       98 
     | 
    
         
            -
                end
         
     | 
| 
       99 
     | 
    
         
            -
             
     | 
| 
       100 
     | 
    
         
            -
                def require_no_tls
         
     | 
| 
       101 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       102 
     | 
    
         
            -
                    if SpecConfig.instance.ssl?
         
     | 
| 
       103 
     | 
    
         
            -
                      skip "SSL enabled"
         
     | 
| 
       104 
     | 
    
         
            -
                    end
         
     | 
| 
       105 
     | 
    
         
            -
                  end
         
     | 
| 
       106 
     | 
    
         
            -
                end
         
     | 
| 
       107 
     | 
    
         
            -
             
     | 
| 
       108 
     | 
    
         
            -
                def require_retry_writes
         
     | 
| 
       109 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       110 
     | 
    
         
            -
                    unless SpecConfig.instance.retry_writes?
         
     | 
| 
       111 
     | 
    
         
            -
                      skip "Retry writes is disabled"
         
     | 
| 
       112 
     | 
    
         
            -
                    end
         
     | 
| 
       113 
     | 
    
         
            -
                  end
         
     | 
| 
       114 
     | 
    
         
            -
                end
         
     | 
| 
       115 
     | 
    
         
            -
             
     | 
| 
       116 
     | 
    
         
            -
                def require_no_retry_writes
         
     | 
| 
       117 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       118 
     | 
    
         
            -
                    if SpecConfig.instance.retry_writes?
         
     | 
| 
       119 
     | 
    
         
            -
                      skip "Retry writes is enabled"
         
     | 
| 
       120 
     | 
    
         
            -
                    end
         
     | 
| 
       121 
     | 
    
         
            -
                  end
         
     | 
| 
       122 
     | 
    
         
            -
                end
         
     | 
| 
       123 
     | 
    
         
            -
             
     | 
| 
       124 
     | 
    
         
            -
                def require_compression
         
     | 
| 
       125 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       126 
     | 
    
         
            -
                    if SpecConfig.instance.compressors.nil?
         
     | 
| 
       127 
     | 
    
         
            -
                      skip "Compression is not enabled"
         
     | 
| 
       128 
     | 
    
         
            -
                    end
         
     | 
| 
       129 
     | 
    
         
            -
                  end
         
     | 
| 
       130 
     | 
    
         
            -
                end
         
     | 
| 
       131 
     | 
    
         
            -
             
     | 
| 
       132 
     | 
    
         
            -
                def require_zlib_compression
         
     | 
| 
       133 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       134 
     | 
    
         
            -
                    compressors = SpecConfig.instance.compressors
         
     | 
| 
       135 
     | 
    
         
            -
                    unless compressors && compressors.include?('zlib')
         
     | 
| 
       136 
     | 
    
         
            -
                      skip "Zlib compression is not enabled"
         
     | 
| 
       137 
     | 
    
         
            -
                    end
         
     | 
| 
       138 
     | 
    
         
            -
                  end
         
     | 
| 
       139 
     | 
    
         
            -
                end
         
     | 
| 
       140 
     | 
    
         
            -
             
     | 
| 
       141 
     | 
    
         
            -
                def require_snappy_compression
         
     | 
| 
       142 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       143 
     | 
    
         
            -
                    compressors = SpecConfig.instance.compressors
         
     | 
| 
       144 
     | 
    
         
            -
                    unless compressors && compressors.include?('snappy')
         
     | 
| 
       145 
     | 
    
         
            -
                      skip "Snappy compression is not enabled"
         
     | 
| 
       146 
     | 
    
         
            -
                    end
         
     | 
| 
       147 
     | 
    
         
            -
                  end
         
     | 
| 
       148 
     | 
    
         
            -
                end
         
     | 
| 
       149 
     | 
    
         
            -
             
     | 
| 
       150 
     | 
    
         
            -
                def require_no_snappy_compression
         
     | 
| 
       151 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       152 
     | 
    
         
            -
                    compressors = SpecConfig.instance.compressors
         
     | 
| 
       153 
     | 
    
         
            -
                    if compressors && compressors.include?('snappy')
         
     | 
| 
       154 
     | 
    
         
            -
                      skip "Snappy compression is enabled"
         
     | 
| 
       155 
     | 
    
         
            -
                    end
         
     | 
| 
       156 
     | 
    
         
            -
                  end
         
     | 
| 
       157 
     | 
    
         
            -
                end
         
     | 
| 
       158 
     | 
    
         
            -
             
     | 
| 
       159 
     | 
    
         
            -
                def require_zstd_compression
         
     | 
| 
       160 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       161 
     | 
    
         
            -
                    compressors = SpecConfig.instance.compressors
         
     | 
| 
       162 
     | 
    
         
            -
                    unless compressors && compressors.include?('zstd')
         
     | 
| 
       163 
     | 
    
         
            -
                      skip "Zstd compression is not enabled"
         
     | 
| 
       164 
     | 
    
         
            -
                    end
         
     | 
| 
       165 
     | 
    
         
            -
                  end
         
     | 
| 
       166 
     | 
    
         
            -
                end
         
     | 
| 
       167 
     | 
    
         
            -
             
     | 
| 
       168 
     | 
    
         
            -
                def require_no_zstd_compression
         
     | 
| 
       169 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       170 
     | 
    
         
            -
                    compressors = SpecConfig.instance.compressors
         
     | 
| 
       171 
     | 
    
         
            -
                    if compressors && compressors.include?('zstd')
         
     | 
| 
       172 
     | 
    
         
            -
                      skip "Zstd compression is enabled"
         
     | 
| 
       173 
     | 
    
         
            -
                    end
         
     | 
| 
       174 
     | 
    
         
            -
                  end
         
     | 
| 
       175 
     | 
    
         
            -
                end
         
     | 
| 
       176 
     | 
    
         
            -
             
     | 
| 
       177 
     | 
    
         
            -
                def require_no_compression
         
     | 
| 
       178 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       179 
     | 
    
         
            -
                    if SpecConfig.instance.compressors
         
     | 
| 
       180 
     | 
    
         
            -
                      skip "Compression is enabled"
         
     | 
| 
       181 
     | 
    
         
            -
                    end
         
     | 
| 
       182 
     | 
    
         
            -
                  end
         
     | 
| 
       183 
     | 
    
         
            -
                end
         
     | 
| 
       184 
     | 
    
         
            -
             
     | 
| 
       185 
     | 
    
         
            -
                def ruby_version_gte(version)
         
     | 
| 
       186 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       187 
     | 
    
         
            -
                    if RUBY_VERSION < version
         
     | 
| 
       188 
     | 
    
         
            -
                      skip "Ruby version #{version} or higher required"
         
     | 
| 
       189 
     | 
    
         
            -
                    end
         
     | 
| 
       190 
     | 
    
         
            -
                  end
         
     | 
| 
       191 
     | 
    
         
            -
                end
         
     | 
| 
       192 
     | 
    
         
            -
             
     | 
| 
       193 
     | 
    
         
            -
                def ruby_version_lt(version)
         
     | 
| 
       194 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       195 
     | 
    
         
            -
                    if RUBY_VERSION >= version
         
     | 
| 
       196 
     | 
    
         
            -
                      skip "Ruby version less than #{version} required"
         
     | 
| 
       197 
     | 
    
         
            -
                    end
         
     | 
| 
       198 
     | 
    
         
            -
                  end
         
     | 
| 
       199 
     | 
    
         
            -
                end
         
     | 
| 
       200 
     | 
    
         
            -
             
     | 
| 
       201 
     | 
    
         
            -
                def require_auth(*values)
         
     | 
| 
       202 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       203 
     | 
    
         
            -
                    if values.any?
         
     | 
| 
       204 
     | 
    
         
            -
                      unless values.include?(ENV['AUTH'])
         
     | 
| 
       205 
     | 
    
         
            -
                        msg = values.map { |v| "AUTH=#{v}" }.join(' or ')
         
     | 
| 
       206 
     | 
    
         
            -
                        skip "This test requires #{msg}"
         
     | 
| 
       207 
     | 
    
         
            -
                      end
         
     | 
| 
       208 
     | 
    
         
            -
                    else
         
     | 
| 
       209 
     | 
    
         
            -
                      unless ENV['AUTH'] == 'auth' || SpecConfig.instance.user || ClusterConfig.instance.auth_enabled?
         
     | 
| 
       210 
     | 
    
         
            -
                        skip "Auth required"
         
     | 
| 
       211 
     | 
    
         
            -
                      end
         
     | 
| 
       212 
     | 
    
         
            -
                    end
         
     | 
| 
       213 
     | 
    
         
            -
                  end
         
     | 
| 
       214 
     | 
    
         
            -
                end
         
     | 
| 
       215 
     | 
    
         
            -
             
     | 
| 
       216 
     | 
    
         
            -
                def require_no_auth
         
     | 
| 
       217 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       218 
     | 
    
         
            -
                    auth = ENV.fetch('AUTH', '')
         
     | 
| 
       219 
     | 
    
         
            -
                    if (!auth.empty? && auth != 'noauth') || SpecConfig.instance.user || ClusterConfig.instance.auth_enabled?
         
     | 
| 
       220 
     | 
    
         
            -
                      skip "Auth not allowed"
         
     | 
| 
       221 
     | 
    
         
            -
                    end
         
     | 
| 
       222 
     | 
    
         
            -
                  end
         
     | 
| 
       223 
     | 
    
         
            -
                end
         
     | 
| 
       224 
     | 
    
         
            -
             
     | 
| 
       225 
     | 
    
         
            -
                def require_x509_auth
         
     | 
| 
       226 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       227 
     | 
    
         
            -
                    unless SpecConfig.instance.x509_auth?
         
     | 
| 
       228 
     | 
    
         
            -
                      skip "X.509 auth required"
         
     | 
| 
       229 
     | 
    
         
            -
                    end
         
     | 
| 
       230 
     | 
    
         
            -
                  end
         
     | 
| 
       231 
     | 
    
         
            -
                end
         
     | 
| 
       232 
     | 
    
         
            -
             
     | 
| 
       233 
     | 
    
         
            -
                def require_no_external_user
         
     | 
| 
       234 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       235 
     | 
    
         
            -
                    if SpecConfig.instance.external_user?
         
     | 
| 
       236 
     | 
    
         
            -
                      skip "External user configurations are not compatible with this test"
         
     | 
| 
       237 
     | 
    
         
            -
                    end
         
     | 
| 
       238 
     | 
    
         
            -
                  end
         
     | 
| 
       239 
     | 
    
         
            -
                end
         
     | 
| 
       240 
     | 
    
         
            -
             
     | 
| 
       241 
     | 
    
         
            -
                # Can the driver specify a write concern that won't be overridden?
         
     | 
| 
       242 
     | 
    
         
            -
                # (mongos 4.0+ overrides the write concern)
         
     | 
| 
       243 
     | 
    
         
            -
                def require_set_write_concern
         
     | 
| 
       244 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       245 
     | 
    
         
            -
                    if %i(sharded load_balanced).include?(ClusterConfig.instance.topology) &&
         
     | 
| 
       246 
     | 
    
         
            -
                      ClusterConfig.instance.short_server_version >= '4.0'
         
     | 
| 
       247 
     | 
    
         
            -
                    then
         
     | 
| 
       248 
     | 
    
         
            -
                      skip "mongos 4.0+ overrides write concern"
         
     | 
| 
       249 
     | 
    
         
            -
                    end
         
     | 
| 
       250 
     | 
    
         
            -
                  end
         
     | 
| 
       251 
     | 
    
         
            -
                end
         
     | 
| 
       252 
     | 
    
         
            -
             
     | 
| 
       253 
     | 
    
         
            -
                def require_multi_mongos
         
     | 
| 
       254 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       255 
     | 
    
         
            -
                    if ClusterConfig.instance.topology == :sharded && SpecConfig.instance.addresses.length == 1
         
     | 
| 
       256 
     | 
    
         
            -
                      skip 'Test requires a minimum of two mongoses if run in sharded topology'
         
     | 
| 
       257 
     | 
    
         
            -
                    end
         
     | 
| 
       258 
     | 
    
         
            -
             
     | 
| 
       259 
     | 
    
         
            -
                    if ClusterConfig.instance.topology == :load_balanced && SpecConfig.instance.single_mongos?
         
     | 
| 
       260 
     | 
    
         
            -
                      skip 'Test requires a minimum of two mongoses if run in load-balanced topology'
         
     | 
| 
       261 
     | 
    
         
            -
                    end
         
     | 
| 
       262 
     | 
    
         
            -
                  end
         
     | 
| 
       263 
     | 
    
         
            -
                end
         
     | 
| 
       264 
     | 
    
         
            -
             
     | 
| 
       265 
     | 
    
         
            -
                # In sharded topology operations are distributed to the mongoses.
         
     | 
| 
       266 
     | 
    
         
            -
                # When we set fail points, the fail point may be set on one mongos and
         
     | 
| 
       267 
     | 
    
         
            -
                # operation may be executed on another mongos, causing failures.
         
     | 
| 
       268 
     | 
    
         
            -
                # Tests that are not setting targeted fail points should utilize this
         
     | 
| 
       269 
     | 
    
         
            -
                # method to restrict themselves to single mongos.
         
     | 
| 
       270 
     | 
    
         
            -
                #
         
     | 
| 
       271 
     | 
    
         
            -
                # In load-balanced topology, the same problem can happen when there is
         
     | 
| 
       272 
     | 
    
         
            -
                # more than one mongos behind the load balancer.
         
     | 
| 
       273 
     | 
    
         
            -
                def require_no_multi_mongos
         
     | 
| 
       274 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       275 
     | 
    
         
            -
                    if ClusterConfig.instance.topology == :sharded && SpecConfig.instance.addresses.length > 1
         
     | 
| 
       276 
     | 
    
         
            -
                      skip 'Test requires a single mongos if run in sharded topology'
         
     | 
| 
       277 
     | 
    
         
            -
                    end
         
     | 
| 
       278 
     | 
    
         
            -
                    if ClusterConfig.instance.topology == :load_balanced && !SpecConfig.instance.single_mongos?
         
     | 
| 
       279 
     | 
    
         
            -
                      skip 'Test requires a single mongos, as indicated by SINGLE_MONGOS=1 environment variable, if run in load-balanced topology'
         
     | 
| 
       280 
     | 
    
         
            -
                    end
         
     | 
| 
       281 
     | 
    
         
            -
                  end
         
     | 
| 
       282 
     | 
    
         
            -
                end
         
     | 
| 
       283 
     | 
    
         
            -
             
     | 
| 
       284 
     | 
    
         
            -
                alias :require_no_multi_shard :require_no_multi_mongos
         
     | 
| 
       285 
     | 
    
         
            -
             
     | 
| 
       286 
     | 
    
         
            -
                def require_wired_tiger
         
     | 
| 
       287 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       288 
     | 
    
         
            -
                    # Storage detection fails for serverless instances. However, it is safe to
         
     | 
| 
       289 
     | 
    
         
            -
                    # assume that a serverless instance uses WiredTiger Storage Engine.
         
     | 
| 
       290 
     | 
    
         
            -
                    if !SpecConfig.instance.serverless? && ClusterConfig.instance.storage_engine != :wired_tiger
         
     | 
| 
       291 
     | 
    
         
            -
                      skip 'Test requires WiredTiger storage engine'
         
     | 
| 
       292 
     | 
    
         
            -
                    end
         
     | 
| 
       293 
     | 
    
         
            -
                  end
         
     | 
| 
       294 
     | 
    
         
            -
                end
         
     | 
| 
       295 
     | 
    
         
            -
             
     | 
| 
       296 
     | 
    
         
            -
                def require_wired_tiger_on_36
         
     | 
| 
       297 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       298 
     | 
    
         
            -
                    if ClusterConfig.instance.short_server_version >= '3.6'
         
     | 
| 
       299 
     | 
    
         
            -
                      # Storage detection fails for serverless instances. However, it is safe to
         
     | 
| 
       300 
     | 
    
         
            -
                      # assume that a serverless instance uses WiredTiger Storage Engine.
         
     | 
| 
       301 
     | 
    
         
            -
                      if !SpecConfig.instance.serverless? && ClusterConfig.instance.storage_engine != :wired_tiger
         
     | 
| 
       302 
     | 
    
         
            -
                        skip 'Test requires WiredTiger storage engine on 3.6+ servers'
         
     | 
| 
       303 
     | 
    
         
            -
                      end
         
     | 
| 
       304 
     | 
    
         
            -
                    end
         
     | 
| 
       305 
     | 
    
         
            -
                  end
         
     | 
| 
       306 
     | 
    
         
            -
                end
         
     | 
| 
       307 
     | 
    
         
            -
             
     | 
| 
       308 
     | 
    
         
            -
                def require_mmapv1
         
     | 
| 
       309 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       310 
     | 
    
         
            -
                    if SpecConfig.instance.serverless? || ClusterConfig.instance.storage_engine != :mmapv1
         
     | 
| 
       311 
     | 
    
         
            -
                      skip 'Test requires MMAPv1 storage engine'
         
     | 
| 
       312 
     | 
    
         
            -
                    end
         
     | 
| 
       313 
     | 
    
         
            -
                  end
         
     | 
| 
       314 
     | 
    
         
            -
                end
         
     | 
| 
       315 
     | 
    
         
            -
             
     | 
| 
       316 
     | 
    
         
            -
                def require_enterprise
         
     | 
| 
       317 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       318 
     | 
    
         
            -
                    unless ClusterConfig.instance.enterprise?
         
     | 
| 
       319 
     | 
    
         
            -
                      skip 'Test requires enterprise build of MongoDB'
         
     | 
| 
       320 
     | 
    
         
            -
                    end
         
     | 
| 
       321 
     | 
    
         
            -
                  end
         
     | 
| 
       322 
     | 
    
         
            -
                end
         
     | 
| 
       323 
     | 
    
         
            -
             
     | 
| 
       324 
     | 
    
         
            -
                # Integration tests for SRV polling require internet connectivity to
         
     | 
| 
       325 
     | 
    
         
            -
                # look up SRV records and a sharded cluster configured on default port on
         
     | 
| 
       326 
     | 
    
         
            -
                # localhost (localhost:27017, localhost:27018).
         
     | 
| 
       327 
     | 
    
         
            -
                def require_default_port_deployment
         
     | 
| 
       328 
     | 
    
         
            -
                  # Because the DNS records at test1.test.build.10gen.cc point to
         
     | 
| 
       329 
     | 
    
         
            -
                  # localhost:27017 & localhost:27018, the test suite must have been
         
     | 
| 
       330 
     | 
    
         
            -
                  # configured to use these addresses
         
     | 
| 
       331 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       332 
     | 
    
         
            -
                    have_default_port = SpecConfig.instance.addresses.any? do |address|
         
     | 
| 
       333 
     | 
    
         
            -
                      %w(127.0.0.1 127.0.0.1:27017 localhost localhost:27017).include?(address)
         
     | 
| 
       334 
     | 
    
         
            -
                    end
         
     | 
| 
       335 
     | 
    
         
            -
                    unless have_default_port
         
     | 
| 
       336 
     | 
    
         
            -
                      skip 'This test requires the test suite to be configured for localhost:27017'
         
     | 
| 
       337 
     | 
    
         
            -
                    end
         
     | 
| 
       338 
     | 
    
         
            -
                  end
         
     | 
| 
       339 
     | 
    
         
            -
                end
         
     | 
| 
       340 
     | 
    
         
            -
             
     | 
| 
       341 
     | 
    
         
            -
                # Some tests perform assertions on what the driver is logging.
         
     | 
| 
       342 
     | 
    
         
            -
                # Some test configurations, for example OCSP with unknown response,
         
     | 
| 
       343 
     | 
    
         
            -
                # produce warnings due to optional checks failing.
         
     | 
| 
       344 
     | 
    
         
            -
                # This constraint skips tests that issue logging assertions on configurations
         
     | 
| 
       345 
     | 
    
         
            -
                # that may produce non-test-originated log entries.
         
     | 
| 
       346 
     | 
    
         
            -
                def require_warning_clean
         
     | 
| 
       347 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       348 
     | 
    
         
            -
                    if ENV['OCSP_STATUS'] == 'unknown'
         
     | 
| 
       349 
     | 
    
         
            -
                      skip 'Unknown OCSP status is not global warning-clean'
         
     | 
| 
       350 
     | 
    
         
            -
                    end
         
     | 
| 
       351 
     | 
    
         
            -
                  end
         
     | 
| 
       352 
     | 
    
         
            -
                end
         
     | 
| 
       353 
     | 
    
         
            -
             
     | 
| 
       354 
     | 
    
         
            -
                def require_required_api_version
         
     | 
| 
       355 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       356 
     | 
    
         
            -
                    unless ENV['API_VERSION_REQUIRED'] == '1'
         
     | 
| 
       357 
     | 
    
         
            -
                      skip 'Set API_VERSION_REQUIRED=1 to run this test'
         
     | 
| 
       358 
     | 
    
         
            -
                    end
         
     | 
| 
       359 
     | 
    
         
            -
                  end
         
     | 
| 
       360 
     | 
    
         
            -
                end
         
     | 
| 
       361 
     | 
    
         
            -
             
     | 
| 
       362 
     | 
    
         
            -
                def require_no_required_api_version
         
     | 
| 
       363 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       364 
     | 
    
         
            -
                    if ENV['API_VERSION_REQUIRED'] == '1'
         
     | 
| 
       365 
     | 
    
         
            -
                      skip 'Cannot have API_VERSION_REQUIRED=1 to run this test'
         
     | 
| 
       366 
     | 
    
         
            -
                    end
         
     | 
| 
       367 
     | 
    
         
            -
                  end
         
     | 
| 
       368 
     | 
    
         
            -
                end
         
     | 
| 
       369 
     | 
    
         
            -
             
     | 
| 
       370 
     | 
    
         
            -
                def require_unix_socket
         
     | 
| 
       371 
     | 
    
         
            -
                  before(:all) do
         
     | 
| 
       372 
     | 
    
         
            -
                    if ENV['TOPOLOGY'] == 'load-balanced'
         
     | 
| 
       373 
     | 
    
         
            -
                      skip 'Load balancer does not listen on Unix sockets'
         
     | 
| 
       374 
     | 
    
         
            -
                    end
         
     | 
| 
       375 
     | 
    
         
            -
                  end
         
     | 
| 
       376 
     | 
    
         
            -
                end
         
     | 
| 
       377 
     | 
    
         
            -
              end
         
     | 
| 
       378 
     | 
    
         
            -
            end
         
     |