mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-07-04 01:07:49 +02:00
Improving Mac discovery
This commit is contained in:
committed by
Cuong Manh Le
parent
3007cb86ec
commit
76d2e2c226
@@ -1,6 +1,7 @@
|
||||
package ctrld_test
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@@ -91,6 +92,9 @@ func TestConfigValidation(t *testing.T) {
|
||||
{"invalid rules", configWithInvalidRules(t), true},
|
||||
{"invalid dns rcodes", configWithInvalidRcodes(t), true},
|
||||
{"invalid max concurrent requests", configWithInvalidMaxConcurrentRequests(t), true},
|
||||
{"non-existed lease file", configWithNonExistedLeaseFile(t), true},
|
||||
{"lease file format required if lease file exist", configWithExistedLeaseFile(t), true},
|
||||
{"invalid lease file format", configWithInvalidLeaseFileFormat(t), true},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
@@ -199,3 +203,25 @@ func configWithInvalidMaxConcurrentRequests(t *testing.T) *ctrld.Config {
|
||||
cfg.Service.MaxConcurrentRequests = &n
|
||||
return cfg
|
||||
}
|
||||
|
||||
func configWithNonExistedLeaseFile(t *testing.T) *ctrld.Config {
|
||||
cfg := defaultConfig(t)
|
||||
cfg.Service.DHCPLeaseFile = "non-existed"
|
||||
return cfg
|
||||
}
|
||||
|
||||
func configWithExistedLeaseFile(t *testing.T) *ctrld.Config {
|
||||
cfg := defaultConfig(t)
|
||||
exe, err := os.Executable()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
cfg.Service.DHCPLeaseFile = exe
|
||||
return cfg
|
||||
}
|
||||
|
||||
func configWithInvalidLeaseFileFormat(t *testing.T) *ctrld.Config {
|
||||
cfg := defaultConfig(t)
|
||||
cfg.Service.DHCPLeaseFileFormat = "invalid"
|
||||
return cfg
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user