Uploaded image for project: ' AGL Development'
  1. AGL Development
  2. SPEC-2686

Problem test subscribe/unsubscribe

XMLWordPrintable

      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)

       

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            DDTLK Frédéric Marec
            amalrik Arthur Guyader
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: