-(home): fix searching clients by mac address

This commit is contained in:
Andrey Meshkov
2019-12-23 16:59:02 +03:00
parent 9b93d43ac6
commit 6bf512f96f
3 changed files with 63 additions and 4 deletions

View File

@@ -23,6 +23,7 @@ func check(t *testing.T, result bool, msg string) {
func TestDHCP(t *testing.T) {
var s = Server{}
s.conf.DBFilePath = dbFilename
defer func() { _ = os.Remove(dbFilename) }()
var p, p2 dhcp4.Packet
var hw net.HardwareAddr
var lease *Lease
@@ -185,7 +186,7 @@ func TestDB(t *testing.T) {
lease, _ = s.reserveLease(p)
lease.Expiry = time.Unix(4000000002, 0)
os.Remove("leases.db")
_ = os.Remove("leases.db")
s.dbStore()
s.reset()
@@ -198,7 +199,7 @@ func TestDB(t *testing.T) {
check(t, bytes.Equal(s.leases[1].IP, []byte{1, 1, 1, 2}), "leases[1].IP")
check(t, s.leases[1].Expiry.Unix() == 4000000002, "leases[1].Expiry")
os.Remove("leases.db")
_ = os.Remove("leases.db")
}
func TestIsValidSubnetMask(t *testing.T) {