blob: bf460d9ba4ad822564d599846d59f5e153941d84 [file] [log] [blame]
Roni Riskafc77ebb2019-09-26 08:20:44 +03001package main
2
3import (
4 "testing"
5
6 "github.com/stretchr/testify/assert"
7)
8
9func TestProcessRunning(t *testing.T) {
10 r := makeRunner("echo", "a")
11 ch := make(chan error)
12 r.run(ch)
13 err := <-ch
14 assert.Nil(t, err)
15}
16
17func TestProcessKill(t *testing.T) {
18 r := makeRunner("sleep", "20")
19 ch := make(chan error)
20 r.run(ch)
21 assert.Nil(t, r.kill())
22 <-ch // wait and seee that kills is actually done
23}
24
25func TestProcessRunningFails(t *testing.T) {
26 r := makeRunner("foobarbaz")
27 ch := make(chan error)
28 r.run(ch)
29 err := <-ch
30 assert.NotNil(t, err)
31}