This commit is contained in:
anonpenguin23 2025-11-09 18:30:03 +02:00
parent 0388c3a766
commit f991d55676
3 changed files with 9 additions and 5 deletions

View File

@ -136,6 +136,10 @@ func (pc *PortChecker) CheckAll() ([]int, error) {
// isPortAvailable checks if a TCP port is available for binding
func isPortAvailable(port int) bool {
// Port 0 is reserved and means "assign any available port"
if port == 0 {
return false
}
ln, err := net.Listen("tcp", fmt.Sprintf("127.0.0.1:%d", port))
if err != nil {
return false

View File

@ -17,7 +17,7 @@ func TestPortChecker(t *testing.T) {
}
// Check that required port counts match expectations
expectedPortCount := 18 // Based on RequiredPorts
expectedPortCount := 22 // Based on RequiredPorts
if len(checker.ports) != expectedPortCount {
t.Errorf("Expected %d ports, got %d", expectedPortCount, len(checker.ports))
}

View File

@ -13,7 +13,7 @@ func TestRenderBootstrapConfig(t *testing.T) {
RQLiteHTTPPort: 5001,
RQLiteRaftPort: 7001,
ClusterAPIPort: 9094,
IPFSAPIPORT: 5001,
IPFSAPIPort: 5001,
}
result, err := RenderBootstrapConfig(data)
@ -50,7 +50,7 @@ func TestRenderNodeConfig(t *testing.T) {
RQLiteJoinAddress: "localhost:5001",
BootstrapPeers: []string{bootstrapMultiaddr},
ClusterAPIPort: 9104,
IPFSAPIPORT: 5002,
IPFSAPIPort: 5002,
}
result, err := RenderNodeConfig(data)
@ -84,7 +84,7 @@ func TestRenderGatewayConfig(t *testing.T) {
BootstrapPeers: []string{bootstrapMultiaddr},
OlricServers: []string{"127.0.0.1:3320"},
ClusterAPIPort: 9094,
IPFSAPIPORT: 5001,
IPFSAPIPort: 5001,
}
result, err := RenderGatewayConfig(data)
@ -150,7 +150,7 @@ func TestRenderWithMultipleBootstrapPeers(t *testing.T) {
RQLiteJoinAddress: "localhost:5001",
BootstrapPeers: peers,
ClusterAPIPort: 9104,
IPFSAPIPORT: 5002,
IPFSAPIPort: 5002,
}
result, err := RenderNodeConfig(data)