apache / couchdb

Seamless multi-master syncing database with an intuitive HTTP/JSON API, designed for reliability
https://couchdb.apache.org/
Apache License 2.0
6.17k stars 1.03k forks source link

Translate Mango Python integration tests to Elixir #4501

Open pgj opened 1 year ago

pgj commented 1 year ago

Currently, Mango has its own integration tests that are implemented in Python and have to be activated separately via the mango-tests make(1) target. Re-write them in Elixir to integrate them better with the rest of the integration tests that are in use for CouchDB. This move could bring more simplification and regularization to the code base, removing the dependency on Nose2.

nickva commented 1 year ago

Good idea. It could be done step-wise, one file or feature at a time. Move from one test suite to the other over time. We did it similarly with Javascript -> Elixir move a few years back.

If bringing in Nose2 is a hassle, another way could be to try to see if Python 3's built-in https://docs.python.org/3/library/unittest.html#module-unittest has the feature nose2 uses. The tests were written during the Python2 days and Python had some improvements since.

pgj commented 1 year ago

Personally, I do not have any problems with Nose2. But if the integration tests were migrated to Elixir, there is no need for it any more. On its web site, it considers itself obsolete -- but instead of moving to another Python-based framework, consider Elixir directly.

nickva commented 1 year ago

That's fair re: not having another language in the mix. Not all contributors might be versed in Python. So then we have Erlang, Python and Elixir.

Going that route and seeing that we're running a single node test server anyway, we could just move them to Erlang as well. The verbosity is about the same view_include_docs_test.exs vs chttpd_revs_diff_tests.erl and it gives a chance to collect code coverage and if needed use mock intercepts for some grey-box testing or induce failures.

big-r81 commented 1 year ago

Personally, I wouldn't write (or migrate) any test to Elixir, because I see no benefits in learning and using a second/third programming language to add contributions to CouchDB. As a new developer to CouchDB (and Erlang), I found using a second language more of an obstacle than an asset.

pgj commented 1 year ago

I am not sure if I got you right @big-r81. Elixir has already been used in CouchDB and there are a lot of integration tests written in that language. And, on the top of that, there is Python for Mango.

Or are you saying that we should just leave Python there, because the chances are likely that new contributors are already familiar with it?

big-r81 commented 1 year ago

@pgj yes, there are a lot of Elixir tests (from the migration from Javascript, if I get this right). This is only a personal preference of me, not to use Elixir for tests. I think the move to using Elixir was made back then to attract more developers. I don't think this happened... But feel free to use Elixir. 🙂

jjrodrig commented 1 year ago

From my experience as an Elixir test suite contributor, I found that Elixir allows new contributions much easier than Erlang does.

In this case, Python is the exception in the test suite, so I think it is a good idea to simplify this part and migrate these tests to the integration test suite based on Elixir.