Problem test subscribe/unsubscribe

Fixed

Description

Problem when launch tests in low-can.

If tests are not in a describe then they can cause the following tests to fail.

 

For example with this  :

 
_AFT.testVerbStatusSuccess("low-can_subscribe_j1939_event", "low-can", "subscribe", {event= "Eng.Momentary.Overspeed.Enable"})
_AFT.testVerbStatusSuccess("low-can_subscribe_j1939_events", "low-can", "subscribe", {event= "Eng.*"})
_AFT.testVerbStatusSuccess("low-can_subscribe_j1939_pgn", "low-can", "subscribe", {pgn= 61442})
_AFT.testVerbStatusSuccess("low-can_subscribe_j1939_all_pgn", "low-can", "subscribe", {pgn= "*"})
_AFT.testVerbStatusSuccess("low-can_subscribe_j1939_id", "low-can", "subscribe", {id= 61442})
_AFT.testVerbStatusSuccess("low-can_subscribe_j1939_all_id", "low-can", "subscribe", {id= "*"})
_AFT.testVerbStatusSuccess("low-can_subscribe_j1939_event", "low-can", "unsubscribe", {event= "Eng.Momentary.Overspeed.Enable"})
_AFT.testVerbStatusSuccess("low-can_subscribe_j1939_event", "low-can", "unsubscribe", {event= "*"})
_AFT.testVerbStatusSuccess("low-can_subscribe_j1939_id", "low-can", "subscribe", {id= 61442})
_AFT.testVerbStatusError("low-can_subscribe_j1939_no_event", "low-can", "subscribe", {event= ""})
_AFT.testVerbStatusError("low-can_subscribe_j1939_no_event", "low-can", "subscribe", {id= ""})
_AFT.testVerbStatusError("low-can_subscribe_j1939_no_event", "low-can", "subscribe", {pgn= ""})
 

That will not work. But with that :

 
_AFT.describe("Test subscribe unsubscribe", function()
print("\n++++++++++++++++++++++++++++++++++++++++++")
print("++++ TESTS SUBSCRIBE / UNSUBSCRIBE ++++")
print("++++++++++++++++++++++++++++++++++++++++++\n")
_AFT.testVerbStatusSuccess("low-can_subscribe_j1939_event", "low-can", "subscribe", {event= "Eng.Momentary.Overspeed.Enable"})
_AFT.testVerbStatusSuccess("low-can_subscribe_j1939_events", "low-can", "subscribe", {event= "Eng.*"})
_AFT.testVerbStatusSuccess("low-can_subscribe_j1939_pgn", "low-can", "subscribe", {pgn= 61442})
_AFT.testVerbStatusSuccess("low-can_subscribe_j1939_all_pgn", "low-can", "subscribe", {pgn= "*"})
_AFT.testVerbStatusSuccess("low-can_subscribe_j1939_id", "low-can", "subscribe", {id= 61442})
_AFT.testVerbStatusSuccess("low-can_subscribe_j1939_all_id", "low-can", "subscribe", {id= "*"})
_AFT.testVerbStatusSuccess("low-can_subscribe_j1939_event", "low-can", "unsubscribe", {event= "Eng.Momentary.Overspeed.Enable"})
_AFT.testVerbStatusSuccess("low-can_subscribe_j1939_event", "low-can", "unsubscribe", {event= "*"})
_AFT.testVerbStatusSuccess("low-can_subscribe_j1939_id", "low-can", "subscribe", {id= 61442})
_AFT.testVerbStatusError("low-can_subscribe_j1939_no_event", "low-can", "subscribe", {event= ""})
_AFT.testVerbStatusError("low-can_subscribe_j1939_no_event", "low-can", "subscribe", {id= ""})
_AFT.testVerbStatusError("low-can_subscribe_j1939_no_event", "low-can", "subscribe", {pgn= ""})
end)

The next test will work :

 

local api = "low-can"
local evt = "messages.Eng.Momentary.Overspeed.Enable"
local evt2 = "messages.Actl.Eng.Prcnt.Trque.High.Resolution"

_AFT.describe("Test subscribe read frame", function()
_AFT.addEventToMonitor(api .. "/" ..evt, function(eventname,data)
_AFT.assertEquals(eventname, api.."/"..evt)
end)

_AFT.assertVerbStatusSuccess(api ,"subscribe", { event = evt})
local ret = os.execute("bash ".._AFT.bindingRootDir.."/var/replay_launcher.sh ".._AFT.bindingRootDir.."/var/testj1939.canreplay");
_AFT.assertIsTrue(ret)

_AFT.assertEvtReceived(api .. "/" ..evt, 1000000)
end,
nil,
function()
_AFT.callVerb(api, "unsubscribe", { event = evt})
end)

 

Environment

None

Activity

Show:

Walt Miner 
December 12, 2019 at 2:18 AM

Close II RC2 release

Walt Miner 
December 12, 2019 at 2:11 AM

Fixed by Gerrit 22623 and 23055. Merged to both master and halibut.

Marec Frederic 
October 17, 2019 at 3:12 PM

tests are fixed

try this sandbox 

sandbox/DDTLK/fix-tests

Details

Assignee

Reporter

Labels

Contract ID

Priority

Created July 26, 2019 at 3:00 PM
Updated December 12, 2019 at 2:18 AM
Resolved November 14, 2019 at 8:27 AM

Flag notifications