aboutsummaryrefslogtreecommitdiff
path: root/worker_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'worker_test.go')
-rw-r--r--worker_test.go25
1 files changed, 18 insertions, 7 deletions
diff --git a/worker_test.go b/worker_test.go
index 46e7cd3..a149b5a 100644
--- a/worker_test.go
+++ b/worker_test.go
@@ -14,18 +14,24 @@ import (
func TestNewWorker(t *testing.T) {
type testCase struct {
expServices map[string]*Service
- configDir string
expError string
+ serverOpts ServerOptions
}
var listCase = []testCase{{
- configDir: `testdata/worker/withoutServiceDir/etc/lilin/`,
- expError: `open testdata/worker/withoutServiceDir/etc/lilin/service.d: no such file or directory`,
+ serverOpts: ServerOptions{
+ BaseDir: `testdata/worker/withoutServiceDir/`,
+ },
+ expError: `open testdata/worker/withoutServiceDir/etc/lilin/service.d: no such file or directory`,
}, {
- configDir: `testdata/worker/readError/etc/lilin/`,
- expError: `open testdata/worker/readError/etc/lilin/service.d/broken.cfg: no such file or directory`,
+ serverOpts: ServerOptions{
+ BaseDir: `testdata/worker/readError/`,
+ },
+ expError: `open testdata/worker/readError/etc/lilin/service.d/broken.cfg: no such file or directory`,
}, {
- configDir: `testdata/etc/lilin/`,
+ serverOpts: ServerOptions{
+ BaseDir: `testdata/`,
+ },
expServices: map[string]*Service{
`example http`: &Service{
opts: ServiceOptions{
@@ -72,7 +78,12 @@ func TestNewWorker(t *testing.T) {
}}
for _, tcase := range listCase {
- wrk, err := newWorker(tcase.configDir)
+ err := tcase.serverOpts.init()
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ wrk, err := newWorker(tcase.serverOpts)
if err != nil {
test.Assert(t, ``, tcase.expError, err.Error())
continue