danionescu0 / docker-flask-mongodb-example

Uses docker compose with a python flask microservice and MongoDB instance to make a sample application
GNU General Public License v3.0
99 stars 41 forks source link

Update python libraries in requirements.txt to latest stable versions #54

Open danionescu0 opened 3 years ago

danionescu0 commented 3 years ago

test if all works ok

neelabalan commented 3 years ago

Hi. Can I take this up?

danionescu0 commented 3 years ago

Sure. Just please test all services (api requests)

neelabalan commented 3 years ago

Sure. Is there any testing methodoloy involved here or will it be just testing the requests individually with curl

danionescu0 commented 3 years ago

Curl for now, or if you want to automate it you i've raised an issue some time ago: https://github.com/danionescu0/docker-flask-mongodb-example/issues/20

There are functional tests libraries, you can use pyramid for example: https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/testing.html

Tell me what you decide

neelabalan commented 3 years ago

I haven't worked on functional tests before. For now I will test it with curl and do some reading on functional tests.

danionescu0 commented 3 years ago

Ok, let me know if i can help you with it

neelabalan commented 3 years ago

Sure. Thank you.

danionescu0 commented 3 years ago

You can test easily from the Swagger interface

neelabalan commented 3 years ago

Yeah. I did that for testing #51

neelabalan commented 3 years ago

Hi. I have completed testing all the services after the updating the packages to latest stable versions. I haven't updated the version for pymongo driver because updating to latest version was causing some error after the update. I cound't figure out the cause of the error but I can see that this has to do with create_index.

detailed error from logs

web-fulltext-search_1     | Traceback (most recent call last):
web-fulltext-search_1     |   File "/root/flask-mongodb-example/python/fulltext_search.py", line 81, in <module>
web-fulltext-search_1     |     fulltext_search.create_index([('app_text', TEXT)], name='fulltextsearch_index', default_language='english')
web-fulltext-search_1     |   File "/usr/local/lib/python3.8/site-packages/pymongo/collection.py", line 2059, in create_index
web-fulltext-search_1     |     return self.__create_indexes([index], session, **cmd_options)[0]
web-fulltext-search_1     |   File "/usr/local/lib/python3.8/site-packages/pymongo/collection.py", line 1949, in __create_indexes
web-fulltext-search_1     |     self._command(
web-fulltext-search_1     |   File "/usr/local/lib/python3.8/site-packages/pymongo/collection.py", line 238, in _command
web-fulltext-search_1     |     return sock_info.command(
web-fulltext-search_1     |   File "/usr/local/lib/python3.8/site-packages/pymongo/pool.py", line 699, in command
web-fulltext-search_1     |     self._raise_connection_failure(error)
web-fulltext-search_1     |   File "/usr/local/lib/python3.8/site-packages/pymongo/pool.py", line 683, in command
web-fulltext-search_1     |     return command(self, dbname, spec, slave_ok,
web-fulltext-search_1     |   File "/usr/local/lib/python3.8/site-packages/pymongo/network.py", line 159, in command
web-fulltext-search_1     |     helpers._check_command_response(
web-fulltext-search_1     |   File "/usr/local/lib/python3.8/site-packages/pymongo/helpers.py", line 151, in _check_command_response
web-fulltext-search_1     |     raise NotMasterError(errmsg, response)
web-fulltext-search_1     | pymongo.errors.NotMasterError: not master, full error: {'topologyVersion': {'processId': ObjectId('60365e9c3243f6762818c4aa'), 'counter': 0}, 'operationTime': Timestamp(0, 0), 'ok': 0.0, 'errmsg': 'not master', 'code': 10107, 'codeName': 'NotWritablePrimary', '$clusterTime': {'clusterTime': Timestamp(0, 0), 'signature': {'hash': b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'keyId': 0}}}
docker-flask-mongodb-example_web-fulltext-search_1 exited with code 1
neelabalan commented 3 years ago

I've updated the packages for requirements.txt, requirements-restplus.txt and requirements-fastapi.txt

Here are the commands I used for testing all the services after referring to both the Github documentation and Swagger interface

Let me know if I can raise a PR for the package updates.

danionescu0 commented 3 years ago

That's great news! Please raise a PR and about the testing commands , i think they'll be usefull for semi-automatic testing until functional testing is in place. Could you put the in the root folder of the projec, name it testing.txt and maybe use curl inside so that it can be copy-paste it easily? Thanks

neelabalan commented 3 years ago

Sure. For the commands I used httpie for all the testing since it was easy to work and has inbuilt JSON support. I will move all of those commands to curl and raise a seperate PR.

danionescu0 commented 3 years ago

Oh i see, well i looked in diagonal and haven't noticed. Curl it's more used but you can live it with httpie if you like.

neelabalan commented 3 years ago

Moving them to curl shouldn't take much work. I will do short test and port them.

neelabalan commented 3 years ago

I totally forgot to add here that I haven't updated the Werkzeug package (0.16.1) to latest version (1.0.0) in requirement-restuplus.txt because I found that updating it causes errors and those need to be fixed from flask-restplus side which I think won't be happening because the flask-restplus project is no longer maintained.

https://github.com/noirbizarre/flask-restplus/issues/770

danionescu0 commented 3 years ago

Oh ok, that's all right we'll postpone the update until they have someting stable