|
1 | | -use dotenv_codegen::dotenv; |
2 | 1 | use futures::future::try_join_all; |
| 2 | +use std::env; |
3 | 3 | use std::error::Error; |
4 | 4 | use std::sync::Arc; |
5 | 5 | use std::time::Instant; |
6 | 6 |
|
| 7 | +const TEST_URL: &str = env!("TEST_URL"); |
| 8 | + |
7 | 9 | #[async_std::test] |
8 | 10 | async fn async_runtime() -> Result<(), Box<dyn Error>> { |
9 | 11 | 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?; |
11 | 13 | spawn(conn); |
12 | 14 | let shared_client = Arc::new(client); |
13 | 15 | let stmt = shared_client |
@@ -41,7 +43,7 @@ async fn async_runtime() -> Result<(), Box<dyn Error>> { |
41 | 43 | #[tokio::test] |
42 | 44 | async fn tokio_runtime() -> Result<(), Box<dyn Error>> { |
43 | 45 | 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?; |
45 | 47 | spawn(conn); |
46 | 48 | let shared_client = Arc::new(client); |
47 | 49 | let stmt = shared_client |
@@ -76,7 +78,7 @@ async fn tokio_runtime() -> Result<(), Box<dyn Error>> { |
76 | 78 | async fn tokio_postgres() -> Result<(), Box<dyn Error>> { |
77 | 79 | use tokio::spawn; |
78 | 80 | 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?; |
80 | 82 | spawn(conn); |
81 | 83 | let shared_client = Arc::new(client); |
82 | 84 | let stmt = shared_client |
|
0 commit comments