Commit graph

14 commits

Author SHA1 Message Date
Aravinth Manivannan
78d85ab9a9
feat: annotate license headers using reuse on text source files 2023-07-03 23:19:51 +05:30
Aravinth Manivannan
1e0aedad61
chore: linting 2023-07-02 21:51:24 +05:30
realaravinth
b3d00c89a6
feat: increase demo test waint time 2022-08-09 17:08:26 +05:30
realaravinth
249b6461ee
chore: migrate tests to also run with mariadb 2022-07-23 11:59:42 +05:30
realaravinth
4cd4605266
chore: use local app ctx 2022-05-27 15:25:10 +05:30
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
fc8a1670d2
update copyright notice 2022-01-08 22:16:05 +05:30
realaravinth
fe1fc3fb20
address clippy lints 2021-12-18 14:10:05 +05:30
realaravinth
855dbc60ef
Fixes #8
```
$ cargo test
<--- snip --->
 thread panicked while panicking. aborting.
     Running unittests (target/debug/deps/tests_migrate-7d90f83f506b1b25)
 ```

gdb revealed that demo::demo_account_works receives a SIGKILL due to a
failed test. No idea why it didn't fail the usual way. The part where
the test fails hits an endpoint with the wrong datatype payload, it
should have failed with a 404 when the status was asserted but it
didn't. Fixing that fixed #8.

Additionally, all demo user functionality was restructured to include an
abort functionality, which can be used to kill the loop that deletes and
creates demo user throughout the runtime of the app.
2021-12-18 13:53:05 +05:30
realaravinth
73ce2d1cb1
refactor captcha.rs and levels.rs and rm duration routes 2021-12-16 20:46:50 +05:30
realaravinth
a65b1c219c
username update 2021-08-12 17:13:17 +05:30
realaravinth
78ebc46c64
register demo user only when it's absent 2021-08-12 08:26:49 +05:30
realaravinth
02b62fb1d0
demo user banner 2021-08-09 12:23:06 +05:30
realaravinth
147f563ec8
demo user task 2021-08-09 11:56:25 +05:30