snmp: Allow lines with empty or missing tags (#2172)

The changes in #1848 resulted in lines being dropped if they had an empty
tag. Let's allow all lines that have empty or missing tags!
This commit is contained in:
Jonas Hahnfeld
2017-01-24 23:57:43 +01:00
committed by Cameron Sparr
parent d4d3f61673
commit b0c721491d
2 changed files with 27 additions and 17 deletions

View File

@@ -457,9 +457,24 @@ func TestTableBuild_walk(t *testing.T) {
"myfield4": 22,
},
}
assert.Len(t, tb.Rows, 2)
rtr3 := RTableRow{
Tags: map[string]string{},
Fields: map[string]interface{}{
"myfield2": 0,
"myfield3": float64(0.0),
},
}
rtr4 := RTableRow{
Tags: map[string]string{},
Fields: map[string]interface{}{
"myfield3": float64(9.999),
},
}
assert.Len(t, tb.Rows, 4)
assert.Contains(t, tb.Rows, rtr1)
assert.Contains(t, tb.Rows, rtr2)
assert.Contains(t, tb.Rows, rtr3)
assert.Contains(t, tb.Rows, rtr4)
}
func TestTableBuild_noWalk(t *testing.T) {