- clients: fix tests
This commit is contained in:
parent
e9cb8666ce
commit
a692616981
|
@ -62,6 +62,8 @@ type clientsContainer struct {
|
||||||
lock sync.Mutex
|
lock sync.Mutex
|
||||||
|
|
||||||
dhcpServer *dhcpd.Server
|
dhcpServer *dhcpd.Server
|
||||||
|
|
||||||
|
testing bool // if TRUE, this object is used for internal tests
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init initializes clients container
|
// Init initializes clients container
|
||||||
|
@ -76,9 +78,11 @@ func (clients *clientsContainer) Init(objects []clientObject, dhcpServer *dhcpd.
|
||||||
clients.dhcpServer = dhcpServer
|
clients.dhcpServer = dhcpServer
|
||||||
clients.addFromConfig(objects)
|
clients.addFromConfig(objects)
|
||||||
|
|
||||||
go clients.periodicUpdate()
|
if !clients.testing {
|
||||||
|
go clients.periodicUpdate()
|
||||||
|
|
||||||
clients.registerWebHandlers()
|
clients.registerWebHandlers()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type clientObject struct {
|
type clientObject struct {
|
||||||
|
|
|
@ -11,6 +11,7 @@ func TestClients(t *testing.T) {
|
||||||
var e error
|
var e error
|
||||||
var b bool
|
var b bool
|
||||||
clients := clientsContainer{}
|
clients := clientsContainer{}
|
||||||
|
clients.testing = true
|
||||||
|
|
||||||
clients.Init(nil, nil)
|
clients.Init(nil, nil)
|
||||||
|
|
||||||
|
@ -149,6 +150,7 @@ func TestClients(t *testing.T) {
|
||||||
func TestClientsWhois(t *testing.T) {
|
func TestClientsWhois(t *testing.T) {
|
||||||
var c Client
|
var c Client
|
||||||
clients := clientsContainer{}
|
clients := clientsContainer{}
|
||||||
|
clients.testing = true
|
||||||
clients.Init(nil, nil)
|
clients.Init(nil, nil)
|
||||||
|
|
||||||
whois := [][]string{{"orgname", "orgname-val"}, {"country", "country-val"}}
|
whois := [][]string{{"orgname", "orgname-val"}, {"country", "country-val"}}
|
||||||
|
|
Loading…
Reference in New Issue