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

ci: enabling SQLX/PG tests #48

Merged
merged 1 commit into from
Sep 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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