Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com> Co-authored-by: Bernd Verst <github@bernd.dev> |
||
---|---|---|
.. | ||
components/docker/default | ||
README.md | ||
config.yaml | ||
docker-compose.yml | ||
postgresql_test.go |
README.md
PostgreSQL State Store certification testing
This project aims to test the PostgreSQL State Store component under various conditions.
To run these tests:
go test -v -tags certtests -count=1 .
Test plan
Initialization and migrations
Also test the tableName
and metadataTableName
metadata properties.
- Initializes the component with names for tables that don't exist
- Initializes the component with names for tables that don't exist, specifying an explicit schema
- Initializes the component with all migrations performed (current level is "2")
- Initializes the component with only the state table, created before the metadata table was added (implied migration level "1")
- Initializes three components at the same time and ensure no race conditions exist in performing migrations
Test for CRUD operations
- Able to create and test connection.
- Able to do set, get, update and delete.
- Negative test to fetch record with key, that is not present.
SQL Injection
- Not prone to SQL injection on write
- Not prone to SQL injection on read
- Not prone to SQL injection on delete
TTLs and cleanups
- Correctly parse the
cleanupIntervalInSeconds
metadata property:- No value uses the default value (3600 seconds)
- A positive value sets the interval to the given number of seconds
- A zero or negative value disables the cleanup
- The cleanup method deletes expired records and updates the metadata table with the last time it ran
- The cleanup method doesn't run if the last iteration was less than
cleanupIntervalInSeconds
or if another process is doing the cleanup
Connection Recovery
- When PostgreSQL goes down and then comes back up - client is able to connect
Concurrency
- Insert a Key-Value pair, eTag is set.
- Update Value v2 for this Key with current eTag - eTag is updated.
- Try to Update v3 for this Key with wrong eTag - value should not get updated.
- Get and validate eTag, which should not have changed.
Transactions
Upsert in Multi function, using 3 keys with updating values and TTL for 2 of the keys, down in the order.