test(coverage): raise engine+agent coverage above 50%
This commit is contained in:
parent
e89b647dfa
commit
bf18812a3d
10 changed files with 839 additions and 2 deletions
22
internal/agent/process_unix_test.go
Normal file
22
internal/agent/process_unix_test.go
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
//go:build !windows
|
||||
|
||||
package agent
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestIsProcessAliveSelf(t *testing.T) {
|
||||
if !IsProcessAlive(os.Getpid()) {
|
||||
t.Errorf("self PID should be alive")
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsProcessAliveBogus(t *testing.T) {
|
||||
// PID 0 is reserved (signal 0 to PID 0 broadcasts to the whole pgrp).
|
||||
// Pick a very high PID unlikely to exist.
|
||||
if IsProcessAlive(0x7FFFFFFE) {
|
||||
t.Errorf("very high PID should not be alive")
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue