diff options
author | Eiichiro Watanabe <a16tochjp@gmail.com> | 2015-12-09 12:26:14 +0900 |
---|---|---|
committer | Eiichiro Watanabe <a16tochjp@gmail.com> | 2015-12-09 12:30:49 +0900 |
commit | b963b94fbf3479ce670f5ef1c499a11c8fef1e0f (patch) | |
tree | 8a23e045dd8307b986bfa42ecc42c151a7e1fd37 | |
parent | 86c92e09677875c027cf0aba9f15052b2becdadf (diff) |
packet: add test examples for RTRErrorReport
-rw-r--r-- | packet/rtr_test.go | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/packet/rtr_test.go b/packet/rtr_test.go index 3451b862..0f9b9527 100644 --- a/packet/rtr_test.go +++ b/packet/rtr_test.go @@ -102,7 +102,21 @@ func Test_RTRCacheReset(t *testing.T) { verifyRTRMessage(t, NewRTRCacheReset()) } -//TO BE IMPLEMENTED: -//func Test_RTRErrorReport(t *testing.T) { -// verifyRTRMessage(t, NewRTRErrorReport()) -//} +func Test_RTRErrorReport(t *testing.T) { + errPDU, _ := NewRTRResetQuery().Serialize() + errText1 := []byte("Couldn't send CacheResponce PDU") + errText2 := []byte("Wrong Length of PDU: 10 bytes") + + // See 5.10 ErrorReport in RFC6810 + // when it doesn't have both "erroneous PDU" and "Arbitrary Text" + verifyRTRMessage(t, NewRTRErrorReport(NO_DATA_AVAILABLE, nil, nil)) + + // when it has "erroneous PDU" + verifyRTRMessage(t, NewRTRErrorReport(UNSUPPORTED_PROTOCOL_VERSION, errPDU, nil)) + + // when it has "ArbitaryText" + verifyRTRMessage(t, NewRTRErrorReport(INTERNAL_ERROR, nil, errText1)) + + // when it has both "erroneous PDU" and "Arbitrary Text" + verifyRTRMessage(t, NewRTRErrorReport(CORRUPT_DATA, errPDU, errText2)) +} |