MCPcopy Create free account
hub / github.com/prometheus/procfs / TestKernelRandom

Function TestKernelRandom

kernel_random_test.go:24–50  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

22const procfsFixtures = "testdata/fixtures/proc"
23
24func TestKernelRandom(t *testing.T) {
25 fs, err := NewFS(procfsFixtures)
26 if err != nil {
27 t.Fatalf("failed to access %s: %v", procfsFixtures, err)
28 }
29
30 random, err := fs.KernelRandom()
31 if err != nil {
32 t.Fatalf("failed to collect %s/sys/kernel/random: %v", procfsFixtures, err)
33 }
34
35 if *random.EntropyAvaliable != 3943 {
36 t.Errorf("entropy_avail, want %d got %d", 3943, *random.EntropyAvaliable)
37 }
38 if *random.PoolSize != 4096 {
39 t.Errorf("poolsize, want %d got %d", 4096, *random.PoolSize)
40 }
41 if *random.URandomMinReseedSeconds != 60 {
42 t.Errorf("urandom_min_reseed_secs, want %d got %d", 60, *random.URandomMinReseedSeconds)
43 }
44 if *random.WriteWakeupThreshold != 3072 {
45 t.Errorf("write_wakeup_threshold, want %d got %d", 3072, *random.WriteWakeupThreshold)
46 }
47 if random.ReadWakeupThreshold != nil {
48 t.Errorf("read_wakeup_threshold, want %v got %d", nil, *random.ReadWakeupThreshold)
49 }
50}

Callers

nothing calls this directly

Calls 2

KernelRandomMethod · 0.95
NewFSFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…