Uploaded image for project: 'Drivers'
  1. Drivers
  2. DRIVERS-1999

Add server selection spec test to ensure that RSGhost servers are not selectable

    • Needed
    • Hide

      Teams should resync the server selection spec tests to pull in the new test added in: https://github.com/mongodb/specifications/commit/537bb198d79d5695e735ad127ec3807689b859dd

      Note that in pymongo (PYTHON-3027) I needed to update the test runner to handle the RSGhost server type. Other drivers may need to do the same:

      diff --git a/test/utils_selection_tests.py b/test/utils_selection_tests.py
      index 0006f6f6..de10312c 100644
      --- a/test/utils_selection_tests.py
      +++ b/test/utils_selection_tests.py
      @@ -63,7 +63,7 @@ def make_server_description(server, hosts):
               return ServerDescription(clean_node(server['address']), Hello({}))
      
           hello_response = {'ok': True, 'hosts': hosts}
      -    if server_type != "Standalone" and server_type != "Mongos":
      +    if server_type not in ("Standalone", "Mongos", "RSGhost", "RSGhost"):
               hello_response['setName'] = "rs"
      
           if server_type == "RSPrimary":
      @@ -72,6 +72,8 @@ def make_server_description(server, hosts):
               hello_response['secondary'] = True
           elif server_type == "Mongos":
               hello_response['msg'] = 'isdbgrid'
      +    elif server_type == "RSGhost":
      +        hello_response['isreplicaset'] = True
      
           hello_response['lastWrite'] = {
               'lastWriteDate': make_last_write_date(server)
      
      Show
      Teams should resync the server selection spec tests to pull in the new test added in: https://github.com/mongodb/specifications/commit/537bb198d79d5695e735ad127ec3807689b859dd Note that in pymongo ( PYTHON-3027 ) I needed to update the test runner to handle the RSGhost server type. Other drivers may need to do the same: diff --git a/test/utils_selection_tests.py b/test/utils_selection_tests.py index 0006f6f6..de10312c 100644 --- a/test/utils_selection_tests.py +++ b/test/utils_selection_tests.py @@ -63,7 +63,7 @@ def make_server_description(server, hosts): return ServerDescription(clean_node(server[ 'address' ]), Hello({})) hello_response = { 'ok' : True, 'hosts' : hosts} - if server_type != "Standalone" and server_type != "Mongos" : + if server_type not in ( "Standalone" , "Mongos" , "RSGhost" , "RSGhost" ): hello_response[ 'setName' ] = "rs" if server_type == "RSPrimary" : @@ -72,6 +72,8 @@ def make_server_description(server, hosts): hello_response[ 'secondary' ] = True elif server_type == "Mongos" : hello_response[ 'msg' ] = 'isdbgrid' + elif server_type == "RSGhost" : + hello_response[ 'isreplicaset' ] = True hello_response[ 'lastWrite' ] = { 'lastWriteDate' : make_last_write_date(server)
    • $i18n.getText("admin.common.words.hide")
      Key Status/Resolution FixVersion
      PYTHON-3027 Fixed 4.0.1
      CDRIVER-4236 Backlog
      CXX-2418 Backlog
      CSHARP-3983 Backlog
      GODRIVER-2250 Backlog
      JAVA-4420 Fixed 4.5.0
      NODE-3797 Fixed 4.4.0
      PHPLIB-769 Won't Do
      MOTOR-863 Duplicate
      RUBY-2850 Fixed 2.18.0
      RUST-1121 Backlog
      SWIFT-1428 Duplicate
      $i18n.getText("admin.common.words.show")
      #scriptField, #scriptField *{ border: 1px solid black; } #scriptField{ border-collapse: collapse; } #scriptField td { text-align: center; /* Center-align text in table cells */ } #scriptField td.key { text-align: left; /* Left-align text in the Key column */ } #scriptField a { text-decoration: none; /* Remove underlines from links */ border: none; /* Remove border from links */ } /* Add green background color to cells with FixVersion */ #scriptField td.hasFixVersion { background-color: #00FF00; /* Green color code */ } /* Center-align the first row headers */ #scriptField th { text-align: center; } Key Status/Resolution FixVersion PYTHON-3027 Fixed 4.0.1 CDRIVER-4236 Backlog CXX-2418 Backlog CSHARP-3983 Backlog GODRIVER-2250 Backlog JAVA-4420 Fixed 4.5.0 NODE-3797 Fixed 4.4.0 PHPLIB-769 Won't Do MOTOR-863 Duplicate RUBY-2850 Fixed 2.18.0 RUST-1121 Backlog SWIFT-1428 Duplicate

      When a client starts up and initially discovers a RSGhost node, the SDAM spec says that the topology type must remain Unknown. PyMongo recently had a bug where the RSGhost node would be selectable in this scenario (PYTHON-3027). We should add server selection spec tests to ensure that RSGhost servers are not selectable.

            Assignee:
            shane.harvey@mongodb.com Shane Harvey
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: