Refactor interrupts plugin code (#2670)

This commit is contained in:
calerogers
2017-04-14 13:40:36 -07:00
committed by Daniel Nelson
parent cadd845b36
commit a12e082dbe
3 changed files with 29 additions and 45 deletions

View File

@@ -1,6 +1,7 @@
package interrupts
import (
"bytes"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"testing"
@@ -15,7 +16,7 @@ LOC: 2338608687 2334309625 Local timer interrupts
MIS: 0
NET_RX: 867028 225
TASKLET: 205 0`
f := bytes.NewBufferString(interruptStr)
parsed := []IRQ{
IRQ{
ID: "0", Type: "IO-APIC-edge", Device: "timer",
@@ -46,7 +47,7 @@ TASKLET: 205 0`
Total: int64(205),
},
}
got, err := parseInterrupts(interruptStr)
got, err := parseInterrupts(f)
require.Equal(t, nil, err)
require.NotEqual(t, 0, len(got))
require.Equal(t, len(got), len(parsed))