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

Add test harness for CockroachDB, convert examples to tests #59

Merged
merged 1 commit into from
Nov 13, 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
4 changes: 4 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# For use with direnv: https://direnv.net
# See also: ./env.sh

PATH_add out/cockroachdb/bin
4 changes: 4 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ jobs:
steps:
# actions/checkout@v2
- uses: actions/checkout@72f2cec99f417b1a1c5e2e88945068983b7965f9
- name: Download CockroachDB
run: ./tools/ci_download_cockroachdb
- name: Add CockroachDB to PATH
run: echo ./out/cockroachdb/bin >> $GITHUB_PATH
- name: Build
run: cargo build --tests --verbose
- name: Run tests
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/target
Cargo.lock
out
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,9 @@ thiserror = "1.0"
tokio = { version = "1.32", default-features = false, features = [ "rt-multi-thread" ] }

[dev-dependencies]
anyhow = "1.0"
diesel = { version = "2.1.0", features = [ "postgres", "r2d2" ] }
tokio = { version = "1.32", features = [ "macros"] }
libc = "0.2.150"
tempfile = "3.8"
tokio = { version = "1.32", features = [ "macros", "fs", "process" ] }
tokio-postgres = { version = "0.7", features = [ "with-chrono-0_4", "with-uuid-1" ] }
122 changes: 0 additions & 122 deletions examples/usage.rs

This file was deleted.

2 changes: 1 addition & 1 deletion src/async_traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ where
.await
{
Ok(()) => Err(user_error),
Err(err) => Err(err.into()),
Err(err) => Err(err),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl<T> OptionalExtension<T> for Result<T, ConnectionError> {

self_as_query_result
.optional()
.map_err(|e| ConnectionError::Query(e))
.map_err(ConnectionError::Query)
}
}

Expand Down
15 changes: 15 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Tests

This directory includes some integration tests, specifically with the
CockroachDB database, which uses a PostgreSQL protocol.

Tests expect that the CockroachDB binary exist, and fail without it.

To download a local copy of CockroachDB:

```bash
./tools/ci_download_cockroachdb
```

This downloads a binary to `./out/cockroachdb/bin/cockoach`. If you'd like
to use your own binary here, replace this binary with your own executable.
Loading
Loading