Ship production deployment and runtime observability
This commit is contained in:
parent
267665bb35
commit
775dd61963
1 changed files with 3712 additions and 175 deletions
45
crates/remora-api/tests/deployment.rs
Normal file
45
crates/remora-api/tests/deployment.rs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
#[allow(dead_code)]
|
||||
mod support;
|
||||
|
||||
use remora_contracts::JobResourceDto;
|
||||
use reqwest::StatusCode;
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use support::{mint_provider_token, required_env};
|
||||
|
||||
#[tokio::test]
|
||||
async fn deployed_api_accepts_an_authorized_job_for_coordination_rebuild() {
|
||||
if std::env::var("REMORA_DEPLOYMENT_REQUIRE").is_err() {
|
||||
return;
|
||||
}
|
||||
let base = required_env("REMORA_DEPLOYMENT_API_URL")
|
||||
.trim_end_matches('/')
|
||||
.to_owned();
|
||||
let client = reqwest::Client::builder()
|
||||
.redirect(reqwest::redirect::Policy::none())
|
||||
.build()
|
||||
.unwrap();
|
||||
let unauthenticated = client.get(format!("{base}/jobs")).send().await.unwrap();
|
||||
assert_eq!(unauthenticated.status(), StatusCode::UNAUTHORIZED);
|
||||
|
||||
let token = mint_provider_token().await.unwrap();
|
||||
let submitted = client
|
||||
.post(format!("{base}/jobs"))
|
||||
.bearer_auth(token)
|
||||
.header("Idempotency-Key", "deployment-coordination-rebuild")
|
||||
.json(&json!({
|
||||
"source": {
|
||||
"kind": "http",
|
||||
"url": "https://example.com/deployment-smoke",
|
||||
"result_path": "artifact.bin"
|
||||
},
|
||||
"label": "deployment-coordination-rebuild"
|
||||
}))
|
||||
.send()
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(submitted.status(), StatusCode::ACCEPTED);
|
||||
let body: Value = submitted.json().await.unwrap();
|
||||
serde_json::from_value::<JobResourceDto>(body.clone()).unwrap();
|
||||
assert_eq!(body["phase"], "Queued");
|
||||
}
|
||||
Loading…
Reference in a new issue