mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-22 17:31:03 +01:00
21 lines
456 B
Go
21 lines
456 B
Go
package utils
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestProcessIdExists(t *testing.T) {
|
|
t.Run("existing process", func(t *testing.T) {
|
|
currentPid := os.Getpid()
|
|
assert.True(t, ProcessIdExists(currentPid), "should detect current process")
|
|
})
|
|
|
|
t.Run("non-existent process", func(t *testing.T) {
|
|
invalidPid := 99999999
|
|
assert.False(t, ProcessIdExists(invalidPid), "should not detect non-existent process")
|
|
})
|
|
}
|