Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run tests against PostgreSQL, fix compatibility #170

Merged
merged 63 commits into from
Jun 27, 2022
Merged
Show file tree
Hide file tree
Changes from 61 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
6b42328
Make database url configurable for tests
adzialocha Jun 22, 2022
5a6ccd4
Add github action for postgres, probably this is the beginning of a l…
adzialocha Jun 22, 2022
63b0df2
Add --command
adzialocha Jun 22, 2022
2a0c0df
Add MySQL, try using services
adzialocha Jun 22, 2022
51908c5
Enable logging
adzialocha Jun 22, 2022
21e41b6
Try different logging
adzialocha Jun 22, 2022
b5276a8
Remove that fancy fluff
adzialocha Jun 22, 2022
25567a1
Fix comment
adzialocha Jun 22, 2022
bad9952
Do not reset
adzialocha Jun 22, 2022
3dada54
Who did that typo?
adzialocha Jun 22, 2022
d21efa5
Reset databases again
adzialocha Jun 22, 2022
e22f704
Correct database env var for postgres container
adzialocha Jun 22, 2022
a598bfe
What was that
adzialocha Jun 22, 2022
a0f86e1
Reduce parallelization
adzialocha Jun 22, 2022
8c5199c
Do not use BLOB
adzialocha Jun 22, 2022
0935387
Make sure to disconnect when migration failed
adzialocha Jun 22, 2022
1aad8f0
Set mysql database again
adzialocha Jun 22, 2022
413cfbb
Correctly run tests serially
adzialocha Jun 22, 2022
590dbd3
WIP
adzialocha Jun 23, 2022
1ca7976
Fix column type
adzialocha Jun 23, 2022
05d2ad0
Clean up
adzialocha Jun 23, 2022
620f34b
Add missing trait again
adzialocha Jun 23, 2022
4236230
Bring back failing UNIQUE constraint
adzialocha Jun 23, 2022
f34b4e7
Merge branch 'development' into postgres-ci
adzialocha Jun 23, 2022
3d4acc2
Make previous_operations in OperationRow an Option
sandreae Jun 23, 2022
971cf99
Fix COALESCE type from int to text
adzialocha Jun 23, 2022
7894fd9
Make previous_operation an Option in OperationFieldsJoinedRow
sandreae Jun 23, 2022
275e19b
Update parse_operation_rows to account for None value previous_operat…
sandreae Jun 23, 2022
ae6a6c4
Don't check for exact db error strings
sandreae Jun 23, 2022
c2b657f
Missing await
sandreae Jun 23, 2022
e77ee40
Typo
sandreae Jun 23, 2022
4459eff
WIP massive test refactor making sure they get unwinded
adzialocha Jun 23, 2022
50e7168
Enable all features for the testing runtime
adzialocha Jun 23, 2022
2abfd81
Fix ownership for tests with many cases and borrowed values
adzialocha Jun 23, 2022
06ac905
Don't use rstest shoul_panic macro
sandreae Jun 23, 2022
79637c9
Make list_index INTEGER(255)
sandreae Jun 23, 2022
db0cccc
Revert list_index type change
sandreae Jun 23, 2022
89f0e2c
Make columns Option in OperationFieldRow
sandreae Jun 23, 2022
ba3a7ff
Don't check for specific error message strings
sandreae Jun 23, 2022
38bf7f8
Cast strings to numerics in get_paginated_log_entries()
sandreae Jun 23, 2022
1884016
Use ON CONFLICT to avoid task duplicates
sandreae Jun 23, 2022
d97e8b9
Use COALESCE to compare nullable strings
sandreae Jun 23, 2022
3980942
Use test runner in all mutation tests
sandreae Jun 23, 2022
7ab5a45
Revert removal of empty store in publish_entry test
sandreae Jun 24, 2022
f1cb76d
Refactor test which used two dbs
sandreae Jun 24, 2022
c3ba146
Use test runner in query tests
sandreae Jun 24, 2022
eb762f2
Use test runner for http service test
sandreae Jun 24, 2022
12a1028
Try different env var names for mariadb container
adzialocha Jun 24, 2022
2cde8b9
Try changing port configuration for mariadb container
adzialocha Jun 24, 2022
213709b
Try using container label as hostname
adzialocha Jun 24, 2022
df1d9b9
Roll back port changes
adzialocha Jun 24, 2022
89efbd7
Expose port properly
adzialocha Jun 24, 2022
ef08996
Remove MySQL support, fix async runtime of sqlx
adzialocha Jun 24, 2022
65130de
Add entry to CHANGELOG.md
adzialocha Jun 24, 2022
c51434f
Give null values the same representation as index
adzialocha Jun 24, 2022
d2129dd
Make fields in other rows also optional
adzialocha Jun 24, 2022
7c1275c
Last tests using old database utilities
adzialocha Jun 24, 2022
818139d
Clean up
adzialocha Jun 24, 2022
6778ba4
Remove unnecessary comments, just unwrap test result
adzialocha Jun 24, 2022
0c0fbcc
Make linters happy
adzialocha Jun 24, 2022
e7fd225
Improve formatting of long case tests
adzialocha Jun 24, 2022
5369d26
Edit comments
cafca Jun 27, 2022
cbad270
Add some more comments
adzialocha Jun 27, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 54 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,58 @@ jobs:
with:
command: test
args: --manifest-path ${{ env.cargo_manifest }}
# Ensure debug output is also tested
env:
# Ensure debug output is also tested
RUST_LOG: debug

rust-test-postgres:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: aquadoggo-development
ports:
# Maps TCP port 5432 on service container to the host
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- name: Restore from cargo cache
uses: actions/cache@v3
with:
path: ${{ env.cache_path }}
key: ${{ runner.os }}-test-${{ hashFiles('**/Cargo.lock') }}

- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
# Make sure the tests run consecutively to avoid accessing the same
# database by multiple test threads
args: >-
--manifest-path ${{ env.cargo_manifest }}
-- --test-threads 1
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/aquadoggo-development

rust-check:
runs-on: ubuntu-latest

Expand Down Expand Up @@ -151,9 +199,12 @@ jobs:
uses: actions-rs/tarpaulin@v0.1
with:
# Force cleaning via `--force-clean` flag to prevent buggy code coverage
args: --manifest-path ${{ env.cargo_manifest }} --locked --force-clean
# Ensure debug output is also tested
args: >-
--manifest-path ${{ env.cargo_manifest }}
--locked
--force-clean
env:
# Ensure debug output is also tested
RUST_LOG: debug

- name: Upload to codecov.io
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Fix high CPU usage of idle workers [#136](https://github.com/p2panda/aquadoggo/pull/136)
- Improve CI, track test coverage [#139](https://github.com/p2panda/aquadoggo/pull/139)
- Fix compatibility with PostgreSQL, change sqlx runtime to `tokio` [#170](https://github.com/p2panda/aquadoggo/pull/170)

## [0.2.0]

Expand Down
Loading