Skip to content

Commit

Permalink
[FAB-7757] CouchDB unit tests fail for CouchDB 2.1.1
Browse files Browse the repository at this point in the history
Index definitions in CouchDB 2.1.1 allow for a Partial Filter Selector
in the index definition.   When an index definition is returned by
CouchDB, it now includes this as part of the JSON response.

The unit test needs to verify that the correct field and sort is in
the JSON response and ignore the rest of the index definition.

Change-Id: Iaeefd1dfee6b1b918b061925c74280637458c842
Signed-off-by: Chris Elder <chris.elder@us.ibm.com>
  • Loading branch information
Chris Elder committed Jan 16, 2018
1 parent ce1f6a4 commit 29863eb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/ledger/util/couchdb/couchdb_test.go
Expand Up @@ -960,10 +960,13 @@ func TestIndexOperations(t *testing.T) {

//There should only be one item returned
testutil.AssertEquals(t, len(*listResult), 1)

//Verify the returned definition
for _, elem := range *listResult {
testutil.AssertEquals(t, elem.DesignDocument, "indexSizeSortDoc")
testutil.AssertEquals(t, elem.Name, "indexSizeSortName")
testutil.AssertEquals(t, elem.Definition, "{\"fields\":[{\"size\":\"desc\"}]}")
//ensure the index defintion is correct, CouchDB 2.1.1 will also return "partial_filter_selector":{}
testutil.AssertEquals(t, strings.Contains(elem.Definition, `"fields":[{"size":"desc"}]`), true)
}

//Create an index definition with no DesignDocument or name
Expand Down

0 comments on commit 29863eb

Please sign in to comment.