-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathrunner_test.go
More file actions
43 lines (39 loc) · 812 Bytes
/
runner_test.go
File metadata and controls
43 lines (39 loc) · 812 Bytes
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
import (
"os"
"testing"
)
func TestNewRunner(t *testing.T) {
config, err := NewConfig("./wbs.example.toml")
if err != nil {
t.Fatal(err)
}
runner, err := NewRunner(config)
if err != nil {
t.Fatal(err)
}
t.Log(runner.StartCommand)
t.Log(runner.StartOptions)
if runner.Pid != -1 {
t.Errorf("expected '-1' but got %d", runner.Pid)
}
}
func TestRunnerServe(t *testing.T) {
config, err := NewConfig("./wbs.example.toml")
if err != nil {
t.Fatal(err)
}
runner, err := NewRunner(config)
if err != nil {
t.Fatal(err)
}
os.Setenv("TEST_RUNNER_CMD", "nc")
os.Setenv("TEST_RUNNER_PORT", "8508")
runner.StartCommand = "$TEST_RUNNER_CMD"
runner.StartOptions = []string{"-l", "$TEST_RUNNER_PORT"}
err = runner.Serve()
if err != nil {
t.Fatal(err)
}
defer runner.Stop()
}