Skip to content

Commit

Permalink
Fix external off by one PTU retry error (#2427)
Browse files Browse the repository at this point in the history
* Fix external off by one PTU retry error in multiple tests
  • Loading branch information
Jack-Byrne authored Jun 18, 2020
1 parent 69bdcf5 commit 67fc8c4
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ local function startServiceWithOnServiceUpdate_PTU_FAILED(pServiceId, pHandShake
local curRetry = 0
local function getExpOnStatusUpdate()
local expRes = {}
for i = 1, numOfIter + 2 do
for i = 1, numOfIter + 1 do
if pPTUNum == 1 or i > 1 then table.insert(expRes, { status = "UPDATE_NEEDED" }) end
table.insert(expRes, { status = "UPDATING" })
end
Expand All @@ -96,8 +96,8 @@ local function startServiceWithOnServiceUpdate_PTU_FAILED(pServiceId, pHandShake
local function sendBCOnSystemRequest()
curRetry = curRetry + 1
local delay = 0
if curRetry > 2 then
delay = secondsBetweenRetries[curRetry - 2] * 1000
if curRetry > 1 then
delay = secondsBetweenRetries[curRetry - 1] * 1000
end
common.log("Delay:", delay)
RUN_AFTER(function()
Expand All @@ -120,7 +120,7 @@ local function startServiceWithOnServiceUpdate_PTU_FAILED(pServiceId, pHandShake
:Do(function(_, d)
common.log("SDL->MOB:", "OnSystemRequest", d.payload.requestType)
end)
:Times(numOfIter + 2)
:Times(numOfIter + 1)
:Timeout(timeout)
end
local expNotifRes = getExpOnStatusUpdate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ local function startServiceWithOnServiceUpdate_PTU_FAILED(pServiceId, pHandShake
local curRetry = 0
local function getExpOnStatusUpdate()
local expRes = {}
for i = 1, numOfIter + 2 do
for i = 1, numOfIter + 1 do
if pPTUNum == 1 or i > 1 then table.insert(expRes, { status = "UPDATE_NEEDED" }) end
table.insert(expRes, { status = "UPDATING" })
end
Expand All @@ -98,8 +98,8 @@ local function startServiceWithOnServiceUpdate_PTU_FAILED(pServiceId, pHandShake
local function sendBCOnSystemRequest()
curRetry = curRetry + 1
local delay = 0
if curRetry > 2 then
delay = secondsBetweenRetries[curRetry - 2] * 1000
if curRetry > 1 then
delay = secondsBetweenRetries[curRetry - 1] * 1000
end
common.log("Delay:", delay)
RUN_AFTER(function()
Expand All @@ -122,7 +122,7 @@ local function startServiceWithOnServiceUpdate_PTU_FAILED(pServiceId, pHandShake
:Do(function(_, d)
common.log("SDL->MOB:", "OnSystemRequest ", d.payload.requestType)
end)
:Times(numOfIter + 2)
:Times(numOfIter + 1)
:Timeout(timeout)
end
local expNotifRes = getExpOnStatusUpdate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ local function startServiceWithOnServiceUpdate_PTU_FAILED(pServiceId, pHandShake
local curRetry = 0
local function getExpOnStatusUpdate()
local expRes = {}
for i = 1, numOfIter + 2 do
for i = 1, numOfIter + 1 do
if pPTUNum == 1 or i > 1 then table.insert(expRes, { status = "UPDATE_NEEDED" }) end
table.insert(expRes, { status = "UPDATING" })
end
Expand All @@ -199,8 +199,8 @@ local function startServiceWithOnServiceUpdate_PTU_FAILED(pServiceId, pHandShake
local function sendBCOnSystemRequest()
curRetry = curRetry + 1
local delay = 0
if curRetry > 2 then
delay = secondsBetweenRetries[curRetry - 2] * 1000
if curRetry > 1 then
delay = secondsBetweenRetries[curRetry - 1] * 1000
end
common.log("Delay:", delay)
RUN_AFTER(function()
Expand All @@ -223,7 +223,7 @@ local function startServiceWithOnServiceUpdate_PTU_FAILED(pServiceId, pHandShake
:Do(function(_, d)
common.log("SDL->MOB:", "OnSystemRequest ", d.payload.requestType)
end)
:Times(numOfIter + 2)
:Times(numOfIter + 1)
:Timeout(timeout)
end
local expNotifRes = getExpOnStatusUpdate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ local function startServiceWithOnServiceUpdate_REQUEST_ACCEPTED(pServiceId, pHan
local curRetry = 0
local function getExpOnStatusUpdate()
local expRes = {}
for i = 1, numOfIter + 2 do
for i = 1, numOfIter + 1 do
if pPTUNum == 1 or i > 1 then table.insert(expRes, { status = "UPDATE_NEEDED" }) end
table.insert(expRes, { status = "UPDATING" })
end
Expand All @@ -104,8 +104,8 @@ local function startServiceWithOnServiceUpdate_REQUEST_ACCEPTED(pServiceId, pHan
local function sendBCOnSystemRequest()
curRetry = curRetry + 1
local delay = 0
if curRetry > 2 then
delay = secondsBetweenRetries[curRetry - 2] * 1000
if curRetry > 1 then
delay = secondsBetweenRetries[curRetry - 1] * 1000
end
common.log("Delay:", delay)
RUN_AFTER(function()
Expand All @@ -128,7 +128,7 @@ local function startServiceWithOnServiceUpdate_REQUEST_ACCEPTED(pServiceId, pHan
:Do(function(_, d)
common.log("SDL->MOB:", "OnSystemRequest", d.payload.requestType)
end)
:Times(numOfIter + 2)
:Times(numOfIter + 1)
:Timeout(timeout)
end
local expNotifRes = getExpOnStatusUpdate()
Expand Down
4 changes: 1 addition & 3 deletions test_scripts/Defects/6_1/3136_02_External_Proprietary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ runner.testSettings.restrictions.sdlBuildOptions = { { extendedPolicy = { "EXTER
--[[ Local Variables ]]
local secondsBetweenRetries = { 1, 2 }
local timeout_after_x_seconds = 4
local expNumOfOnSysReq = #secondsBetweenRetries + 2
local expNumOfOnSysReq = #secondsBetweenRetries + 1
local numOfOnSysReq = 0

--[[ Local Functions ]]
Expand Down Expand Up @@ -102,8 +102,6 @@ local function unsuccessfulPTUviaMobile()
{ status = "UPDATE_NEEDED" },
{ status = "UPDATING" },
{ status = "UPDATE_NEEDED" },
{ status = "UPDATING" },
{ status = "UPDATE_NEEDED" },
{ status = "UPDATE_NEEDED" }, -- new PTU sequence
{ status = "UPDATING" }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ runner.testSettings.restrictions.sdlBuildOptions = { { extendedPolicy = { "EXTER
--[[ Local Variables ]]
local secondsBetweenRetries = { 1, 2 }
local timeout_after_x_seconds = 4
local expNumOfOnSysReq = #secondsBetweenRetries + 2
local expNumOfOnSysReq = #secondsBetweenRetries + 1
local numOfOnSysReq

--[[ Local Functions ]]
Expand Down Expand Up @@ -103,8 +103,6 @@ local function unsuccessfulPTUviaMobile(pNewAppId)
{ status = "UPDATE_NEEDED" },
{ status = "UPDATING" },
{ status = "UPDATE_NEEDED" },
{ status = "UPDATING" },
{ status = "UPDATE_NEEDED" },
{ status = "UPDATE_NEEDED" }, -- new PTU sequence
{ status = "UPDATING" }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ runner.testSettings.restrictions.sdlBuildOptions = { { extendedPolicy = { "EXTER
--[[ Local Variables ]]
local secondsBetweenRetries = { 1, 2 } -- in sec
local timeout_after_x_seconds = 4 -- in sec
local expNumOfOnSysReq = #secondsBetweenRetries + 2
local expNumOfOnSysReq = #secondsBetweenRetries + 1
local numOfOnSysReq = 0

--[[ Local Functions ]]
Expand Down Expand Up @@ -65,8 +65,6 @@ local function unsuccessfulPTUviaMobile()
{ status = "UPDATING" },
{ status = "UPDATE_NEEDED" },
{ status = "UPDATING" },
{ status = "UPDATE_NEEDED" },
{ status = "UPDATING" },
{ status = "UPDATE_NEEDED" }
}
common.hmi():ExpectNotification("SDL.OnStatusUpdate", unpack(exp))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ runner.testSettings.restrictions.sdlBuildOptions = { { extendedPolicy = { "EXTER
--[[ Local Variables ]]
local secondsBetweenRetries = { 1, 2 } -- in sec
local timeout_after_x_seconds = 4 -- in sec
local expNumOfOnSysReq = #secondsBetweenRetries + 2
local expNumOfOnSysReq = #secondsBetweenRetries + 1
local numOfOnSysReq = 0

--[[ Local Functions ]]
Expand Down Expand Up @@ -76,8 +76,6 @@ local function unsuccessfulPTUviaMobile()
{ status = "UPDATE_NEEDED" },
{ status = "UPDATING" },
{ status = "UPDATE_NEEDED" },
{ status = "UPDATING" },
{ status = "UPDATE_NEEDED" },
{ status = "UPDATE_NEEDED" }, -- new PTU sequence
{ status = "UPDATING" }
}
Expand Down

0 comments on commit 67fc8c4

Please sign in to comment.