Files
user-system/internal/pkg/sysutil/restart_test.go
Your Name cd5dae4778 test: add sysutil and cache tests
- Add RestartService tests (pkg/sysutil)
- Add decodeRedisValue and normalizeRedisValue tests (cache/l2.go)
2026-05-29 17:38:48 +08:00

29 lines
589 B
Go

package sysutil
import (
"runtime"
"testing"
"github.com/stretchr/testify/require"
)
func TestRestartService_NonLinux(t *testing.T) {
// On non-Linux systems, RestartService should return nil without exiting
if runtime.GOOS == "linux" {
t.Skip("Skipping non-Linux test on Linux")
}
err := RestartService()
require.NoError(t, err)
}
func TestRestartServiceAsync_NonLinux(t *testing.T) {
// On non-Linux systems, RestartServiceAsync should not panic
if runtime.GOOS == "linux" {
t.Skip("Skipping non-Linux test on Linux")
}
// Should not panic
RestartServiceAsync()
}