1
0
Fork 0

Adding upstream version 1.34.4.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-05-24 07:26:29 +02:00
parent e393c3af3f
commit 4978089aab
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
4963 changed files with 677545 additions and 0 deletions

View file

@ -0,0 +1,56 @@
//go:build linux
package wireless
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/influxdata/telegraf/testutil"
)
var testInput = []byte(`Inter-| sta-| Quality | Discarded packets | Missed | WE
face | tus | link level noise | nwid crypt frag retry misc | beacon | 22
wlan0: 0000 60. -50. -256 0 0 0 1525 0 0
wlan1: 0000 70. -39. -256 0 0 0 12096 191188 0`)
func TestLoadWirelessTable(t *testing.T) {
expectedMetrics := []*wirelessInterface{
{
Interface: "wlan0",
Status: int64(0000),
Link: int64(60),
Level: int64(-50),
Noise: int64(-256),
Nwid: int64(0),
Crypt: int64(0),
Frag: int64(0),
Retry: int64(1525),
Misc: int64(0),
Beacon: int64(0),
},
{
Interface: "wlan1",
Status: int64(0000),
Link: int64(70),
Level: int64(-39),
Noise: int64(-256),
Nwid: int64(0),
Crypt: int64(0),
Frag: int64(0),
Retry: int64(12096),
Misc: int64(191188),
Beacon: int64(0),
},
}
w := Wireless{
Log: testutil.Logger{},
}
metrics, err := w.loadWirelessTable(testInput)
require.NoError(t, err)
as := require.New(t)
as.Equal(expectedMetrics, metrics)
}