mirror of
https://github.com/unpoller/unpoller.git
synced 2026-03-31 06:24:19 -04:00
Temp fix for test cases and warning from Dockerfile
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
FROM busybox:latest as builder
|
FROM busybox:latest AS builder
|
||||||
# we have to do this hop because distroless is bare without common shell commands
|
# we have to do this hop because distroless is bare without common shell commands
|
||||||
|
|
||||||
RUN mkdir -p /etc/unpoller
|
RUN mkdir -p /etc/unpoller
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ func (u *InputUnifi) pollController(c *Controller) (*poller.Metrics, error) {
|
|||||||
if m.CountryTraffic, err = c.Unifi.GetCountryTraffic(sites, &tp); err != nil {
|
if m.CountryTraffic, err = c.Unifi.GetCountryTraffic(sites, &tp); err != nil {
|
||||||
return nil, fmt.Errorf("unifi.GetCountryTraffic(%s): %w", c.URL, err)
|
return nil, fmt.Errorf("unifi.GetCountryTraffic(%s): %w", c.URL, err)
|
||||||
}
|
}
|
||||||
u.Logf("Found %d CountryTraffic entries", len(m.CountryTraffic))
|
u.LogDebugf("Found %d CountryTraffic entries", len(m.CountryTraffic))
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.SaveTraffic != nil && *c.SaveTraffic && c.SaveDPI != nil && *c.SaveDPI {
|
if c.SaveTraffic != nil && *c.SaveTraffic && c.SaveDPI != nil && *c.SaveDPI {
|
||||||
@@ -131,10 +131,10 @@ func (u *InputUnifi) pollController(c *Controller) (*poller.Metrics, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unifi.GetClientTraffic(%s): %w", c.URL, err)
|
return nil, fmt.Errorf("unifi.GetClientTraffic(%s): %w", c.URL, err)
|
||||||
}
|
}
|
||||||
u.Logf("Found %d ClientUsageByApp entries", len(clientUsageByApp))
|
u.LogDebugf("Found %d ClientUsageByApp entries", len(clientUsageByApp))
|
||||||
b4 := len(m.ClientsDPI)
|
b4 := len(m.ClientsDPI)
|
||||||
u.convertToClientDPI(clientUsageByApp, m)
|
u.convertToClientDPI(clientUsageByApp, m)
|
||||||
u.Logf("Added %d ClientDPI entries for a total of %d", len(m.ClientsDPI)-b4, len(m.ClientsDPI))
|
u.LogDebugf("Added %d ClientDPI entries for a total of %d", len(m.ClientsDPI)-b4, len(m.ClientsDPI))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get all the points.
|
// Get all the points.
|
||||||
|
|||||||
@@ -277,6 +277,10 @@ func (u *InputUnifi) setDefaults(c *Controller) { //nolint:cyclop
|
|||||||
c.SaveAnomal = &f
|
c.SaveAnomal = &f
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if c.SaveTraffic == nil {
|
||||||
|
c.SaveTraffic = &f
|
||||||
|
}
|
||||||
|
|
||||||
if c.URL == "" {
|
if c.URL == "" {
|
||||||
c.URL = defaultURL
|
c.URL = defaultURL
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ func NewTestSetup(t *testing.T) *TestRig {
|
|||||||
testCollector := poller.NewTestCollector(t)
|
testCollector := poller.NewTestCollector(t)
|
||||||
|
|
||||||
enabled := true
|
enabled := true
|
||||||
|
disabled := false
|
||||||
controller := inputunifi.Controller{
|
controller := inputunifi.Controller{
|
||||||
SaveAnomal: &enabled,
|
SaveAnomal: &enabled,
|
||||||
SaveAlarms: &enabled,
|
SaveAlarms: &enabled,
|
||||||
@@ -28,6 +29,7 @@ func NewTestSetup(t *testing.T) *TestRig {
|
|||||||
SaveDPI: &enabled,
|
SaveDPI: &enabled,
|
||||||
SaveRogue: &enabled,
|
SaveRogue: &enabled,
|
||||||
SaveSites: &enabled,
|
SaveSites: &enabled,
|
||||||
|
SaveTraffic: &disabled,
|
||||||
URL: srv.Server.URL,
|
URL: srv.Server.URL,
|
||||||
}
|
}
|
||||||
in := &inputunifi.InputUnifi{
|
in := &inputunifi.InputUnifi{
|
||||||
|
|||||||
Reference in New Issue
Block a user