Skip to content

Commit

Permalink
ci: enabling SQLX/PG tests (#48)
Browse files Browse the repository at this point in the history
Fixes #44

Signed-off-by: Alexis Asseman <alexis@semiotic.ai>
  • Loading branch information
aasseman committed Sep 16, 2023
1 parent dd605f3 commit 44eb769
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
20 changes: 19 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,22 @@ jobs:
contents: write
pull-requests: write
actions: read
services:
postgres:
image: postgres:15
env:
POSTGRES_HOST_AUTH_METHOD: trust
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
container:
image: rust:latest
env:
DATABASE_URL: postgres://postgres@postgres:5432
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
Expand All @@ -61,8 +75,12 @@ jobs:
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Install sqlx
run: cargo install sqlx-cli --no-default-features --features postgres
- name: Run the test sqlx migrations
run: cargo sqlx migrate run
- name: Run tests and generate coverage report
run: cargo llvm-cov test --all-features --workspace --lcov --output-path lcov.info
run: cargo llvm-cov test --all-features --workspace --lcov --output-path lcov.info
- name: Test documentation code snippets
run: cargo test --doc --all-features --workspace
- name: Upload coverage to Coveralls
Expand Down
4 changes: 0 additions & 4 deletions service/src/common/indexer_management_client/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ mod test {
}

#[sqlx::test]
#[ignore]
async fn success_cost_models(pool: PgPool) {
setup_cost_models_table(&pool).await;
let expected_models = simple_cost_models();
Expand Down Expand Up @@ -253,7 +252,6 @@ mod test {
}

#[sqlx::test]
#[ignore]
async fn global_fallback_cost_models(pool: PgPool) {
let deployment_id =
"0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".to_string();
Expand Down Expand Up @@ -304,7 +302,6 @@ mod test {
}

#[sqlx::test]
#[ignore]
async fn success_cost_model(pool: PgPool) {
let deployment_id = "0xbd499f7673ca32ef4a642207a8bebdd0fb03888cf2678b298438e3a1ae5206ea";
let deployment_hash = "Qmb5Ysp5oCUXhLA8NmxmYKDAX2nCMnh7Vvb5uffb9n5vss".to_string();
Expand All @@ -319,7 +316,6 @@ mod test {
}

#[sqlx::test]
#[ignore]
async fn global_fallback_cost_model(pool: PgPool) {
let deployment_hash = "Qmaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
setup_cost_models_table(&pool).await;
Expand Down

0 comments on commit 44eb769

Please sign in to comment.