1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
// +build linux
package ps
import (
"os"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestUnixProcess(t *testing.T) {
var _ Process = new(UnixProcess)
}
func TestProcessesUnixError(t *testing.T) {
proc, err := findProcess(-1)
assert.Nil(t, proc)
assert.Nil(t, err)
}
func TestProcessesUnixPPid(t *testing.T) {
proc, err := FindProcess(os.Getpid())
require.NoError(t, err)
require.NotNil(t, proc)
assert.Equal(t, os.Getpid(), proc.Pid())
assert.Equal(t, os.Getppid(), proc.PPid())
}
|