Skip to content

Commit 4d3bd2b

Browse files
committed
chore: env var TARGET for test
1 parent 1c1af7a commit 4d3bd2b

File tree

5 files changed

+10
-11
lines changed

5 files changed

+10
-11
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,5 @@ jobs:
4040
cargo binstall -y --force trunk
4141
4242
- name: Run Tests
43-
run: make test
43+
run: |
44+
TARGET=$(rustc --version --verbose | grep host | cut -d' ' -f2) make test

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ tracing = "0.1.40"
4848
tracing-subscriber = "0.3.18"
4949
wait-on = "0.0.14"
5050
web-sys = "0.3.72"
51-
xprocess = "0.0.2"
51+
xprocess = "0.0.3"

test/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use reqwest::{Method, Url};
88
use wait_on::{WaitOptions, Waitable, resource::http::HttpWaiter};
99

1010
pub fn release_binary_path() -> Result<String> {
11-
let path = var("CARGO_TARGET_DIR")?;
12-
Ok(format!("{path}/release/http-server"))
11+
let path = var("TARGET")?;
12+
Ok(format!("../target/{path}/release/http-server"))
1313
}
1414

1515
pub async fn wait_on_http_server(port: u16) -> Result<()> {

test/src/smoke.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::{release_binary_path, wait_on_http_server};
66

77
#[tokio::test]
88
async fn runs_without_panicking() -> Result<()> {
9-
let http_server = Process::spawn_with_args(release_binary_path()?, ["start".into()])?;
9+
let http_server = Process::spawn_with_args(release_binary_path()?, ["start"])?;
1010
wait_on_http_server(7878).await?;
1111
http_server.kill()?;
1212

@@ -15,10 +15,8 @@ async fn runs_without_panicking() -> Result<()> {
1515

1616
#[tokio::test]
1717
async fn returns_json_from_api_index() -> Result<()> {
18-
let http_server = Process::spawn_with_args(
19-
release_binary_path()?,
20-
["start".into(), "--port".into(), "7879".into()],
21-
)?;
18+
let http_server =
19+
Process::spawn_with_args(release_binary_path()?, ["start", "--port", "7879"])?;
2220
wait_on_http_server(7879).await?;
2321

2422
let res = get("http://127.0.0.1:7879/api/v1")

0 commit comments

Comments
 (0)