-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement OpenAPI endpoints from Turbo spec (#35)
* Add OpenAPI endpoints from Turbo spec * end-to-end tests for HEAD requests
- Loading branch information
Showing
6 changed files
with
200 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,33 @@ | ||
use reqwest::Response; | ||
|
||
use crate::helpers::spawn_app; | ||
|
||
#[tokio::test] | ||
async fn health_check_test() { | ||
let app = spawn_app().await; | ||
|
||
let client = reqwest::Client::new(); | ||
let response = check_endpoint("/management/health", &app).await; | ||
|
||
let response = client | ||
.get(format!("{}/management/health", &app.address)) | ||
.send() | ||
.await | ||
.expect("Failed to request /management/health"); | ||
assert!(response.status().is_success()); | ||
assert_eq!(Some(0), response.content_length()); | ||
} | ||
|
||
#[tokio::test] | ||
async fn turborepo_status_check_test() { | ||
let app = spawn_app().await; | ||
|
||
let response = check_endpoint("/v8/artifacts/status", &app).await; | ||
|
||
assert!(response.status().is_success()); | ||
assert_eq!(Some(0), response.content_length()); | ||
} | ||
|
||
async fn check_endpoint(endpoint: &str, app: &crate::helpers::TestApp) -> Response { | ||
let client = reqwest::Client::new(); | ||
|
||
client | ||
.get(format!("{}{}", &app.address, endpoint)) | ||
.send() | ||
.await | ||
.unwrap_or_else(|_| panic!("Failed to request {}", endpoint)) | ||
} |