test: add sysutil and cache tests
- Add RestartService tests (pkg/sysutil) - Add decodeRedisValue and normalizeRedisValue tests (cache/l2.go)
This commit is contained in:
28
internal/pkg/sysutil/restart_test.go
Normal file
28
internal/pkg/sysutil/restart_test.go
Normal file
@@ -0,0 +1,28 @@
|
||||
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()
|
||||
}
|
||||
Reference in New Issue
Block a user