Skip to content

Commit

Permalink
Merge pull request #863 from go-kivik/dbChangesModes
Browse files Browse the repository at this point in the history
Document current DBUpdates behavior
  • Loading branch information
flimzy authored Jan 3, 2024
2 parents 00509ca + 8f9b449 commit 0a97b29
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
21 changes: 13 additions & 8 deletions couchdb/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,11 @@ func TestDestroyDB(t *testing.T) {

func TestDBUpdates(t *testing.T) {
tests := []struct {
name string
client *client
status int
err string
name string
client *client
options driver.Options
status int
err string
}{
{
name: "network error",
Expand Down Expand Up @@ -280,10 +281,14 @@ func TestDBUpdates(t *testing.T) {
}, nil),
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
result, err := test.client.DBUpdates(context.TODO(), nil)
if d := internal.StatusErrorDiffRE(test.err, test.status, err); d != "" {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
opts := tt.options
if opts == nil {
opts = mock.NilOption
}
result, err := tt.client.DBUpdates(context.TODO(), opts)
if d := internal.StatusErrorDiffRE(tt.err, tt.status, err); d != "" {
t.Error(d)
}
if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions updates.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ func (f *DBUpdates) Seq() string {
// no more updates, when an error occurs, or when the [DBUpdates.Close] method
// is called. The [DBUpdates.Err] method should be consulted to determine if
// there was an error during iteration.
//
// For historical reasons, the CouchDB driver's implementation of this function
// always sets feed=continuous and since=now, and ignores any options passed.
func (c *Client) DBUpdates(ctx context.Context, options ...Option) *DBUpdates {
updater, ok := c.driverClient.(driver.DBUpdater)
if !ok {
Expand Down

0 comments on commit 0a97b29

Please sign in to comment.