Commit Graph

64 Commits (973fee9fe15f5e9b5b9e67912fe59758e9478f60)

Author SHA1 Message Date
epenet 02956f9a83
Improve formatting in component test files (#135267)
Improve formatting in test files
2025-01-10 10:53:45 +01:00
Adam Goode f12ba5f7a9
Unexport unavailable metrics in Prometheus (#125492) 2024-10-29 17:56:54 +01:00
Anton Tolchanov 6d48316436
Avoid creating Prometheus metrics for non-numeric states (#127262) 2024-10-25 13:31:30 +02:00
G Johansson cdfec7ebb4
Implement new state property for alarm_control_panel which is using an enum (#126283)
* Alarm state from enum

* Fixes

* Set final

* Fix rebase

* Test const

* Fix breaking version

* Fix other for alarm_control_panel

* Fix integrations

* More

* More

* More

* More

* Fix zha

* Replace _attr_state

* Fix alarm_control_panel

* Fix tests

* Fixes

* Mods

* Change some

* More

* More

* More

* Tests

* Last tests

* Return enum

* Fix zha

* Remove not needed check

* Fix wording

* Fix homekit

* Mod prometheus

* Fix mypy

* Fix homekit

* Fix ifttt
2024-10-21 22:54:27 +02:00
Jordan Zucker d2db25c7dd
Refactor prometheus integration tests (#113849)
* Starting with a simple change

* And trying again but actually adding the new area to this

* And that's getting interesting

* Wanted to add some small things to gitignore too

* More metrics clean up

* The linter is harsh

* Need to adjust a ton of tests

* I was finally able to commit

* Trying to abstract metrics into a helper class

* Fixed some tests at least

* Making progress on tests

* Getting really close now

* Only 1 or 2 tests left to fix

* Only 1.5 tests left

* That's more than enough for tonight

* Got all the tests passing!

* Another pass at test clean up

* Fixed up all the tests, again

* More clean up needed

* Got device_class working just need to fix one test I broke

* Got all the existing tests working!

* Refactored helpers into a separate file

* I added some new tests! For the helpers, ironically

* Don't touch those files

* Don't include that either

* Added my first real test

* Rolling back some logic changes to focus solely on tests

* Curious what happens when I run the tests now

* Getting closer to making things pass

* Getting closer to a working pr now

* Keeping up with test fixes

* Getting much closer to something useful

* Saving piecemeal

* Getting closer to a final working version

* Now that's an improvement

* And moving a little forward

* And now I'm really inching closer

* Saving more complex test case fix

* And now only 3 tests left

* Getting close and only a few tests left

* I think I'm close with only 1 test left

* Does this mean the tests actually work now

* Was not using the helper classes anymore

* Now I'm really curious

* Need to rename the recently renamed class

* Was it really that easy? (No, it wasn't)

* Is this finally enough

* Also added another full percentage point of tests

* Trying to clean things up a bit more

* Now how does this look?

* Just a little more clean up

* Added a few more tests for the new helper functions

* Last pass on much better tests for this

* Oops, forgot to remove redundant tests

* Fix the fixtures

* Getting closer to something decent, I hope

* Another pass on the formatting of the number 1

* And yet another pass on these tests

* Tests cleaned up a bit more

* Minor updates as suggested

* Another pass on assert with metrics helper

* Now this is fully tested
2024-10-15 14:22:36 +02:00
G Johansson 93aade6e8e
Change lock state to an enum (#126379)
* Add new LockState enum for lock states

* Add rest

* Fix insteon tests

* Fix mqtt tests

* Fix tesla_fleet

* Revert back ST_STATE_LOCKED

* Add back constant
2024-09-24 12:30:50 +02:00
Dylan Corrales 02b26ac4e6
Add state for alarm_control_panel in Prometheus (#123753)
* Prometheus: Add state for alarm_control_panel

* Prometheus: Add pytest for alarm_control_panel
2024-08-18 22:11:37 +02:00
Elliott Balsley cd72bdd851
Add Prometheus fan_mode and climate_mode metrics (#120267)
Co-authored-by: Anton Tolchanov <1687799+knyar@users.noreply.github.com>
2024-07-07 19:39:54 +02:00
Elliott Balsley 275a7499b1
Add prometheus fan handler (#119805)
Co-authored-by: Anton Tolchanov <1687799+knyar@users.noreply.github.com>
2024-07-07 16:32:15 +02:00
Adam Goode 27bccf0b24
Add test for prometheus export of entities becoming unavailable and available again (#112157)
Add test for state change to unavailable and back
2024-04-20 20:20:01 -07:00
Marc Mueller 1722e23df8
Add empty line after module docstring [tests l-p] (#112710) 2024-03-08 14:55:15 +01:00
Adam Goode a049d0e846
Add types throughout the prometheus tests (#112156) 2024-03-03 20:13:35 -08:00
Adam Goode 5cdc3cec32
Properly report cover positions to prometheus (#110157) 2024-02-12 15:33:03 +01:00
Anton Tolchanov 80f8e76fa3
Handle attributes set to None in prometheus (#104247)
Better handle attributes set to None
2023-11-20 19:53:25 +01:00
Max 1e57bc5415
Add `number` state to prometheus metrics (#102518) 2023-11-13 17:03:08 +01:00
Sam Crang b2b57c5f87
Allow exporting of `update` domain to Prometheus (#99400) 2023-09-07 20:43:47 -07:00
Russell Cloran 9144ef7ed8
Enumerate available states in Prometheus startup (#97993) 2023-09-04 09:30:56 +02:00
Russell Cloran 5fd14eade5
Handle timestamp sensors in Prometheus integration (#98001) 2023-09-02 10:20:36 +02:00
Russell Cloran 49995a4667
Add tests for device tracker in Prometheus (#98054) 2023-08-17 17:58:52 +02:00
Jadson Santos f6273bfca5
Add prometheus requires_auth parameter (#92964)
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-08-08 12:15:08 +02:00
J. Nick Koston dc5ee71d7a
Add slots to core EventBus (#95856) 2023-07-05 11:47:24 -05:00
J. Nick Koston c63e3c3bf1
Update prometheus tests to avoid patching utcnow (#93505) 2023-05-25 07:15:14 +02:00
epenet d65dff3f9e
Adjust entity registry access in tests (2) (#88960) 2023-03-01 16:23:36 +01:00
epenet 2cdc741900
Add type hints to integration tests (part 17) (#88163) 2023-02-15 11:14:04 +01:00
Michael 72d3fa6d89
Replace the usage of unit constants by enumerations in Tests [o-r] (#85936) 2023-01-15 14:50:24 +01:00
Matt Gerega 2215adf5cf
Add support for covers in Prometheus metrics (#83763)
fixes undefined
2022-12-27 11:25:33 +01:00
Michael 8a3fc2e82b
Fix attribute check in prometheus exporter (#84321)
* fix attribute check

* add test
2022-12-20 16:32:00 -08:00
epenet f453726b18
Cleanup HVACAction and HVACMode in tests (#78813) 2022-09-20 20:30:54 +02:00
epenet 7bc2712142
Adjust root-import in tests (#78761)
* Adjust root-import in tests

* Adjust diagnostics

* Adjust button

* Adjust select

* Adjust device_tracker

* Adjust camera

* Adjust humidifier

* Adjust media_source

* Adjust update

* Adjust siren

* Adjust number

* Adjust alarm_control_panel

* Adjust notify

* Adjust sensor

* Adjust switch

* Revert anthemav

* Don't adjust demo humidifier
2022-09-19 15:22:23 +02:00
Paulus Schoutsen 5eb19b8a70
Enforce RegistryEntryDisabler enum (#69017)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2022-03-31 13:10:07 -07:00
alim4r ca469750ac
Prometheus tests simulate entities (#64916) 2022-01-27 15:56:12 +01:00
alim4r 3e0e9e54bf
Fix duplicate metrics in prometheus (#61355)
* Fix duplicate metrics in prometheus

* Fix duplicate prometheus metrics for entities with multiple labelsets
- Move friendly_name detection to state_changed event
- Add additional test case

* Add review suggestions for prometheus friendly name update

* Remove commented out code in prometheus

* Update prometheus tests for deleted metrics

* Add review suggestions for prometheus
- Remove unnecessary firendly_name check in handle_entity_registry_updated
- Add assert in test
2022-01-25 08:05:52 -08:00
Renat Nurgaliyev d11f2b5151
Add HVAC modes of climate entities to Prometheus exporter (#62144) 2022-01-19 14:49:29 +01:00
Jevgeni Kiski 6af99882c5
Prometheus to support input_number (#58964)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2022-01-04 18:52:43 +01:00
Renat Nurgaliyev f71d49230d
Add counter entities support to Prometheus component (#62410) 2022-01-04 17:34:05 +01:00
Dave T 38e95ca663
Use new enums for prometheus tests (#62550) 2021-12-22 14:31:20 +01:00
alim4r 7d256f56c5
Refactor Prometheus tests (#60451)
* Removed prometheus from .coveragerc

* Update prometheus tests with handler categories

* Updated prometheus metrics to use the current registry
- don't use the registry created on import (needed for tests)

* Reset the prometheus CollectorRegistry before every test

* Update prometheus metrics generation
- Use latest registry when generating a response

* Add default collectors when resetting the registry

* Move entities to the specific prometheus test case

* Refactor body generation for prometheus tests

* Add test case for sensors without unit after rebase

* Fix prometheus tests
- Wait for events in prometheus tests
- Add workaround for demo platform dependecy conversation (aiohttp frozen router)

* Added prometheus tests for attribute metrics

* Added prometheus tests for binary_sensor

* Add prometheus test for input_boolean

* Add prometheus test for lights

* Add prometheus test for lock

* Add prometheus test for sensor fahrenheit conversion

* Fix prometheus test for input_number
2021-12-08 20:18:21 +01:00
Erik Montnemery 5169ee69c7
Attempt to fix flaky prometheus test (#61242) 2021-12-08 16:08:02 +01:00
alim4r 42389fc81b
Support numeric sensors with no unit_of_measurement in prometheus (#60157) 2021-11-24 22:30:08 +01:00
alim4r e180f1e302
Add input_number state to prometheus metrics (#56507)
* Add input_number to prometheus metrics

* Add prometheus input_number tests

* Removed unused import from test
2021-11-17 19:35:48 -08:00
Ville Skyttä 380cff167e
Use HTTPStatus in components/[nop]* (#58279) 2021-10-23 20:56:30 +02:00
Matt Zimmerman 515a47212e
Add target high/low temperatures to prometheus integration (#50071)
* add target high/low temperatures to prometheus integration

* use labels

* Revert "use labels"

This reverts commit 09c56d6359.

* fix naming

* tests

* cleanup

* use three separate metrics

* fix descriptions
2021-08-04 07:42:47 +02:00
Anton Tolchanov 80aaebb761
Rename Prometheus metrics to conform with naming guidelines (#50156) 2021-07-26 20:52:30 +02:00
Erik Montnemery 216b0df908
Set state_class for demo sensor (#50523) 2021-05-12 18:38:26 +02:00
Franck Nijhof 5a2b5fe7c5
Yoda assertion style removed is (#48142) 2021-03-20 13:55:10 +01:00
Franck Nijhof 65cf2fcb6f
Drop asynctest (#44746) 2021-01-01 22:31:56 +01:00
springstan 0c077685b6
Use content type text plain constant (#40313) 2020-09-20 13:19:10 +02:00
Eric Severance 16a947aa5f
Add generic unavailable and last_updated metrics for prometheus (#37456)
* Add generic unavailable and last_updated metrics for prometheus

* Updated with feedback from the code review
2020-07-12 21:27:33 +02:00
Shulyaka 872140123d
Add humidifier support to prometheus (#37112)
* Add humidifier support to promethease

* add humidifier dependency

* handle dependencies

* wrong place

* applied suggestions from code review

* fix typo

* Revert "wrong place"

This reverts commit 58e509d767.

* Revert "handle dependencies"

This reverts commit 74bd523e08.

* Revert "add humidifier dependency"

This reverts commit 8840b378e5.
2020-07-08 20:42:45 -04:00
mdegat01 b78f163bb0
Changed FilterTest namedtuples to dataclasses (#37252) 2020-06-30 11:59:21 -05:00