diff options
author | Ondrej Fabry <ofabry@cisco.com> | 2018-04-05 13:46:54 +0200 |
---|---|---|
committer | Ondrej Fabry <ofabry@cisco.com> | 2018-04-05 13:46:54 +0200 |
commit | 392a56b700fa6715d091e56c49f79bfe32613fc6 (patch) | |
tree | 1fe9cede81628bd6ee4a878296ff5faa22f3c823 /api/api_test.go | |
parent | 37c71c06371e9bf791fd1573051fa774fcb66602 (diff) |
Lookup message name by ID when receiving unexpected message
Change-Id: I693e8084b7e3f036dec5e557dc772857bb7d5f3d
Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Diffstat (limited to 'api/api_test.go')
-rw-r--r-- | api/api_test.go | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/api/api_test.go b/api/api_test.go index 62541ab..a439986 100644 --- a/api/api_test.go +++ b/api/api_test.go @@ -321,7 +321,6 @@ func TestCheckMessageCompatibility(t *testing.T) { err := ctx.ch.CheckMessageCompatibility(&interfaces.SwInterfaceSetFlags{}) Expect(err).ShouldNot(HaveOccurred()) } - func TestSetReplyTimeout(t *testing.T) { ctx := setupTest(t) defer ctx.teardownTest() @@ -483,13 +482,15 @@ func TestReceiveReplyAfterTimeout(t *testing.T) { Expect(err).ShouldNot(HaveOccurred()) } -/* - TODO: fix mock adapter - This test will fail because mock adapter will stop sending replies - when it encounters control_ping_reply from multi request, - thus never sending reply for next request - func TestReceiveReplyAfterTimeoutMultiRequest(t *testing.T) { + /* + TODO: fix mock adapter + This test will fail because mock adapter will stop sending replies + when it encounters control_ping_reply from multi request, + thus never sending reply for next request + */ + t.Skip() + ctx := setupTest(t) defer ctx.teardownTest() @@ -544,4 +545,19 @@ func TestReceiveReplyAfterTimeoutMultiRequest(t *testing.T) { err = ctx.ch.SendRequest(req).ReceiveReply(reply) Expect(err).ShouldNot(HaveOccurred()) } -*/ + +func TestInvalidMessageID(t *testing.T) { + ctx := setupTest(t) + defer ctx.teardownTest() + + // first one request should work + ctx.mockVpp.MockReply(&vpe.ShowVersionReply{}) + err := ctx.ch.SendRequest(&vpe.ShowVersion{}).ReceiveReply(&vpe.ShowVersionReply{}) + Expect(err).ShouldNot(HaveOccurred()) + + // second should fail with error invalid message ID + ctx.mockVpp.MockReply(&vpe.ShowVersionReply{}) + err = ctx.ch.SendRequest(&vpe.ControlPing{}).ReceiveReply(&vpe.ControlPingReply{}) + Expect(err).Should(HaveOccurred()) + Expect(err.Error()).To(ContainSubstring("invalid message ID")) +} |