Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-2249

Investigate alternative solutions for mocking main API types

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Testing
    • Labels:

      Requests to convert our main API types (Collection, Database, Client, etc.) to interfaces instead of basic structs are continuing to come in. It's clear that users desire a more seamless way of mocking the behavior of the Go driver for their own testing. See related tickets and online discussions (GODRIVER-2161, GODRIVER-1241, GODRIVER-834, community forum posts, and comments on our PRs).

      For reasons of backwards-compatibility (usually, any additions to Go interfaces require major releases under SemVer) and Go best practices (Go official documentation advises against returning interfaces in the "implementer API"), we are against converting the structs to interfaces. But, we should really investigate alternative solutions here and think about ways to ease this user burden.

            matt.dale@mongodb.com Matt Dale
            benji.rewis@mongodb.com Benji Rewis (Inactive)
            0 Vote for this issue
            2 Start watching this issue