feat: idle sleep for proxmox LXCs

This commit is contained in:
yusing
2025-04-16 12:08:46 +08:00
parent 7e56fce4c9
commit 3b4deccd8e
35 changed files with 1553 additions and 609 deletions

23
internal/net/ping_test.go Normal file
View File

@@ -0,0 +1,23 @@
package netutils
import (
"context"
"errors"
"net"
"os"
"testing"
"github.com/stretchr/testify/require"
)
func TestPing(t *testing.T) {
t.Run("localhost", func(t *testing.T) {
ok, err := Ping(context.Background(), net.ParseIP("127.0.0.1"))
// ping (ICMP) is not allowed for non-root users
if errors.Is(err, os.ErrPermission) {
t.Skip("permission denied")
}
require.NoError(t, err)
require.True(t, ok)
})
}