tonysun83 commented on a change in pull request #962: Mango: generate a warning 
instead of an error when an user-specified index cannot be used
URL: https://github.com/apache/couchdb/pull/962#discussion_r153701470
 
 

 ##########
 File path: src/mango/test/05-index-selection-test.py
 ##########
 @@ -108,41 +103,53 @@ def 
test_reject_use_index_ddoc_and_name_invalid_fields(self):
         selector = {
             "company": "Pharmex"
         }
-        try:
-            self.db.find(selector, use_index=[ddocid,name])
-        except Exception as e:
-            self.assertEqual(e.response.status_code, 400)
-        else:
-            raise AssertionError("did not reject bad use_index")
+        
+        resp = self.db.find(selector, use_index=[ddocid,name], return_raw=True)
+        self.assertEqual(resp["warning"], "{0}, {1} was not used because it is 
not a valid index for this query.".format(ddocid, name))
 
 Review comment:
   in the test case above, you're checking that a value is added
   ```
   # should still return a correct result
   for d in r["docs"]:
       self.assertEqual(d["company"], "Pharmex")
   ```
   We should be consistent?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to