Uploaded image for project: 'Couchbase .NET client library'
  1. Couchbase .NET client library
  2. NCBC-2337

Remove ClusterContext requirement from service clients

    XMLWordPrintable

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.0.0
    • library
    • None
    • 1

    Description

      The only reason we inject ClusterContext into the various service HTTP clients is to get the service URI. This is overcomplicating a lot of unit tests, as they are forced to build a large portion of the ClusterContext's backing configuration to support this. Instead, we can create IServiceUriProvider to provide random service URIs, and inject this. Then it is much more easily mockable in unit tests.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          jmorris Jeff Morris added a comment -

          Brant Burnett - just don't forget that server topology changes are dynamic and URIs should be provided as close to the request as possible so that Tasks that are scheduled don't contain stale URIs when execution continues.

          jmorris Jeff Morris added a comment - Brant Burnett - just don't forget that server topology changes are dynamic and URIs should be provided as close to the request as possible so that Tasks that are scheduled don't contain stale URIs when execution continues.

          Jeff Morris This change does still meet that requirement, the calls are still forwarded to ClusterContext to get the current nodes on each request. This merely adds an abstraction layer so that the dependency on ClusterContext is indirect instead of direct, making unit tests much simpler and less like integration tests.

          btburnett3 Brant Burnett added a comment - Jeff Morris This change does still meet that requirement, the calls are still forwarded to ClusterContext to get the current nodes on each request. This merely adds an abstraction layer so that the dependency on ClusterContext is indirect instead of direct, making unit tests much simpler and less like integration tests.
          jmorris Jeff Morris added a comment -

          Yup, I saw that

          jmorris Jeff Morris added a comment - Yup, I saw that

          People

            btburnett3 Brant Burnett
            btburnett3 Brant Burnett
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty