commit 002d16da89328f345cb7bf1e1d78a08ad08fb2da
parent 53027a33a9d94ee7b7d75ba9295d24d1550bdc7f
Author: triesap <tyson@radroots.org>
Date: Thu, 9 Apr 2026 17:38:06 +0000
runtime: prove repo local hyfd process startup
Diffstat:
3 files changed, 98 insertions(+), 0 deletions(-)
diff --git a/pixi.toml b/pixi.toml
@@ -19,5 +19,11 @@ mojson = { path = "../../../../vendor/mojo/mojson" }
run = "mojo run src/main.mojo"
test-unit = "mojo -I src tests/test_hyf.mojo"
test-runtime = "mojo -I src tests/test_runtime_paths.mojo"
+test-repo-local-process = "mojo -I src tests/test_repo_local_process_contract.mojo"
test-stdio = "mojo -I src tests/test_stdio_contract.mojo"
+test-runtime-contract = { depends-on = [
+ "test-runtime",
+ "test-repo-local-process",
+ "test-stdio",
+] }
test = { depends-on = ["test-unit", "test-runtime", "test-stdio"] }
diff --git a/tests/test_repo_local_process_contract.mojo b/tests/test_repo_local_process_contract.mojo
@@ -0,0 +1,87 @@
+import std.os
+from std.testing import TestSuite, assert_equal, assert_true
+
+from mojson import Value
+from fixture_assertions import load_scenario_request_json
+from stdio_process_helper import (
+ HYF_PATHS_PROFILE_ENV,
+ HYF_PATHS_REPO_LOCAL_ROOT_ENV,
+ run_stdio_entrypoint,
+)
+
+
+def _required_env(name: String) raises -> String:
+ var value = std.os.getenv(name)
+ assert_true(value != "")
+ return value^
+
+
+def _assert_under_repo_local_root(repo_local_root: String, path: String) raises:
+ assert_true(path.startswith(repo_local_root + "/"))
+
+
+def _assert_runtime_status_path_under_repo_local_root(
+ runtime_status: Value, key: String, repo_local_root: String
+) raises:
+ _assert_under_repo_local_root(
+ repo_local_root,
+ runtime_status["paths"][key].string_value(),
+ )
+
+
+def test_src_main_consumes_root_wrapper_repo_local_env() raises:
+ var paths_profile = _required_env(HYF_PATHS_PROFILE_ENV)
+ var repo_local_root = _required_env(HYF_PATHS_REPO_LOCAL_ROOT_ENV)
+ assert_equal(paths_profile, "repo_local")
+
+ var response = run_stdio_entrypoint(
+ "src/main.mojo",
+ load_scenario_request_json("scenarios/status_ok.json"),
+ )
+
+ var runtime_status = response["output"]["runtime"].clone()
+ assert_equal(runtime_status["paths_profile"].string_value(), "repo_local")
+ assert_equal(
+ runtime_status["repo_local_base_root"].string_value(),
+ repo_local_root,
+ )
+
+ _assert_runtime_status_path_under_repo_local_root(
+ runtime_status, "config_dir", repo_local_root
+ )
+ _assert_runtime_status_path_under_repo_local_root(
+ runtime_status, "config_path", repo_local_root
+ )
+ _assert_runtime_status_path_under_repo_local_root(
+ runtime_status, "data_dir", repo_local_root
+ )
+ _assert_runtime_status_path_under_repo_local_root(
+ runtime_status, "cache_dir", repo_local_root
+ )
+ _assert_runtime_status_path_under_repo_local_root(
+ runtime_status, "logs_dir", repo_local_root
+ )
+ _assert_runtime_status_path_under_repo_local_root(
+ runtime_status, "diagnostics_dir", repo_local_root
+ )
+ _assert_runtime_status_path_under_repo_local_root(
+ runtime_status, "run_dir", repo_local_root
+ )
+ _assert_runtime_status_path_under_repo_local_root(
+ runtime_status, "secrets_dir", repo_local_root
+ )
+ _assert_runtime_status_path_under_repo_local_root(
+ runtime_status, "identity_path", repo_local_root
+ )
+ _assert_under_repo_local_root(
+ repo_local_root,
+ runtime_status["config"]["artifact_path"].string_value(),
+ )
+ assert_equal(
+ runtime_status["config"]["artifact_path_source"].string_value(),
+ "canonical_runtime_path",
+ )
+
+
+def main() raises:
+ TestSuite.discover_tests[__functions_in_module()]().run()
diff --git a/tests/test_stdio_contract.mojo b/tests/test_stdio_contract.mojo
@@ -320,6 +320,11 @@ def test_internal_error_records_detail_in_canonical_runtime_diagnostics_dir() ra
)
>= 0
)
+ assert_true(
+ (diagnostics_dir / entries[0])
+ .__fspath__()
+ .startswith(temp_dir + "/logs/services/hyf/diagnostics/")
+ )
def main() raises: