Skip to content

Commit 9af10ff

Browse files
committed
replace dot env with env in benchmark
1 parent 5fce1d2 commit 9af10ff

File tree

5 files changed

+11
-10
lines changed

5 files changed

+11
-10
lines changed

.github/workflows/code-coverage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ jobs:
3636
with:
3737
toolchain: nightly
3838
override: true
39-
- name: Add environment variables
40-
run: echo "postgresql://postgres/postgres?user=postgres&password=postgres" >> .env
4139
- name: Run cargo-tarpaulin
4240
uses: actions-rs/tarpaulin@v0.1
4341
with:
4442
version: '0.11.0'
4543
args: --out Xml --all
44+
env:
45+
TEST_URL: "postgresql://postgres/postgres?user=postgres&password=postgres"
4646
- name: Upload to codecov.io
4747
uses: codecov/codecov-action@v1.0.2
4848
with:

.github/workflows/stable-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ jobs:
4545
profile: minimal
4646
toolchain: ${{ matrix.rust }}
4747
override: true
48-
- name: Add environment variables
49-
run: echo "postgresql://postgres/postgres?user=postgres&password=postgres" >> .env
5048
- name: Run all tests
5149
uses: actions-rs/cargo@v1
5250
with:
5351
command: test
5452
args: --all --no-fail-fast -- --nocapture
53+
env:
54+
TEST_URL: "postgresql://postgres/postgres?user=postgres&password=postgres"

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
/target
22
Cargo.lock
3-
.env
3+
.env.sh

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,5 @@ webpki = "0.21.2"
2323

2424
[dev-dependencies]
2525
async-std = { version = "1.5", features = ["attributes"] }
26-
dotenv_codegen = "0.15.0"
2726
tokio = { version = "0.2.14", features = ["full"] }
2827
tokio-postgres = "0.5.2"

tests/benchmark.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
use dotenv_codegen::dotenv;
21
use futures::future::try_join_all;
2+
use std::env;
33
use std::error::Error;
44
use std::sync::Arc;
55
use std::time::Instant;
66

7+
const TEST_URL: &str = env!("TEST_URL");
8+
79
#[async_std::test]
810
async fn async_runtime() -> Result<(), Box<dyn Error>> {
911
use async_std::task::spawn;
10-
let (client, conn) = async_postgres::connect(&dotenv!("TEST_URL").parse()?).await?;
12+
let (client, conn) = async_postgres::connect(&TEST_URL.parse()?).await?;
1113
spawn(conn);
1214
let shared_client = Arc::new(client);
1315
let stmt = shared_client
@@ -41,7 +43,7 @@ async fn async_runtime() -> Result<(), Box<dyn Error>> {
4143
#[tokio::test]
4244
async fn tokio_runtime() -> Result<(), Box<dyn Error>> {
4345
use tokio::spawn;
44-
let (client, conn) = async_postgres::connect(&dotenv!("TEST_URL").parse()?).await?;
46+
let (client, conn) = async_postgres::connect(&TEST_URL.parse()?).await?;
4547
spawn(conn);
4648
let shared_client = Arc::new(client);
4749
let stmt = shared_client
@@ -76,7 +78,7 @@ async fn tokio_runtime() -> Result<(), Box<dyn Error>> {
7678
async fn tokio_postgres() -> Result<(), Box<dyn Error>> {
7779
use tokio::spawn;
7880
use tokio_postgres::NoTls;
79-
let (client, conn) = tokio_postgres::connect(&dotenv!("TEST_URL"), NoTls).await?;
81+
let (client, conn) = tokio_postgres::connect(&TEST_URL, NoTls).await?;
8082
spawn(conn);
8183
let shared_client = Arc::new(client);
8284
let stmt = shared_client

0 commit comments

Comments
 (0)