crates/tests-database/README.md
tl;dr Run cargo test to exercise the SQLite database using a file in the temp directory
This is an integration test suite that runs through a simple "story" of creating a user, adding some history, adding some records and doing some deleting. The idea is to ensure that a database implementation does the right thing.
ATUIN_TEST_DB_URISetting this will create a database at that URI and then run through the tests. Leaving it unset will create a sqlite db in $TMP
There will be a snowflake_uid appended to the end of the URL so the DB will be unique for the test
ATUIN_TEST_DB_URI=postgres://postgres:pg@localhost/atuin_test_ cargo test
Will create a database and run the tests on it.
If you want to quickly and easily run a postgres instance
podman run --name atuin-pg-test -e POSTGRES_PASSWORD=pg -p 5432:5432 postgres
Set the environment variable ATUIN_TEST_DB_NO_DESTROY to anything and run the tests, e.g.
ATUIN_TEST_DB_NO_DESTROY=1 ATUIN_TEST_DB_URI=postgres://postgres:pg@localhost/atuin_test_ cargo test
will give
[email protected]:postgres> \l
+--------------------------------+----------+----------+------------+------------+-----------------------+
| Name | Owner | Encoding | Collate | Ctype | Access privileges |
|--------------------------------+----------+----------+------------+------------+-----------------------|
| atuin_test_3734160738059550720 | postgres | UTF8 | en_US.utf8 | en_US.utf8 | <null> |
This is intentionally not an integration test in atuin-server-database because it calls into the database implementation crates and I did not want to introduce a circular dependency
| Term | Definition |
|---|---|
| user | You, yes you looking at this. It's you! |
| session | a working session |
| record | ... |
| history | not sure what the difference between this and record is |
| store | shrug |