diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 03d73058..c9b326a1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 @@ -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 diff --git a/service/src/common/indexer_management_client/resolver.rs b/service/src/common/indexer_management_client/resolver.rs index 8b5d32a6..90a5180c 100644 --- a/service/src/common/indexer_management_client/resolver.rs +++ b/service/src/common/indexer_management_client/resolver.rs @@ -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(); @@ -253,7 +252,6 @@ mod test { } #[sqlx::test] - #[ignore] async fn global_fallback_cost_models(pool: PgPool) { let deployment_id = "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".to_string(); @@ -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(); @@ -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;