Skip to content

Commit

Permalink
Merge branch 'feature/extended_vd_coverage' into feature/sdl_0255_enh…
Browse files Browse the repository at this point in the history
…ance_bodyInformation_vehicle_data
  • Loading branch information
dboltovskyi committed Dec 2, 2020
2 parents 153ceb9 + 27af7bf commit 3e2f589
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ local function getVDGroup(pDisallowedParam)
for param in pairs(common.getVDParams()) do
if param ~= pDisallowedParam then table.insert(params, param) end
end
if #params == 0 then params = common.json.EMPTY_ARRAY end
return {
rpcs = {
[common.rpc.get] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ local function getVDGroup(pDisallowedParam)
if param ~= pDisallowedParam then table.insert(params, param) end
table.insert(all_params, param)
end
if #all_params == 0 then all_params = common.json.EMPTY_ARRAY end
if #params == 0 then params = common.json.EMPTY_ARRAY end
return {
rpcs = {
[common.rpc.sub] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ local function getVDGroup(pDisallowedParam)
for param in pairs(common.getVDParams(true)) do
if param ~= pDisallowedParam then table.insert(params, param) end
end
if #params == 0 then params = common.json.EMPTY_ARRAY end
return {
rpcs = {
[common.rpc.sub] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ local function getVDGroup(pDisallowedParam)
if param ~= pDisallowedParam then table.insert(params, param) end
table.insert(all_params, param)
end
if #all_params == 0 then all_params = common.json.EMPTY_ARRAY end
if #params == 0 then params = common.json.EMPTY_ARRAY end
return {
rpcs = {
[common.rpc.sub] = {
Expand Down
54 changes: 49 additions & 5 deletions test_scripts/API/VehicleData/common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,47 @@ local boundValueTypeMap = {
[m.testType.UPPER_OUT_OF_BOUND] = tdg.valueType.UPPER_OUT_OF_BOUND,
[m.testType.LOWER_OUT_OF_BOUND] = tdg.valueType.LOWER_OUT_OF_BOUND
}
local isRestricted = false

--[[ Common Functions ]]

--[[ @restrictAvailableVDParams: Restrict VD parameters for test by only ones defined in 'VD_PARAMS' environment variable
--! @parameters: none
--! @return: none
--]]
local function restrictAvailableVDParams()
local extVDParams = os.getenv("VD_PARAMS")
local checkedExtVDParams = {}
if extVDParams ~= nil then
m.cprint(color.magenta, "Environment variable 'VD_PARAMS': " .. extVDParams)
for _, p in pairs(utils.splitString(extVDParams, ",")) do
if m.vd[p] ~= nil then
isRestricted = true
table.insert(checkedExtVDParams, p)
else
m.cprint(color.magenta, "Unknown VD parameter:", p)
end
end
end
if #checkedExtVDParams > 0 then
for k in pairs(m.vd) do
if not utils.isTableContains(checkedExtVDParams, k) then
m.vd[k] = nil
end
end
local checkedExtVDParamsToPrint = ""
for id, p in pairs(checkedExtVDParams) do
checkedExtVDParamsToPrint = checkedExtVDParamsToPrint .. p
if id ~= #checkedExtVDParams then checkedExtVDParamsToPrint = checkedExtVDParamsToPrint .. ", " end
end
m.cprint(color.magenta, "Testing VD parameters restricted to: " .. checkedExtVDParamsToPrint)
else
m.cprint(color.magenta, "Testing VD parameters are not restricted")
end
end

restrictAvailableVDParams()

--[[ @getAvailableVDParams: Return VD parameters available for processing
--! @parameters: none
--! @return: table with VD parameters
Expand All @@ -191,7 +229,7 @@ local function getAvailableVDParams()
for k in pairs(vdParams) do
if m.vd[k] == nil then
vdParams[k] = nil
m.cprint(color.magenta, "Disabled VD parameter:", k)
if not isRestricted then m.cprint(color.magenta, "Disabled VD parameter:", k) end
end
end
return vdParams
Expand Down Expand Up @@ -223,6 +261,9 @@ local function updatePreloadedPTFile(pGroup)
}
end
end
for _, data in pairs(pGroup.rpcs) do
if #data.parameters == 0 then data.parameters = json.EMPTY_ARRAY end
end
pt.policy_table.functional_groupings["VDGroup"] = pGroup
pt.policy_table.app_policies["default"].groups = { "Base-4", "VDGroup" }
pt.policy_table.functional_groupings["DataConsent-2"].rpcs = json.null
Expand Down Expand Up @@ -946,10 +987,13 @@ local function getVersionTests()
local tcs = createTestCases(ah.apiType.MOBILE, ah.eventType.REQUEST, rpc,
m.isMandatory.ALL, m.isArray.ALL, m.isVersion.YES, {})
for _, tc in pairs(tcs) do
table.insert(tests, {
param = tc.graph[tc.paramId].name,
version = tc.graph[tc.paramId].since
})
local name = tc.graph[tc.paramId].name
if vdParams[name] then
table.insert(tests, {
param = tc.graph[tc.paramId].name,
version = tc.graph[tc.paramId].since
})
end
end
return tests
end
Expand Down

0 comments on commit 3e2f589

Please sign in to comment.