Pull request 2254: 4923 gopacket DHCP vol.9
Updates #4923. Squashed commit of the following: commit 05322419156d18502f3f937e789df02d78971b30 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Jul 9 18:18:35 2024 +0300 dhcpsvc: imp docs commit 083da3671320f7774db9c5b854e663162da9d214 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Jul 9 15:28:52 2024 +0300 dhcpsvc: imp code, tests commit 22e37e587e29c781abd4f2486f282dcfbffb4e6b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Jul 8 19:31:43 2024 +0300 dhcpsvc: imp tests commit 83ec7c54ef1e689a1f887e78e3055522539222d5 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Jul 8 18:56:21 2024 +0300 dhcpsvc: add db
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package dhcpsvc_test
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/AdguardTeam/AdGuardHome/internal/dhcpsvc"
|
||||
@@ -8,6 +9,8 @@ import (
|
||||
)
|
||||
|
||||
func TestConfig_Validate(t *testing.T) {
|
||||
leasesPath := filepath.Join(t.TempDir(), "leases.json")
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
conf *dhcpsvc.Config
|
||||
@@ -25,6 +28,7 @@ func TestConfig_Validate(t *testing.T) {
|
||||
conf: &dhcpsvc.Config{
|
||||
Enabled: true,
|
||||
Interfaces: testInterfaceConf,
|
||||
DBFilePath: leasesPath,
|
||||
},
|
||||
wantErrMsg: `bad domain name "": domain name is empty`,
|
||||
}, {
|
||||
@@ -32,6 +36,7 @@ func TestConfig_Validate(t *testing.T) {
|
||||
Enabled: true,
|
||||
LocalDomainName: testLocalTLD,
|
||||
Interfaces: nil,
|
||||
DBFilePath: leasesPath,
|
||||
},
|
||||
name: "no_interfaces",
|
||||
wantErrMsg: "no interfaces specified",
|
||||
@@ -40,6 +45,7 @@ func TestConfig_Validate(t *testing.T) {
|
||||
Enabled: true,
|
||||
LocalDomainName: testLocalTLD,
|
||||
Interfaces: nil,
|
||||
DBFilePath: leasesPath,
|
||||
},
|
||||
name: "no_interfaces",
|
||||
wantErrMsg: "no interfaces specified",
|
||||
@@ -50,6 +56,7 @@ func TestConfig_Validate(t *testing.T) {
|
||||
Interfaces: map[string]*dhcpsvc.InterfaceConfig{
|
||||
"eth0": nil,
|
||||
},
|
||||
DBFilePath: leasesPath,
|
||||
},
|
||||
name: "nil_interface",
|
||||
wantErrMsg: `interface "eth0": config is nil`,
|
||||
@@ -63,6 +70,7 @@ func TestConfig_Validate(t *testing.T) {
|
||||
IPv6: &dhcpsvc.IPv6Config{Enabled: false},
|
||||
},
|
||||
},
|
||||
DBFilePath: leasesPath,
|
||||
},
|
||||
name: "nil_ipv4",
|
||||
wantErrMsg: `interface "eth0": ipv4: config is nil`,
|
||||
@@ -76,6 +84,7 @@ func TestConfig_Validate(t *testing.T) {
|
||||
IPv6: nil,
|
||||
},
|
||||
},
|
||||
DBFilePath: leasesPath,
|
||||
},
|
||||
name: "nil_ipv6",
|
||||
wantErrMsg: `interface "eth0": ipv6: config is nil`,
|
||||
|
||||
Reference in New Issue
Block a user