Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions svc/pkg/game/ops/namespace-get/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,13 @@ async fn empty(ctx: TestCtx) {
})
.await
.unwrap();
let mut res_namespaces = res.namespaces.clone();

res_namespaces.sort_by(|a, b| a.display_name.cmp(&b.display_name));
test_namespaces.sort_by(|a, b| a.display_name.cmp(&b.display_name));
assert_eq!(test_namespaces.len(), res.namespaces.len());
for (a, b) in test_namespaces.iter().zip(res.namespaces.iter()) {

assert_eq!(test_namespaces.len(), res_namespaces.len());
for (a, b) in test_namespaces.iter().zip(res_namespaces.iter()) {
assert_eq!(a.namespace_id.unwrap(), b.namespace_id.unwrap().as_uuid());
}
}
2 changes: 1 addition & 1 deletion svc/pkg/game/ops/version-validate/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,5 +190,5 @@ async fn empty(ctx: TestCtx) {
.await
.unwrap();

assert_eq!(res.errors.len(), 22, "validation failed");
assert_eq!(res.errors.len(), 21, "validation failed");
}
6 changes: 3 additions & 3 deletions svc/pkg/ip/ops/info/Service.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ kind = "rust"

[operation]

[databases]
db-ip-info = {}

[secrets]
"ip_info/token" = { optional = true }

[databases]
db-ip-info = {}
18 changes: 15 additions & 3 deletions svc/pkg/ip/ops/info/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,24 @@ async fn fetch_ip_info_io(

// Fetch IP data from external service
tracing::info!(?ip_str, "fetching fresh ip info");
let ip_info_res = reqwest::get(api_url).await?;

let client = reqwest::Client::new();
let req = client.get(format!("https://ipinfo.io/{}", ip_str));

let req = if let Ok(token) = util::env::read_secret(&["ip_info", "token"]).await {
req.query(&[("token", token)])
} else {
req
};

let ip_info_res = req.send().await?;

if !ip_info_res.status().is_success() {
tracing::error!(status = ?ip_info_res.status(), "failed to fetch ip info, using fallback");
let status = ip_info_res.status();
let body = ip_info_res.text().await?;
tracing::error!(?status, %body, "failed to fetch ip info");

bail!("ip info error")
bail!("ip info error");
};

let ip_info_raw = ip_info_res.json::<serde_json::Value>().await?;
Expand Down
7 changes: 3 additions & 4 deletions svc/pkg/job-run/worker/tests/stop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use chirp_worker::prelude::*;
use proto::backend::pkg::*;

#[worker_test]
async fn empty(ctx: TestCtx) {
async fn stop(ctx: TestCtx) {
if !util::feature::job_run() {
return;
}
Expand Down Expand Up @@ -70,9 +70,8 @@ async fn empty(ctx: TestCtx) {
.task_states
.as_ref()
.unwrap()
.get("test-server")
.expect("missing test-server task state");
tracing::info!(?task_state, "task state");
.get("main")
.expect("missing main task state");
assert!(!task_state.failed.unwrap(), "task failed");
assert_eq!("stop", status.desired_status.as_ref().unwrap());
assert_eq!("dead", task_state.state.as_ref().unwrap());
Expand Down