Fixed the format
This commit is contained in:
parent
326db4ec7c
commit
0edefaa4c1
2 changed files with 90 additions and 89 deletions
|
|
@ -6,11 +6,13 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
"time"
|
||||
"strconv"
|
||||
|
||||
"github.com/sipeed/picoclaw/pkg/config"
|
||||
"github.com/sipeed/picoclaw/pkg/logger"
|
||||
|
|
@ -50,7 +52,7 @@ func generateToken() string {
|
|||
// then verifies the reported PID matches expectedPID to confirm the process
|
||||
// is actually a picoclaw gateway and not a foreign service on the same port.
|
||||
func isGatewayAlive(host string, port int, expectedPID int) bool {
|
||||
url := fmt.Sprintf("http://%s:%d/health", host, port)
|
||||
url := "http://" + net.JoinHostPort(host, strconv.Itoa(port)) + "/health"
|
||||
client := &http.Client{Timeout: 2 * time.Second}
|
||||
resp, err := client.Get(url)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -124,7 +124,6 @@ func TestWritePidFileNonLocalhostHost(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// verifies that a foreign process reusing a crashed gateway's PID is treated as stale.
|
||||
func TestWritePidFileForeignPIDReuse(t *testing.T) {
|
||||
dir := tmpDir(t)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue