influxdata / influxdata/kapacitor
Fix TestStream_AlertSNMPTrap
- Dominant language
- Go
- Stars
- 2.4k
- Forks
- 479
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 4
Description
Test is flaky
```
--- FAIL: TestStream_AlertSNMPTrap (0.21s)
streamer_test.go:10486: digraph TestStream_Alert {
stream0 -> from1;
from1 -> window2;
window2 -> count3;
count3 -> alert4;
}
streamer_test.go:8487: unequal lists ignoring order:
got
([]interface {}) (len=1 cap=1) {
(snmptraptest.Trap) {
Pdu: (snmptraptest.Pdu) {
IsNil: (bool) false,
Type: (snmpgo.PduType) SNMPTrapV2,
ErrorStatus: (snmpgo.ErrorStatus) NoError,
ErrorIndex: (int) 0,
VarBinds: (snmptraptest.VarBinds) (len=4 cap=4) {
(snmptraptest.VarBind) {
Oid: (string) (len=21) "1.3.6.1.6.3.1.1.4.1.0",
Value: (string) (len=5) "1.1.2",
Type: (string) (len=3) "Oid"
},
(snmptraptest.VarBind) {
Oid: (string) (len=7) "1.1.2.3",
Value: (string) (len=2) "10",
Type: (string) (len=7) "Integer"
},
(snmptraptest.VarBind) {
Oid: (string) (len=7) "1.1.2.3",
Value: (string) "",
Type: (string) (len=4) "Null"
},
(snmptraptest.VarBind) {
Oid: (string) (len=7) "1.1.2.3",
Value: (string) (len=5) "20000",
Type: (string) (len=9) "TimeTicks"
}
}
},
Error: (error)
}
}
exp
([]interface {}) (len=2 cap=2) {
(snmptraptest.Trap) {
Pdu: (snmptraptest.Pdu) {
IsNil: (bool) false,
Type: (snmpgo.PduType) SNMPTrapV2,
ErrorStatus: (snmpgo.ErrorStatus) NoError,
ErrorIndex: (int) 0,
VarBinds: (snmptraptest.VarBinds) (len=4 cap=4) {
(snmptraptest.VarBind) {
Oid: (string) (len=21) "1.3.6.1.6.3.1.1.4.1.0",
Value: (string) (len=5) "1.1.1",
Type: (string) (len=3) "Oid"
},
(snmptraptest.VarBind) {
Oid: (string) (len=7) "1.1.1.2",
Value: (string) (len=1) "1",
Type: (string) (len=9) "Counter64"
},
(snmptraptest.VarBind) {
Oid: (string) (len=7) "1.1.1.2",
Value: (string) (len=10) "SNMP ALERT",
Type: (string) (len=11) "OctetString"
},
(snmptraptest.VarBind) {
Oid: (string) (len=7) "1.1.1.2",
Value: (string) (len=33) "kapacitor/cpu/serverA is CRITICAL",
Type: (string) (len=11) "OctetString"
}
}
},
Error: (error)
},
(snmptraptest.Trap) {
Pdu: (snmptraptest.Pdu) {
IsNil: (bool) false,
Type: (snmpgo.PduType) SNMPTrapV2,
ErrorStatus: (snmpgo.ErrorStatus) NoError,
ErrorIndex: (int) 0,
VarBinds: (snmptraptest.VarBinds) (len=4 cap=4) {
(snmptraptest.VarBind) {
Oid: (string) (len=21) "1.3.6.1.6.3.1.1.4.1.0",
Value: (string) (len=5) "1.1.2",
Type: (string) (len=3) "Oid"
},
(snmptraptest.VarBind) {
Oid: (string) (len=7) "1.1.2.3",
Value: (string) (len=2) "10",
Type: (string) (len=7) "Integer"
},
(snmptraptest.VarBind) {
Oid: (string) (len=7) "1.1.2.3",
Value: (string) "",
Type: (string) (len=4) "Null"
},
(snmptraptest.VarBind) {
Oid: (string) (len=7) "1.1.2.3",
Value: (string) (len=5) "20000",
Type: (string) (len=9) "TimeTicks"
}
}
},
Error: (error)
}
}
```
Contributor guide
Research direction
Start with TestStream_AlertSNMPTrap in streamer_test.go, especially the failure locations at lines 10486 and 8487, and run the test repeatedly to reproduce the flaky result. Trace why the expected two SNMP traps are sometimes reduced to one; done means the test reliably receives and validates both expected traps.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100