aboutsummaryrefslogtreecommitdiff
path: root/worker_test.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2025-08-13 18:47:49 +0700
committerShulhan <ms@kilabit.info>2025-08-20 02:43:53 +0700
commitf9c0f7d0e73c89b7473b7c0123427b934fcbff65 (patch)
treea91c46b963889e67bc4a0e65ba2ad9829540e72b /worker_test.go
parentd34a7d3def91fb614fb657b81ff8265f19e078c8 (diff)
downloadlilin-f9c0f7d0e73c89b7473b7c0123427b934fcbff65.tar.xz
all: store the service logs into file
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