File: process_unix_test.go

package info (click to toggle)
golang-github-keybase-go-ps 0.0~git20190827.91aafc9-1.1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 152 kB
  • sloc: ansic: 61; makefile: 2
file content (29 lines) | stat: -rw-r--r-- 548 bytes parent folder | download
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())
}