fix: avoid spurious warnings during instance installation

This commit is contained in:
objz committed 2026-10-29 16:37:04 +01:00
1 parent b2dcf0c997
commit 66062a6427
3 files changed
+8 -5

No files matched your search

+1 -1
View File
@@ -632,7 +632,7 @@ impl InstanceManager {
let config_path = self.instances_dir.join(name).join("instance.json"); let config_path = self.instances_dir.join(name).join("instance.json");
if !config_path.exists() { if !config_path.exists() {
tracing::warn!( tracing::debug!(
"Instance '{}' config is missing at {}", "Instance '{}' config is missing at {}",
name, name,
config_path.display() config_path.display()
+2 -2
View File
@@ -522,8 +522,8 @@ pub async fn download_assets_from(
serde_json::from_slice(&bytes).ok() serde_json::from_slice(&bytes).ok()
} }
Ok(_) => { Ok(_) => {
tracing::warn!( tracing::debug!(
"Invalid cached asset index at {}; fetching again", "Cached asset index at {} does not match the requested version; fetching again",
index_path.display() index_path.display()
); );
None None
+5 -2
View File
@@ -411,8 +411,11 @@ async fn download_assets_writes_index_when_objects_is_empty() {
assert!(body.get("objects").is_some()); assert!(body.get("objects").is_some());
} }
#[rstest::rstest]
#[case(b"{\"objects\":{\"fake\":{}}}")]
#[case(b"{\"objects\":{},\"virtual\":false}")]
#[tokio::test] #[tokio::test]
async fn invalid_cached_index_is_refetched() { async fn mismatched_cached_index_is_refetched(#[case] cached: &[u8]) {
let server = MockServer::start().await; let server = MockServer::start().await;
let body = serde_json::to_vec(&json!({"objects": {}})).unwrap(); let body = serde_json::to_vec(&json!({"objects": {}})).unwrap();
Mock::given(method("GET")) Mock::given(method("GET"))
@@ -426,7 +429,7 @@ async fn invalid_cached_index_is_refetched() {
let tmp = tempfile::tempdir().unwrap(); let tmp = tempfile::tempdir().unwrap();
let index_path = tmp.path().join("cache/minecraft/assets/indexes/5.json"); let index_path = tmp.path().join("cache/minecraft/assets/indexes/5.json");
std::fs::create_dir_all(index_path.parent().unwrap()).unwrap(); std::fs::create_dir_all(index_path.parent().unwrap()).unwrap();
std::fs::write(&index_path, b"{\"objects\":{\"fake\":{}}}").unwrap(); std::fs::write(&index_path, cached).unwrap();
download_assets(&HttpClient::new(), &meta, tmp.path()) download_assets(&HttpClient::new(), &meta, tmp.path())
.await .await