Commit Graph

9 Commits

Author SHA1 Message Date
realaravinth
a971d4209d fix and chore: refactor tests to minimize initializing DB connections
SUMMARY
    The test suite was spinning up way too many database connections that what's
    strictly needed and so the test suite was failing with[0]:
	code: "53300", message: "sorry, too many clients already"

EXPERIMENTS
    Tried sharing database connection pool across all tests with
    async_once[0] but faced:
	- IO errors
	    The connections were probably getting dropped in between tests
	- actix Actor errors
	    The actor was probably not getting initialized before a
	    a reference to the async_once initialized app
	    context(crate::data::Data) is retrieved and used

FIX
    crate::tests was spinning up an App context
    instance(crate::data::Data) for most utility functions, which was
    unnecessarily excessive.

    Each test now creates an instance of the application context at the
    beginning and shared a reference with all test utility functions. So
    number of database connections/app context instance = number of unit
    tests.

[0]: permanently fixes #22
[1]: https://docs.rs/async_once/latest/async_once/
2022-05-14 12:55:56 +05:30
realaravinth
a668fafa62 feat: migrate v1 api mod to use actix_auth_middleware 2022-05-07 12:29:37 +05:30
realaravinth
fc8a1670d2 update copyright notice 2022-01-08 22:16:05 +05:30
realaravinth
147f563ec8 demo user task 2021-08-09 11:56:25 +05:30
realaravinth
b7ec1bca22 duplicate email check and address clippy warnings 2021-07-11 21:46:50 +05:30
realaravinth
f5624947b9 redis storage for captcha mech 2021-06-11 19:31:03 +05:30
realaravinth
fcdbe66b26 captcha stats 2021-05-27 14:47:29 +05:30
realaravinth
72667bd2e1 using custom version of actix-codegen and cors for pow routes 2021-05-25 14:34:24 +05:30
realaravinth
aa0c30f1bd send notifications 2021-05-10 00:55:47 +05:30