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,39 @@
package linux_sysctl_fs
import (
"os"
"testing"
"github.com/stretchr/testify/require"
"github.com/influxdata/telegraf/testutil"
)
func TestSysctlFSGather(t *testing.T) {
td := t.TempDir()
require.NoError(t, os.WriteFile(td+"/aio-nr", []byte("100\n"), 0640))
require.NoError(t, os.WriteFile(td+"/aio-max-nr", []byte("101\n"), 0640))
require.NoError(t, os.WriteFile(td+"/super-nr", []byte("102\n"), 0640))
require.NoError(t, os.WriteFile(td+"/super-max", []byte("103\n"), 0640))
require.NoError(t, os.WriteFile(td+"/file-nr", []byte("104\t0\t106\n"), 0640))
require.NoError(t, os.WriteFile(td+"/inode-state", []byte("107\t108\t109\t0\t0\t0\t0\n"), 0640))
sfs := &SysctlFS{
path: td,
}
var acc testutil.Accumulator
require.NoError(t, sfs.Gather(&acc))
acc.AssertContainsFields(t, "linux_sysctl_fs", map[string]interface{}{
"aio-nr": uint64(100),
"aio-max-nr": uint64(101),
"super-nr": uint64(102),
"super-max": uint64(103),
"file-nr": uint64(104),
"file-max": uint64(106),
"inode-nr": uint64(107),
"inode-free-nr": uint64(108),
"inode-preshrink-nr": uint64(109),
})
}