aboutsummaryrefslogtreecommitdiff
path: root/service_report_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 /service_report_test.go
parentd34a7d3def91fb614fb657b81ff8265f19e078c8 (diff)
downloadlilin-f9c0f7d0e73c89b7473b7c0123427b934fcbff65.tar.xz
all: store the service logs into file
Diffstat (limited to 'service_report_test.go')
-rw-r--r--service_report_test.go21
1 files changed, 19 insertions, 2 deletions
diff --git a/service_report_test.go b/service_report_test.go
index 71652f6..95fc27d 100644
--- a/service_report_test.go
+++ b/service_report_test.go
@@ -4,14 +4,31 @@
package lilin
import (
+ "os"
"testing"
"time"
"git.sr.ht/~shulhan/pakakeh.go/lib/test"
)
-func TestServiceReport_push(t *testing.T) {
- var svcReport = NewServiceReport(`test`)
+func TestServiceReport_Store(t *testing.T) {
+ var serverOpts = ServerOptions{
+ BaseDir: `testdata`,
+ }
+ var err = serverOpts.init()
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ var svcReport *ServiceReport
+ svcReport, err = NewServiceReport(serverOpts, `testStore`)
+ if err != nil {
+ t.Fatal(err)
+ }
+ t.Cleanup(func() {
+ _ = os.Remove(svcReport.logPath)
+ })
+
var x int64
for x = 1; x <= historyMax+1; x++ {
svcReport.Store(ScanReport{At: time.Unix(x, 0)})