aboutsummaryrefslogtreecommitdiff
path: root/worker_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'worker_test.go')
-rw-r--r--worker_test.go47
1 files changed, 34 insertions, 13 deletions
diff --git a/worker_test.go b/worker_test.go
index b8c7494..83fcc69 100644
--- a/worker_test.go
+++ b/worker_test.go
@@ -4,7 +4,9 @@
package lilin
import (
+ "net/url"
"testing"
+ "time"
"git.sr.ht/~shulhan/pakakeh.go/lib/test"
)
@@ -26,23 +28,42 @@ func TestNewWorker(t *testing.T) {
configDir: `testdata/etc/lilin/`,
expServices: map[string]*Service{
`example http`: &Service{
- Name: `example http`,
- Type: `http`,
- Method: `GET`,
- Address: `http://127.0.0.1:6121/health`,
- Timeout: `5s`,
+ opts: ServiceOptions{
+ scanURL: &url.URL{
+ Scheme: `http`,
+ Host: `127.0.0.1:6121`,
+ Path: `/health`,
+ },
+ Name: `example http`,
+ HTTPMethod: `GET`,
+ Address: `http://127.0.0.1:6121/health`,
+ Timeout: `5s`,
+ timeout: 5 * time.Second,
+ },
},
`example tcp`: &Service{
- Name: `example tcp`,
- Type: `tcp`,
- Address: `127.0.0.1:6122`,
- Timeout: `5s`,
+ opts: ServiceOptions{
+ scanURL: &url.URL{
+ Scheme: `tcp`,
+ Host: `127.0.0.1:6122`,
+ },
+ Name: `example tcp`,
+ Address: `tcp://127.0.0.1:6122`,
+ Timeout: `5s`,
+ timeout: 5 * time.Second,
+ },
},
`example udp`: &Service{
- Name: `example udp`,
- Type: `udp`,
- Address: `127.0.0.1:6123`,
- Timeout: `5s`,
+ opts: ServiceOptions{
+ scanURL: &url.URL{
+ Scheme: `udp`,
+ Host: `127.0.0.1:6123`,
+ },
+ Name: `example udp`,
+ Address: `udp://127.0.0.1:6123`,
+ Timeout: `5s`,
+ timeout: 5 * time.Second,
+ },
},
},
}}