pgj opened a new pull request, #4437:
URL: https://github.com/apache/couchdb/pull/4437

   This pull request attempts to fix up many problems that were observed while 
trying to run the Python-based integration tests for the Mango interface.  
Notably:
   
   - _Tighten integration between the `mango-test` `make` target and the 
invocation of the Python tests._  Prefer the use `mango-test` over Mango's own 
way of running the suites.  It does the same things and it is mostly automated 
already.  Similarly to other kind of tests, introduce the `MANGO_TEST_OPTS` 
variable for the greater degree of flexibility.  Remove the inconsistent 
support for external fixture setup and adjust `mango.py` towards working with 
`dev/run`.
   - _Merge Mango integration test suite documentation into the general 
developer documentation._  Remove redundancy in documentation to make it 
consistent with other test suites in the code base.
   - _Fix Unicode key tests._  They were broken due to misconfiguration of 
source file encoding.  Leverage the same opportunity to update the tests files 
to assume Python 3 and be treated Unicode text files by default.
   - _Mark `$keyMapMatch` tests for text indexes skipped._  Add the missing 
`skipUnless` annotation for one of the operator tests that does not apply for 
text indexes.
   - _Automate activation of text-index-based test cases._  Propose another 
approach to activating the tests for text indexes -- instead of the use of the 
`MANGO_TEXT_INDEXES` environment variable, detect the presence of the `search` 
feature on the fly and use that as a clue for running the affected tests.
   
   In addition that, revamp the general developer documentation by improving on 
the structure, formatting, revisiting internal and external links, and fixing 
up various Markdown issues.  The overall goal is to make the Mango integration 
tests and their associated documentation more usable for developers.
   
   Things looked like before -- regular case, without `search`:
   
   ```console
   $ make mango-test
   [..]
   [ * ] Setup environment ... ok
   [ * ] Ensure CouchDB is built ... ok
   [ * ] Ensure Erlang boot script exists ... ok
   [ * ] Prepare configuration files ... ok
   [ * ] Start node node1 ... ok
   [ * ] Check node at http://127.0.0.1:15984/ ... ok
   [ * ] Running cluster setup ... ok
   [ * ] Exec command .venv/bin/python3 -m nose2 ... 
.........................................ssssssssssssssssssss..........sssssssssssssssssss.......ssssssss...................sss.....ss.........sssssssssssssssssssssssssssssssssssssss....................................................ssssssssssss.........sssssssss...........................sssssssss............sssssssssssssssss
   ----------------------------------------------------------------------
   Ran 329 tests in 30.989s
   
   OK (skipped=138)
   ```
   
   with `search` and explicit activation of text index cases:
   
   ```console
   $ MANGO_TEXT_INDEXES=1 make mango-test
   [..]
   [ * ] Setup environment ... ok
   [ * ] Ensure CouchDB is built ... ok
   [ * ] Ensure Erlang boot script exists ... ok
   [ * ] Prepare configuration files ... ok
   [ * ] Start node node1 ... ok
   [ * ] Check node at http://127.0.0.1:15984/ ... ok
   [ * ] Running cluster setup ... ok
   [ * ] Exec command .venv/bin/python3 -m nose2 ... 
........s..s.s.s.............s..s.s.s............s.Es.s.s...........................................................................................FE................................s..................................................................................................................................................
   ======================================================================
   ERROR: test_keymap_match (03-operator-test.OperatorTextTests)
   ----------------------------------------------------------------------
   Traceback (most recent call last):
     File 
"/Users/gaborpali/projects/github/couchdb/src/mango/test/03-operator-test.py", 
line 75, in test_keymap_match
       docs = self.db.find({"foo": {"$keyMapMatch": {"$eq": "aa"}}})
     File "/Users/gaborpali/projects/github/couchdb/src/mango/test/mango.py", 
line 280, in find
       r.raise_for_status()
     File 
"/Users/gaborpali/projects/github/couchdb/src/mango/.venv/lib/python3.9/site-packages/requests/models.py",
 line 960, in raise_for_status
       raise HTTPError(http_error_msg, response=self)
   requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: 
http://127.0.0.1:15984/mango_test_d76485e8c5f24893b3105bafde824802/_find
   
   ======================================================================
   ERROR: test_unicode_in_selector_field (04-key-tests.KeyTests)
   ----------------------------------------------------------------------
   Traceback (most recent call last):
     File 
"/Users/gaborpali/projects/github/couchdb/src/mango/test/04-key-tests.py", line 
111, in test_unicode_in_selector_field
       self.run_check(query, check, indexes=["text"])
     File 
"/Users/gaborpali/projects/github/couchdb/src/mango/test/04-key-tests.py", line 
60, in run_check
       check(docs)
     File 
"/Users/gaborpali/projects/github/couchdb/src/mango/test/04-key-tests.py", line 
109, in check
       assert docs[0]["\uf8ff"] == "apple"
   KeyError: '\uf8ff'
   
   ======================================================================
   FAIL: test_unicode_in_fieldname (04-key-tests.KeyTests)
   ----------------------------------------------------------------------
   Traceback (most recent call last):
     File 
"/Users/gaborpali/projects/github/couchdb/src/mango/test/04-key-tests.py", line 
98, in test_unicode_in_fieldname
       self.run_check(query, check, fields=fields)
     File 
"/Users/gaborpali/projects/github/couchdb/src/mango/test/04-key-tests.py", line 
60, in run_check
       check(docs)
     File 
"/Users/gaborpali/projects/github/couchdb/src/mango/test/04-key-tests.py", line 
95, in check
       assert "\uf8ff" in docs[3]
   AssertionError
   
   ----------------------------------------------------------------------
   Ran 329 tests in 42.152s
   
   FAILED (failures=1, errors=2, skipped=13)
   make: *** [mango-test] Error 1
   ```
   
   After this set of changes -- regular case, without `search`:
   
   ```console
   $ make mango-test
   [..]
   [ * ] Setup environment ... ok
   [ * ] Ensure CouchDB is built ... ok
   [ * ] Ensure Erlang boot script exists ... ok
   [ * ] Prepare configuration files ... ok
   [ * ] Start node node1 ... ok
   [ * ] Check node at http://127.0.0.1:15984/ ... ok
   [ * ] Running cluster setup ... ok
   [ * ] Exec command COUCH_USER=adm COUCH_PASS=pass .venv/bin/python3 -m nose2 
 ... 
.........................................ssssssssssssssssssss..........sssssssssssssssssss.......ssssssss...................sss.....ss.........sssssssssssssssssssssssssssssssssssssss....................................................ssssssssssss.........sssssssss...........................sssssssss............sssssssssssssssss
   ----------------------------------------------------------------------
   Ran 329 tests in 28.455s
   
   OK (skipped=138)
   ```
   
   with `search` activated:
   
   ```console
   $ make mango-test
   [..]
   [ * ] Setup environment ... ok
   [ * ] Ensure CouchDB is built ... ok
   [ * ] Ensure Erlang boot script exists ... ok
   [ * ] Prepare configuration files ... ok
   [ * ] Start node node1 ... ok
   [ * ] Check node at http://127.0.0.1:15984/ ... ok
   [ * ] Running cluster setup ... ok
   [ * ] Exec command COUCH_USER=adm COUCH_PASS=pass .venv/bin/python3 -m nose2 
 ... 
........s.ss.s.s.............s.ss.s.s............s.ss.s.s.............................................................................................................................s..................................................................................................................................................
   ----------------------------------------------------------------------
   Ran 329 tests in 41.617s
   
   OK (skipped=16)
   ```
   
   using `MANGO_TEST_OPTS`, without `search`:
   
   ```console
   $ make mango-test MANGO_TEST_OPTS='--verbose 03-operator-test'
   [..]
   [ * ] Setup environment ... ok
   [ * ] Ensure CouchDB is built ... ok
   [ * ] Ensure Erlang boot script exists ... ok
   [ * ] Prepare configuration files ... ok
   [ * ] Start node node1 ... ok
   [ * ] Check node at http://127.0.0.1:15984/ ... ok
   [ * ] Running cluster setup ... ok
   [ * ] Exec command COUCH_USER=adm COUCH_PASS=pass .venv/bin/python3 -m nose2 
--verbose 03-operator-test ... test_all (03-operator-test.OperatorAllDocsTests) 
... ok
   test_all_match (03-operator-test.OperatorAllDocsTests) ... ok
   test_all_non_array (03-operator-test.OperatorAllDocsTests) ... ok
   test_elem_match (03-operator-test.OperatorAllDocsTests) ... ok
   test_empty_all_match (03-operator-test.OperatorAllDocsTests) ... ok
   test_eq_null_does_not_include_missing 
(03-operator-test.OperatorAllDocsTests) ... ok
   test_exists_false (03-operator-test.OperatorAllDocsTests) ... ok
   test_exists_false_returns_missing_but_not_null 
(03-operator-test.OperatorAllDocsTests) ... ok
   test_gte_respsects_unicode_collation (03-operator-test.OperatorAllDocsTests) 
... ok
   test_in_operator_array (03-operator-test.OperatorAllDocsTests) ... ok
   test_keymap_match (03-operator-test.OperatorAllDocsTests) ... ok
   test_lt_includes_null_but_not_missing 
(03-operator-test.OperatorAllDocsTests) ... ok
   test_lte_at_z_except_null_excludes_null_and_missing 
(03-operator-test.OperatorAllDocsTests) ... ok
   test_lte_includes_null_but_not_missing 
(03-operator-test.OperatorAllDocsTests) ... ok
   test_lte_null_includes_null_but_not_missing 
(03-operator-test.OperatorAllDocsTests) ... ok
   test_lte_respsects_unicode_collation (03-operator-test.OperatorAllDocsTests) 
... ok
   test_ne_includes_null_but_not_missing 
(03-operator-test.OperatorAllDocsTests) ... ok
   test_nin_operator_array (03-operator-test.OperatorAllDocsTests) ... ok
   test_range_gte_null_includes_null_but_not_missing 
(03-operator-test.OperatorAllDocsTests) ... ok
   test_range_id_eq (03-operator-test.OperatorAllDocsTests) ... ok
   test_regex (03-operator-test.OperatorAllDocsTests) ... ok
   test_all (03-operator-test.OperatorJSONTests) ... ok
   test_all_match (03-operator-test.OperatorJSONTests) ... ok
   test_all_non_array (03-operator-test.OperatorJSONTests) ... ok
   test_elem_match (03-operator-test.OperatorJSONTests) ... ok
   test_empty_all_match (03-operator-test.OperatorJSONTests) ... ok
   test_eq_null_does_not_include_missing (03-operator-test.OperatorJSONTests) 
... ok
   test_exists_false (03-operator-test.OperatorJSONTests) ... ok
   test_exists_false_returns_missing_but_not_null 
(03-operator-test.OperatorJSONTests) ... ok
   test_gte_respsects_unicode_collation (03-operator-test.OperatorJSONTests) 
... ok
   test_in_operator_array (03-operator-test.OperatorJSONTests) ... ok
   test_keymap_match (03-operator-test.OperatorJSONTests) ... ok
   test_lt_includes_null_but_not_missing (03-operator-test.OperatorJSONTests) 
... ok
   test_lte_at_z_except_null_excludes_null_and_missing 
(03-operator-test.OperatorJSONTests) ... ok
   test_lte_includes_null_but_not_missing (03-operator-test.OperatorJSONTests) 
... ok
   test_lte_null_includes_null_but_not_missing 
(03-operator-test.OperatorJSONTests) ... ok
   test_lte_respsects_unicode_collation (03-operator-test.OperatorJSONTests) 
... ok
   test_ne_includes_null_but_not_missing (03-operator-test.OperatorJSONTests) 
... ok
   test_nin_operator_array (03-operator-test.OperatorJSONTests) ... ok
   test_range_gte_null_includes_null_but_not_missing 
(03-operator-test.OperatorJSONTests) ... ok
   test_regex (03-operator-test.OperatorJSONTests) ... ok
   test_all (03-operator-test.OperatorTextTests) ... skipped requires text 
service
   test_all_match (03-operator-test.OperatorTextTests) ... skipped requires 
text service
   test_all_non_array (03-operator-test.OperatorTextTests) ... skipped requires 
text service
   test_elem_match (03-operator-test.OperatorTextTests) ... skipped requires 
text service
   test_empty_all_match (03-operator-test.OperatorTextTests) ... skipped 
requires text service
   test_eq_null_does_not_include_missing (03-operator-test.OperatorTextTests) 
... skipped requires text service
   test_exists_false (03-operator-test.OperatorTextTests) ... skipped requires 
text service
   test_exists_false_returns_missing_but_not_null 
(03-operator-test.OperatorTextTests) ... skipped requires text service
   test_gte_respsects_unicode_collation (03-operator-test.OperatorTextTests) 
... skipped requires text service
   test_in_operator_array (03-operator-test.OperatorTextTests) ... skipped 
requires text service
   test_keymap_match (03-operator-test.OperatorTextTests) ... skipped requires 
text service
   test_lt_includes_null_but_not_missing (03-operator-test.OperatorTextTests) 
... skipped requires text service
   test_lte_at_z_except_null_excludes_null_and_missing 
(03-operator-test.OperatorTextTests) ... skipped requires text service
   test_lte_includes_null_but_not_missing (03-operator-test.OperatorTextTests) 
... skipped requires text service
   test_lte_null_includes_null_but_not_missing 
(03-operator-test.OperatorTextTests) ... skipped requires text service
   test_lte_respsects_unicode_collation (03-operator-test.OperatorTextTests) 
... skipped requires text service
   test_ne_includes_null_but_not_missing (03-operator-test.OperatorTextTests) 
... skipped requires text service
   test_nin_operator_array (03-operator-test.OperatorTextTests) ... skipped 
requires text service
   test_range_gte_null_includes_null_but_not_missing 
(03-operator-test.OperatorTextTests) ... skipped requires text service
   test_regex (03-operator-test.OperatorTextTests) ... skipped requires text 
service
   
   ----------------------------------------------------------------------
   Ran 61 tests in 0.860s
   
   OK (skipped=20)
   ```
   
   or with `search`:
   
   ```console
   $ make mango-test MANGO_TEST_OPTS='--verbose 03-operator-test'
   [..]
   [ * ] Setup environment ... ok
   [ * ] Ensure CouchDB is built ... ok
   [ * ] Ensure Erlang boot script exists ... ok
   [ * ] Prepare configuration files ... ok
   [ * ] Start node node1 ... ok
   [ * ] Check node at http://127.0.0.1:15984/ ... ok
   [ * ] Running cluster setup ... ok
   [ * ] Exec command COUCH_USER=adm COUCH_PASS=pass .venv/bin/python3 -m nose2 
--verbose 03-operator-test ... test_all (03-operator-test.OperatorAllDocsTests) 
... ok
   test_all_match (03-operator-test.OperatorAllDocsTests) ... ok
   test_all_non_array (03-operator-test.OperatorAllDocsTests) ... ok
   test_elem_match (03-operator-test.OperatorAllDocsTests) ... ok
   test_empty_all_match (03-operator-test.OperatorAllDocsTests) ... ok
   test_eq_null_does_not_include_missing 
(03-operator-test.OperatorAllDocsTests) ... ok
   test_exists_false (03-operator-test.OperatorAllDocsTests) ... ok
   test_exists_false_returns_missing_but_not_null 
(03-operator-test.OperatorAllDocsTests) ... ok
   test_gte_respsects_unicode_collation (03-operator-test.OperatorAllDocsTests) 
... skipped text indexes do not support range queries across type boundaries
   test_in_operator_array (03-operator-test.OperatorAllDocsTests) ... ok
   test_keymap_match (03-operator-test.OperatorAllDocsTests) ... skipped text 
indexes do not support the $keyMapMatch operator
   test_lt_includes_null_but_not_missing 
(03-operator-test.OperatorAllDocsTests) ... skipped text indexes do not support 
range queries across type boundaries
   test_lte_at_z_except_null_excludes_null_and_missing 
(03-operator-test.OperatorAllDocsTests) ... ok
   test_lte_includes_null_but_not_missing 
(03-operator-test.OperatorAllDocsTests) ... skipped text indexes do not support 
range queries across type boundaries
   test_lte_null_includes_null_but_not_missing 
(03-operator-test.OperatorAllDocsTests) ... ok
   test_lte_respsects_unicode_collation (03-operator-test.OperatorAllDocsTests) 
... skipped text indexes do not support range queries across type boundaries
   test_ne_includes_null_but_not_missing 
(03-operator-test.OperatorAllDocsTests) ... ok
   test_nin_operator_array (03-operator-test.OperatorAllDocsTests) ... ok
   test_range_gte_null_includes_null_but_not_missing 
(03-operator-test.OperatorAllDocsTests) ... ok
   test_range_id_eq (03-operator-test.OperatorAllDocsTests) ... ok
   test_regex (03-operator-test.OperatorAllDocsTests) ... ok
   test_all (03-operator-test.OperatorJSONTests) ... ok
   test_all_match (03-operator-test.OperatorJSONTests) ... ok
   test_all_non_array (03-operator-test.OperatorJSONTests) ... ok
   test_elem_match (03-operator-test.OperatorJSONTests) ... ok
   test_empty_all_match (03-operator-test.OperatorJSONTests) ... ok
   test_eq_null_does_not_include_missing (03-operator-test.OperatorJSONTests) 
... ok
   test_exists_false (03-operator-test.OperatorJSONTests) ... ok
   test_exists_false_returns_missing_but_not_null 
(03-operator-test.OperatorJSONTests) ... ok
   test_gte_respsects_unicode_collation (03-operator-test.OperatorJSONTests) 
... skipped text indexes do not support range queries across type boundaries
   test_in_operator_array (03-operator-test.OperatorJSONTests) ... ok
   test_keymap_match (03-operator-test.OperatorJSONTests) ... skipped text 
indexes do not support the $keyMapMatch operator
   test_lt_includes_null_but_not_missing (03-operator-test.OperatorJSONTests) 
... skipped text indexes do not support range queries across type boundaries
   test_lte_at_z_except_null_excludes_null_and_missing 
(03-operator-test.OperatorJSONTests) ... ok
   test_lte_includes_null_but_not_missing (03-operator-test.OperatorJSONTests) 
... skipped text indexes do not support range queries across type boundaries
   test_lte_null_includes_null_but_not_missing 
(03-operator-test.OperatorJSONTests) ... ok
   test_lte_respsects_unicode_collation (03-operator-test.OperatorJSONTests) 
... skipped text indexes do not support range queries across type boundaries
   test_ne_includes_null_but_not_missing (03-operator-test.OperatorJSONTests) 
... ok
   test_nin_operator_array (03-operator-test.OperatorJSONTests) ... ok
   test_range_gte_null_includes_null_but_not_missing 
(03-operator-test.OperatorJSONTests) ... ok
   test_regex (03-operator-test.OperatorJSONTests) ... ok
   test_all (03-operator-test.OperatorTextTests) ... ok
   test_all_match (03-operator-test.OperatorTextTests) ... ok
   test_all_non_array (03-operator-test.OperatorTextTests) ... ok
   test_elem_match (03-operator-test.OperatorTextTests) ... ok
   test_empty_all_match (03-operator-test.OperatorTextTests) ... ok
   test_eq_null_does_not_include_missing (03-operator-test.OperatorTextTests) 
... ok
   test_exists_false (03-operator-test.OperatorTextTests) ... ok
   test_exists_false_returns_missing_but_not_null 
(03-operator-test.OperatorTextTests) ... ok
   test_gte_respsects_unicode_collation (03-operator-test.OperatorTextTests) 
... skipped text indexes do not support range queries across type boundaries
   test_in_operator_array (03-operator-test.OperatorTextTests) ... ok
   test_keymap_match (03-operator-test.OperatorTextTests) ... skipped text 
indexes do not support the $keyMapMatch operator
   test_lt_includes_null_but_not_missing (03-operator-test.OperatorTextTests) 
... skipped text indexes do not support range queries across type boundaries
   test_lte_at_z_except_null_excludes_null_and_missing 
(03-operator-test.OperatorTextTests) ... ok
   test_lte_includes_null_but_not_missing (03-operator-test.OperatorTextTests) 
... skipped text indexes do not support range queries across type boundaries
   test_lte_null_includes_null_but_not_missing 
(03-operator-test.OperatorTextTests) ... ok
   test_lte_respsects_unicode_collation (03-operator-test.OperatorTextTests) 
... skipped text indexes do not support range queries across type boundaries
   test_ne_includes_null_but_not_missing (03-operator-test.OperatorTextTests) 
... ok
   test_nin_operator_array (03-operator-test.OperatorTextTests) ... ok
   test_range_gte_null_includes_null_but_not_missing 
(03-operator-test.OperatorTextTests) ... ok
   test_regex (03-operator-test.OperatorTextTests) ... ok
   
   ----------------------------------------------------------------------
   Ran 61 tests in 0.905s
   
   OK (skipped=15)
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to