diff options
| author | Shulhan <ms@kilabit.info> | 2025-07-31 00:31:28 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2025-07-31 19:17:47 +0700 |
| commit | 9998582575aa02dbd2206497953f207af1f117d2 (patch) | |
| tree | d0735fccd6c6c36140a47f36533d8ced50ad217e /worker_test.go | |
| parent | b6fec02b55a4227b6ecb47c2bc40a5a025af2b8a (diff) | |
| download | lilin-9998582575aa02dbd2206497953f207af1f117d2.tar.xz | |
all: implement Start and Stop methods on the Service
The Start method start the scanning periodically and send the report
to channel reportq.
The Stop method stop the periodic scanning.
This changes introduces new option Interval in the Service that define
the time interval between each scan.
Diffstat (limited to 'worker_test.go')
| -rw-r--r-- | worker_test.go | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/worker_test.go b/worker_test.go index 83fcc69..46e7cd3 100644 --- a/worker_test.go +++ b/worker_test.go @@ -39,6 +39,7 @@ func TestNewWorker(t *testing.T) { Address: `http://127.0.0.1:6121/health`, Timeout: `5s`, timeout: 5 * time.Second, + interval: defInterval, }, }, `example tcp`: &Service{ @@ -47,10 +48,11 @@ func TestNewWorker(t *testing.T) { Scheme: `tcp`, Host: `127.0.0.1:6122`, }, - Name: `example tcp`, - Address: `tcp://127.0.0.1:6122`, - Timeout: `5s`, - timeout: 5 * time.Second, + Name: `example tcp`, + Address: `tcp://127.0.0.1:6122`, + Timeout: `5s`, + timeout: 5 * time.Second, + interval: defInterval, }, }, `example udp`: &Service{ @@ -59,10 +61,11 @@ func TestNewWorker(t *testing.T) { Scheme: `udp`, Host: `127.0.0.1:6123`, }, - Name: `example udp`, - Address: `udp://127.0.0.1:6123`, - Timeout: `5s`, - timeout: 5 * time.Second, + Name: `example udp`, + Address: `udp://127.0.0.1:6123`, + Timeout: `5s`, + timeout: 5 * time.Second, + interval: defInterval, }, }, }, |
