summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-08-21 14:25:45 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-08-23 00:23:25 +0200
commit590e30f846481c125a62093a7472937ec30a780b (patch)
treef4d0bbca9bf469042b355565ff72897f77fd07da
parent5d1ce3d67227b1b6c4dea36a5fb573213f00c904 (diff)
Update the self-tests
- Fix: expected data table structure in callbackEvent - Testing event received with a timeout is meaningless since the event are pushed on afb-test request. So They are already received at the assertion moment. - Wrong test waiting for a verb error. Change-Id: I1cec211f7fe4c37d4c238439e8a9a633121a6cf0 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--conf.d/controller/lua.d/aftTest.lua2
-rw-r--r--conf.d/controller/lua.d/helloworld.lua14
2 files changed, 6 insertions, 10 deletions
diff --git a/conf.d/controller/lua.d/aftTest.lua b/conf.d/controller/lua.d/aftTest.lua
index ed3ece3..4dc93b8 100644
--- a/conf.d/controller/lua.d/aftTest.lua
+++ b/conf.d/controller/lua.d/aftTest.lua
@@ -103,5 +103,5 @@ _AFT.describe("testAssertVerbStatusSuccess",function() _AFT.assertVerbStatusSucc
_AFT.describe("testAssertVerbResponseEquals",function() _AFT.assertVerbResponseEquals('hello', 'ping', {},"Some String") end)
_AFT.describe("testAssertVerbCb",function() _AFT.assertVerbCb('hello', 'ping', {},_callback) end)
_AFT.describe("testAssertVerbStatusError",function() _AFT.assertVerbStatusError('hello', 'pingfail', {}) end)
-_AFT.describe("testAssertVerbResponseEqualsError",function() _AFT.assertVerbResponseEqualsError('hello', 'pingfail', {},"Ping Binder Daemon fails") end)
+_AFT.describe("testAssertVerbResponseEqualsError",function() _AFT.assertVerbResponseEqualsError('hello', 'nonexistentverb', {},"Ping Binder Daemon fails") end)
_AFT.describe("testAssertVerbCbError",function() _AFT.assertVerbCbError('hello', 'pingfail', {},_callbackError) end)
diff --git a/conf.d/controller/lua.d/helloworld.lua b/conf.d/controller/lua.d/helloworld.lua
index 41ba603..2e99a6e 100644
--- a/conf.d/controller/lua.d/helloworld.lua
+++ b/conf.d/controller/lua.d/helloworld.lua
@@ -26,7 +26,7 @@ function _callbackError(responseJ)
_AFT.assertStrContains(responseJ.request.info, "Ping Binder Daemon fails")
end
function _callbackEvent(eventName, eventData)
- _AFT.assertEquals(eventData, {data = { key = 'weird others data', another_key = 123.456 }})
+ _AFT.assertEquals(eventData, { key = 'weird others data', another_key = 123.456 })
end
_AFT.addEventToMonitor("hello/anEvent")
@@ -37,12 +37,10 @@ _AFT.setBefore("testPingSuccess",function() print("~~~~~ Begin testPingSuccess ~
_AFT.setAfter("testPingSuccess",function() print("~~~~~ End testPingSuccess ~~~~~") end)
_AFT.testVerbResponseEquals('testPingSuccessAndResponse','hello', 'ping', {}, "Some String")
-_AFT.testVerbResponseEquals('testPingSuccessResponseFail','hello', 'ping', {}, "Unexpected String")
_AFT.testVerbCb('testPingSuccessCallback','hello', 'ping', {}, _callback)
_AFT.testVerbStatusError('testPingError', 'hello', 'pingfail', {})
-_AFT.testVerbResponseEqualsError('testPingErrorAndResponse', 'hello', 'pingfail', {}, "Ping Binder Daemon fails")
-_AFT.testVerbResponseEqualsError('testPingErrorResponseFail', 'hello', 'pingfail', {}, "Ping Binder Daemon succeed")
+_AFT.testVerbResponseEqualsError('testPingErrorAndResponse', 'hello', 'pingfail', {}, "Ping Binder Daemon succeeds")
_AFT.testVerbCbError('testPingErrorCallback', 'hello', 'pingfail', {}, _callbackError)
_AFT.testVerbStatusSuccess('testEventAddanEvent', 'hello', 'eventadd', {tag = 'event', name = 'anEvent'})
@@ -55,9 +53,7 @@ _AFT.testVerbStatusSuccess('testEventPushanotherEvent', 'hello', 'eventpush', {t
_AFT.testVerbStatusSuccess('testGenerateWarning', 'hello', 'verbose', {level = 4, message = 'My Warning message!'})
-_AFT.testEvtGrpReceived("testEventGroupReceived",{["hello/anEvent"]=1,["hello/anotherEvent"]=1},300000)
-_AFT.testEvtGrpReceived("testEventGroupReceived",{["hello/anEvent"]=2,["hello/anotherEvent"]=1},300000)
-_AFT.testEvtGrpReceived("testEventGroupReceived",{["hello/anEvent"]=0,["hello/anotherEvent"]=0},300000)
+_AFT.testEvtGrpReceived("testEventGroupReceived",{["hello/anEvent"]=1,["hello/anotherEvent"]=1})
-_AFT.testEvtReceived("testanEventReceived", "hello/anEvent",300000)
-_AFT.testEvtReceived("testanotherEventReceived", "hello/anotherEvent",300000)
+_AFT.testEvtReceived("testanEventReceived", "hello/anEvent")
+_AFT.testEvtReceived("testanotherEventReceived", "hello/anotherEvent")