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

Produce URI options from Client for URI spec tests

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 2.14.0.rc1
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • The handling of readPreferenceTags, authMechanismProperties and maxStalenessSeconds URI options was changed to not create keys in a Client's URI options without values when the values provided were invalid.
    • Minor Change

      The scope for this ticket is a private API that would be usable in the spec tests that deal with URI options.

      Currently URI options spec tests essentially perform their own URI option parsing that is parallel to the option parsing performed by the driver, and then assert that the final options are the same.

      Instead of that I propose converting Ruby options to what I call "standardized MongoClient options" and assert that those are equal to the options specified in the spec tests as expectations.

      Additionally, comparisons performed should be exact rather than subsets (which exposed problems like https://jira.mongodb.org/browse/DRIVERS-1368).

      We still need to fudge comparisons in the spec tests because:

      • appName vs appname spelling differences (the URI options spec actually specifies appname as the option name currently, Ruby is going to use appName, https://jira.mongodb.org/browse/DRIVERS-1247)
      • Connection string spec tests specify SMC option names in all lowercase
      • Driver defaults some options (retryReads, retryWrites, service_name for gssapi auth mechanism) and spec tests don't account for these defaults which is problematic since we take actual values out of the client after these options have been defaulted
      • Driver lowercases auth mechanism properties whereas spec tests expect case preservation; preserving case is problematic due to the service_name default

      Behavior changes resulting from the work in this ticket:

      • Positive but invalid maxStaleness values will now be dropped with a warning as per URI options spec. Previously they would be passed to client and fail operations. Note that invalid positive values given to client as Ruby options will continue to fail operations. https://jira.mongodb.org/browse/DRIVERS-1370
      • When a string given to read preference tag set or auth mechanism is invalid (e.g. doesn't contain the : separator and hence a key/value pair), previously the driver would put the specified string as the key into the client option. Now the string would be dropped.
      • If some strings are valid and some are invalid, Ruby keeps the valid tags/properties. https://jira.mongodb.org/browse/DRIVERS-1369
      • Read preference tag sets, auth mechanism properties, max staleness values and possibly other URI options will not have their keys added when the values fail validation (i.e. empty hashes for the first two, nil for the last one).

            Assignee:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: