refactor(srv): 内置 -healthcheck 参数并移除独立 healthcheck 二进制
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
1 parent
57fd444c29
commit
ba9d7d83fe
4 files changed
+72
-41
No files matched your search
@@ -55,3 +55,24 @@ func TestRunMonitorStopsOnCancellation(t *testing.T) {
|
||||
t.Fatal("monitor did not stop after cancellation")
|
||||
}
|
||||
}
|
||||
|
||||
func TestHealthAddressUsesConfiguredPort(t *testing.T) {
|
||||
file := filepath.Join(t.TempDir(), "rpc.yaml")
|
||||
if err := os.WriteFile(file, []byte("server:\n addr: \":50002\"\n"), 0600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Setenv("CONFIG_FILE", file)
|
||||
if value, exists := os.LookupEnv("APP_SERVER_ADDR"); exists {
|
||||
t.Setenv("APP_SERVER_ADDR", value)
|
||||
if err := os.Unsetenv("APP_SERVER_ADDR"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
address, err := healthAddress("")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if address != "127.0.0.1:50002" {
|
||||
t.Fatalf("probe address = %q, want configured address 127.0.0.1:50002", address)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user