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
3 changes: 3 additions & 0 deletions crates/daemon/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ pub enum DaemonError {
#[error("process `{name}` started without an observable pid")]
MissingProcessId { name: String },

#[error("process `{name}` started without observable identity for pid {pid}")]
MissingProcessIdentity { name: String, pid: u32 },

#[error("readiness check `{check}` timed out after {timeout_ms}ms; last error: {last_error:?}")]
ReadinessTimedOut {
check: String,
Expand Down
12 changes: 10 additions & 2 deletions crates/daemon/src/managed_resources/mysql_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use camino::Utf8Path;
use camino_tempfile::tempdir;
use insta::{Settings, assert_debug_snapshot};
use resources::RuntimeArtifactAdapter;
use serde_json::{Value, json};
use state::{Database, LinkProjectInput, ProjectRecord, PvPaths};

use super::ManagedResourceRuntimeAdapter;
Expand Down Expand Up @@ -293,10 +294,17 @@ fn read_dotenv(project: &ProjectRecord) -> Result<String> {
state::fs::read_to_string(&project.path.join(".env")).map_err(Into::into)
}

fn read_runtime_metadata(paths: &PvPaths, track: &str) -> Result<serde_json::Value> {
fn read_runtime_metadata(paths: &PvPaths, track: &str) -> Result<Value> {
let content = state::fs::read_to_string(&paths.resource_runtime_metadata("mysql", track))?;
let mut metadata: Value = serde_json::from_str(&content)?;
if let Some(process_start_identity) = metadata.get_mut("process_start_identity") {
*process_start_identity = json!("<native-start-identity>");
}
if let Some(process_executable_identity) = metadata.get_mut("process_executable_identity") {
*process_executable_identity = json!("<native-executable-identity>");
}

serde_json::from_str(&content).map_err(Into::into)
Ok(metadata)
}

fn mysql_system_database_initialized(paths: &PvPaths, track: &str) -> Result<bool> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ expression: snapshot
"log_path": String("<tempdir>/home/.pv/logs/resources/mysql/8.0.log"),
"name": String("mysql-8.0"),
"pid": Number(<pid>),
"process_executable_identity": String("<native-executable-identity>"),
"process_start_identity": String("<native-start-identity>"),
"resource_name": String("mysql"),
"started_at": String("<timestamp>"),
"track": String("8.0"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ expression: snapshot
"log_path": String("<tempdir>/home/.pv/logs/resources/mysql/8.0.log"),
"name": String("mysql-8.0"),
"pid": Number(<pid>),
"process_executable_identity": String("<native-executable-identity>"),
"process_start_identity": String("<native-start-identity>"),
"resource_name": String("mysql"),
"started_at": String("<timestamp>"),
"track": String("8.0"),
Expand Down
2 changes: 1 addition & 1 deletion crates/daemon/src/managed_resources/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4761,7 +4761,7 @@ fn assert_with_normalized_runtime(
settings.add_filter(r"timeout_ms: \d+", "timeout_ms: <timeout_ms>");
settings.add_filter(r"os error \d+", "os error <code>");
settings.add_filter(
r"I/O error: Connection refused \(os error <code>\)|I/O error: HTTP readiness returned non-success status|deadline has elapsed",
r"I/O error: (Connection refused|Connection reset by peer) \(os error <code>\)|I/O error: HTTP readiness returned non-success status|deadline has elapsed",
"I/O error: readiness unavailable",
);
settings.add_filter(r"port: \d+", "port: <port>");
Expand Down
Loading
Loading