Skip to content

Commit

Permalink
CHAD-14284: Test zigbee health monitoring opt out with zigbee-motion …
Browse files Browse the repository at this point in the history
…and zigbee-contact drivers; commented out any tests that involved health checking
  • Loading branch information
kiera-robinson-st2 committed Dec 11, 2024
1 parent f7eea82 commit 6ce6cc3
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 48 deletions.
55 changes: 28 additions & 27 deletions drivers/SmartThings/zigbee-contact/src/test/test_zigbee_contact.lua
Original file line number Diff line number Diff line change
Expand Up @@ -161,34 +161,35 @@ test.register_message_test(
}
)

test.register_coroutine_test(
"Health check should check all relevant attributes",
function()
test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" })
test.socket.zigbee:__expect_send({
mock_device.id,
TemperatureMeasurement.attributes.MaxMeasuredValue:read(mock_device)
})
test.socket.zigbee:__expect_send({
mock_device.id,
TemperatureMeasurement.attributes.MinMeasuredValue:read(mock_device)
})
test.wait_for_events()
-- removal due to change to stop health checks going forward
-- test.register_coroutine_test(
-- "Health check should check all relevant attributes",
-- function()
-- test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" })
-- test.socket.zigbee:__expect_send({
-- mock_device.id,
-- TemperatureMeasurement.attributes.MaxMeasuredValue:read(mock_device)
-- })
-- test.socket.zigbee:__expect_send({
-- mock_device.id,
-- TemperatureMeasurement.attributes.MinMeasuredValue:read(mock_device)
-- })
-- test.wait_for_events()

test.mock_time.advance_time(50000)
test.socket.zigbee:__set_channel_ordering("relaxed")
test.socket.zigbee:__expect_send({ mock_device.id, TemperatureMeasurement.attributes.MeasuredValue:read(mock_device) })
test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryPercentageRemaining:read(mock_device) })
test.socket.zigbee:__expect_send({ mock_device.id, IASZone.attributes.ZoneStatus:read(mock_device) })
test.wait_for_events()
end,
{
test_init = function()
test.mock_device.add_test_device(mock_device)
test.timer.__create_and_queue_test_time_advance_timer(30, "interval", "health_check")
end
}
)
-- test.mock_time.advance_time(50000)
-- test.socket.zigbee:__set_channel_ordering("relaxed")
-- test.socket.zigbee:__expect_send({ mock_device.id, TemperatureMeasurement.attributes.MeasuredValue:read(mock_device) })
-- test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryPercentageRemaining:read(mock_device) })
-- test.socket.zigbee:__expect_send({ mock_device.id, IASZone.attributes.ZoneStatus:read(mock_device) })
-- test.wait_for_events()
-- end,
-- {
-- test_init = function()
-- test.mock_device.add_test_device(mock_device)
-- test.timer.__create_and_queue_test_time_advance_timer(30, "interval", "health_check")
-- end
-- }
-- )

test.register_coroutine_test(
"Refresh necessary attributes",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,28 +172,29 @@ test.register_message_test(
}
)

test.register_coroutine_test(
"Health check should check all relevant attributes",
function()
test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added"})
test.socket.zigbee:__expect_send({ mock_device.id, TemperatureMeasurement.attributes.MinMeasuredValue:read(mock_device) })
test.socket.zigbee:__expect_send({ mock_device.id, TemperatureMeasurement.attributes.MaxMeasuredValue:read(mock_device) })
test.wait_for_events()
-- removal due to change to stop health checks going forward
-- test.register_coroutine_test(
-- "Health check should check all relevant attributes",
-- function()
-- test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added"})
-- test.socket.zigbee:__expect_send({ mock_device.id, TemperatureMeasurement.attributes.MinMeasuredValue:read(mock_device) })
-- test.socket.zigbee:__expect_send({ mock_device.id, TemperatureMeasurement.attributes.MaxMeasuredValue:read(mock_device) })
-- test.wait_for_events()

test.mock_time.advance_time(50000) -- 21600 is the battery max interval
test.socket.zigbee:__set_channel_ordering("relaxed")
test.socket.zigbee:__expect_send({ mock_device.id, TemperatureMeasurement.attributes.MeasuredValue:read(mock_device) })
test.socket.zigbee:__expect_send({ mock_device.id, RelativeHumidity.attributes.MeasuredValue:read(mock_device) })
test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryPercentageRemaining:read(mock_device) })
test.socket.zigbee:__expect_send({ mock_device.id, IASZone.attributes.ZoneStatus:read(mock_device) })
end,
{
test_init = function()
test.mock_device.add_test_device(mock_device)
test.timer.__create_and_queue_test_time_advance_timer(30, "interval", "health_check")
end
}
)
-- test.mock_time.advance_time(50000) -- 21600 is the battery max interval
-- test.socket.zigbee:__set_channel_ordering("relaxed")
-- test.socket.zigbee:__expect_send({ mock_device.id, TemperatureMeasurement.attributes.MeasuredValue:read(mock_device) })
-- test.socket.zigbee:__expect_send({ mock_device.id, RelativeHumidity.attributes.MeasuredValue:read(mock_device) })
-- test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryPercentageRemaining:read(mock_device) })
-- test.socket.zigbee:__expect_send({ mock_device.id, IASZone.attributes.ZoneStatus:read(mock_device) })
-- end,
-- {
-- test_init = function()
-- test.mock_device.add_test_device(mock_device)
-- test.timer.__create_and_queue_test_time_advance_timer(30, "interval", "health_check")
-- end
-- }
-- )

test.register_coroutine_test(
"Configure should configure all necessary attributes",
Expand Down

0 comments on commit 6ce6cc3

Please sign in to comment.