...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package procfs
18
19 import (
20 "testing"
21 )
22
23 const procfsFixtures = "testdata/fixtures/proc"
24
25 func TestKernelRandom(t *testing.T) {
26 fs, err := NewFS(procfsFixtures)
27 if err != nil {
28 t.Fatalf("failed to access %s: %v", procfsFixtures, err)
29 }
30
31 random, err := fs.KernelRandom()
32 if err != nil {
33 t.Fatalf("failed to collect %s/sys/kernel/random: %v", procfsFixtures, err)
34 }
35
36 if *random.EntropyAvaliable != 3943 {
37 t.Errorf("entropy_avail, want %d got %d", 3943, *random.EntropyAvaliable)
38 }
39 if *random.PoolSize != 4096 {
40 t.Errorf("poolsize, want %d got %d", 4096, *random.PoolSize)
41 }
42 if *random.URandomMinReseedSeconds != 60 {
43 t.Errorf("urandom_min_reseed_secs, want %d got %d", 60, *random.URandomMinReseedSeconds)
44 }
45 if *random.WriteWakeupThreshold != 3072 {
46 t.Errorf("write_wakeup_threshold, want %d got %d", 3072, *random.WriteWakeupThreshold)
47 }
48 if random.ReadWakeupThreshold != nil {
49 t.Errorf("read_wakeup_threshold, want %v got %d", nil, *random.ReadWakeupThreshold)
50 }
51 }
52
View as plain text