Draft
Conversation
Adds an integration test for interface value publishing and retrieval Signed-off-by: Luca Zaninotto <luca.zaninotto@secomind.com>
Adds test for interface valuesd deletion in appengine with property based testing. Signed-off-by: Luca Zaninotto <luca.zaninotto@secomind.com>
…data-access chore(AE): update data_access
…ync_testing test(HK API): Update all tests to run in async mode
…-round-trip test(AE): tests for interface values controller
…-values-deletion test(AE): interface values deletion
Use a unique realm_name returned from setup in `data_case` in each test, in order to prevent race conditions. Signed-off-by: emirh1 <emir.hrbat@secomind.com>
Update all tests in Astarte RM API to run concurrently with `async: true` option. Signed-off-by: emirh1 <emir.hrbat@secomind.com>
rewrite tests for update_interface_values using property testing. this first change adds tests for the setup and tests the happy path of the function Signed-off-by: Francesco Noacco <francesco.noacco@secomind.com>
add tests for the errors returned by update_interface_value Signed-off-by: Francesco Noacco <francesco.noacco@secomind.com>
…erface_value test(appengine): update_interface_values tests
The `realm_exists?` function is not used anywhere in the codebase and has been removed to reduce clutter and improve maintainability. This change has no effect on functionality and is purely a cleanup. Signed-off-by: Omar <omar.brbutovic@secomind.com>
- Refactor test organization using `describe` blocks for better structure - Group property-based tests into a single test to address flakiness caused by creating multiple realms with the same name - Update mock responses to support both synchronous and asynchronous testing scenarios - Add new metric-related tests - Mark unused code in `non_negative_integer_or_unset_type` to exclude it from Coveralls coverage analysis Signed-off-by: Omar <omar.brbutovic@secomind.com>
…t_tests test(RM API): Allow concurrent execution of tests
…move_unused_function chore(HK API): Remove unused `realm_exists?` function
this adds a function to the Device case which is used to pre-populate the database with random data for a random interface of each type the chosen interfaces are then exposed in the context so they can be accessed by tests to verify the data. to use this function, add `setup_all :populate_interfaces` in a module which `use`s `Cases.Device` update values functions from Device had to be made public to avoid duplicating the code, as the pre-existing public interface would only allow server owned values to be inserted Signed-off-by: Francesco Noacco <francesco.noacco@secomind.com>
Adds tests for interface update and retrieval with optional `keep_milliseconds` parameter Signed-off-by: Luca Zaninotto <luca.zaninotto@secomind.com>
the way ExLTTB is designed expects numbers both from the sample and from the accumulator as the same function is called with both, we can pre-process our values and convert timestamps to integers. Signed-off-by: Francesco Noacco <francesco.noacco@secomind.com>
the test ensures the resulting size is <= the `downsample_to` parameter Signed-off-by: Francesco Noacco <francesco.noacco@secomind.com>
- make sure to always return lists (sometimes exlttb returns streams) - fix timestamp needed as an integer Signed-off-by: Francesco Noacco <francesco.noacco@secomind.com>
the test ensures the resulting size is <= the `downsample_to` parameter for each downsample_key Signed-off-by: Francesco Noacco <francesco.noacco@secomind.com>
…e-interfaces-setup test(appengine): add `populate_interface` function
fix(appengine): downsample for individual interfaces
…-object fix(appengine): downsample for object aggregates
…d_new_tests test(HK API): Enhance test coverage and stability
…-keep_milliseconds test(AE): test for optional `keep_milliseconds` parameter
Adds logic to handle `allow_unset` of property interfaces Signed-off-by: Luca Zaninotto <luca.zaninotto@secomind.com>
Adds integration test for the unset of properties interfaces Adds `coveralls.json` file to ignore test files in the coverage report Signed-off-by: Luca Zaninotto <luca.zaninotto@secomind.com>
Checks wether to allow or not an unset of a property interface value Signed-off-by: Luca Zaninotto <luca.zaninotto@secomind.com>
…for object aggregates according to the history, the author of c8994b8 (me) broke this function by returning `[]` for empty values while the code using this result expects a map with a "timestamp" column the result has been changed to match the previous behavior Signed-off-by: Francesco Noacco <francesco.noacco@secomind.com>
… by others (astarte-platform#1425) Signed-off-by: Luca Marchiori <luca.marchiori@secomind.com>
previously, devices with invalid introspection would make the device removal process crash because the interface was not found. by using the existing function from astarte data access, we avoid this crash by simply ignoring interfaces that don't exist Signed-off-by: Francesco Noacco <francesco.noacco@secomind.com>
fix(rm): avoid crash when deleting devices with invalid introspection
…latform#1444) As the device is guaranteed to be deleted at least once, it may happen that a crash happened between the device cancellation and the deletion in progress entry cancellation. Account for this possibility and let the process terminate successfully after a cleanup Signed-off-by: Francesco Noacco <francesco.noacco@secomind.com>
…#1448) Currently, it is possible for the device deletion process to go very wrong: - the device deletion process can be started any number of times, each overwriting the previous deletion in progress entry - it is possible, though unlikely, that a device is inserted into the deletion in progress entry when it does not exist anymore. this happens when the deletion happens in between the device existence check and the deletion in progress entry insertion This commit solves the issues above: - by adding `IF NOT EXISTS` to the insertion process, we disallow overwriting the existing deletion in progress entry if the call was made multiple times - by checking for the device existence a second time, after the deletion in progress entry was inserted, we can cleanup the just inserted entry in case of a deleted device. this means, in theory, that DUP can start the device deletion process in between the insertion and deletion of the deletion in progress entry. this is not an issue as long as we make sure all its actions don't cause additional consequences: - the update to the deletion in progress entry only happens if the entry exists, no unwanted upserts - the vmq deletion progress does not start at all: if we're here, the device was already disconnected from the first deletion process, so this action is idempotent Signed-off-by: Francesco Noacco <francesco.noacco@secomind.com>
…m#1443) needed to simplify the debugging process Signed-off-by: Luca Marchiori <luca.marchiori@secomind.com>
- Updated `fetch_public_key` to use `Repo.safe_fetch_one` from `DataAccess` instead of reimplementing already existing functionality - Move `queries` module to `auth` namespace since it is only used there - Added tests Signed-off-by: Omar <omar.brbutovic@secomind.com>
When calling any AppEngine API with a non-existent realm, Astarte was returning an error that differed from the one specified in the [official documentation](https://docs.astarte-platform.org/astarte/latest/api/index.html#/device/getInterfaces). Updated the `fallback_controller` to correctly return a 401, ensuring behavior aligns with documented expectations. Signed-off-by: Omar <omar.brbutovic@secomind.com>
…rm#1449) Wrap interface deletion in capture_log to suppress log output during test cleanup, improving test output readability Signed-off-by: Omar <omar.brbutovic@secomind.com>
…public_key fix(AE): Return correct 401 error for non-existent realms
Signed-off-by: Francesco Noacco <francesco.noacco@secomind.com>
previously, updates were changed from upserts to normal updates to avoid re-inserting previously deleted values. This introduced a bug because Ecto would complain about stale values if the update did not modify the struct in the database. fix this by setting the appropriate flag (`allow_stale`) regression tests for previous fixes have been added to prevent this from happening again the update functions now return `:ok`. this does not change the usage of the functions as the return value was just discarded, but returning the deletion in progress entry when the value did not exist in the database is incorrect Signed-off-by: Francesco Noacco <francesco.noacco@secomind.com>
There were cases where DataUpdater GenServer processes might not shut down automatically due to missing timeout parameters in several message handlers. This would have caused processes to remain alive indefinitely, consuming resources. The following handlers were missing timeout parameters: - handle_heartbeat: both success and failure cases - handle_internal: continue case and failure case - handle_control: success case Without proper timeout resets, the 3-hour deactivation interval never triggered, preventing automatic cleanup of disconnected device processes. When handling the message that signals the end of the device deletion process, we now shutdown the process directly instead of setting a timeout of 0. Indeed, if the process has any message already waiting when the timeout value is returned, the timeout is ignored and the waiting message is handled as usual. This means that even a timeout of 0 milliseconds is not guaranteed to execute. For further info see: https://hexdocs.pm/elixir/1.19.0-rc.0/GenServer.html#module-timeouts Signed-off-by: Davide Briani <davide.briani@secomind.com>
fix(dup): crash when performing updates of deleted values
Previously the Kubernetes service name used to look for VerneMQ instances was hardcoded to the fixed value `astarte-vernemq`. However, `astarte` is just the default prefix and VerneMQ replicas are not found in Astarte instances that have a name other than `astarte`. This change introduces a new environment variable, `VERNEMQ_CLUSTERING_KUBERNETES_SERVICE_NAME`, that can be set to specify a custom Kubernetes service name, if needed. Signed-off-by: Davide Briani <davide.briani@secomind.com>
Add a section in the CHANGELOG.md file documenting the new environment variables introduced to configure clustering between Astarte services. Signed-off-by: Davide Briani <davide.briani@secomind.com>
* test(appengine): show interface tag in logs there was a typo in interface, so it was not showing * chore: remove astarte_rpc where it's no longer needed DUP and AppEngine don't need astarte_rpc now that we've replaced VMQ and DUP's RPCs with Horde Remove it as a direct dependency (it's still a transitive dependency because of the realm_management dependency in tests) and remove its mocks * chore: prepare v1.2.1-rc.0 Signed-off-by: Francesco Noacco <francesco.noacco@secomind.com>
…orm#1494) There were some faulty checks for existing database resources, due to the used `Repo.some?` custom function which now returns a `{:ok, bool}` tuple instead of directly a boolean, as in previous iterations. Indeed, the tuple was either checked in `if` statements where it always computed to a trueish value, of it was pattern matched to boolean values which resulted in an match error and a crash. The latter one is also the case of a bug in the DeviceRemover task, which crashed just after launch and resulted in devices to be stuck in the "in deletion" status. Fixes astarte-platform#1493. Signed-off-by: Davide Briani <davide.briani@secomind.com>
…e-platform#1496) Some of these tests drop database tables to validate behavior in edge cases. However, if other tests were run after dropping tables, subsequent tests would find a corrupted initial setup and would fail. This change ensures that the keyspace is correctly setup for each test. Signed-off-by: Davide Briani <davide.briani@secomind.com>
the refactor in b57bf46 broke the reconnection logic by removing the handle of the reconnection message. this also explains why the arguments in the `Process.send_after` call have been out of order for months without anyone noticing. this logic is now reintroduced with the following modifications: - we do not reconnect if we're already connected to a channel. this is needed to prevent subsequent `:init` messages from making the producer unusable: this would result in a call to `ExRabbitPool.checkout_channel` when all channels in the pool are already allocated, resulting in an `:out_of_channels` error which will recursively schedule a reconnection and fail. - a regression test has been added for the feature. to avoid the test being 20 seconds long, the backoff has been set to 0 in tests Signed-off-by: Francesco Noacco <francesco.noacco@secomind.com>
this removes compilation warnings. the configuration of astarte_rpc was removed from services which don't use astarte_rpc anymore Signed-off-by: Francesco Noacco <francesco.noacco@secomind.com>
This patch introduces documentation for the optional ASTARTE_INSTANCE_ID variable. The variable defaults to an empty string for backward compatibility, but can be set to improve namespace isolation when running multiple Astarte instances on a shared database. The Operator fully supports this variable and ensures that Cassandra keyspace names remain within valid length limits. Signed-off-by: Eddy Babetto <eddy.babetto@secomind.com>
Signed-off-by: Guilherme Crocetti <guilherme.crocetti@secomind.com>
Moves the device disconnection logic from the monolithic data_updater_test into its own dedicated test file.
…m#1582) handle_install and handle_delete volatile triggers had branches supporting discard_messages states. however 1. volatile triggers are not installed/deleted by the device 2. as such there is no tracking id 3. these bodies had a different number of arguments compared to the base body, so they were never actually executed Signed-off-by: Francesco Noacco <francesco.noacco@secomind.com>
previously, when 1. installing a volatile trigger for a specific interface 2. the interface results in a cache miss but is valid for the device the volatile trigger would be installed but the device status would not be updated. this results in a crash when the trigger generated events, as the logic expects the interfaces to be in the data updater state. by just loading the interfaces normally, we avoid this possible crash Signed-off-by: Francesco Noacco <francesco.noacco@secomind.com>
Traefik v2.9 was incompatible with newer Docker daemon versions that require minimum API version 1.44. This fixes the recurring "client version 1.24 is too old" errors that prevented Traefik from discovering and routing to Docker containers. Signed-off-by: Omar <omar.brbutovic@secomind.com>
The `astarte-apps-build` workflow was called without the `app` argument when in the context of validation testing before publishing snapshot images of Astarte services. Since the `app` argument is required, this made the whole publishing job fail. Fix this by passing the right argument to all instances. copy-paste goes brrrrrrrrrrrrrr Signed-off-by: Arnaldo Cesco <arnaldo.cesco@secomind.com>
eddbbt
pushed a commit
that referenced
this pull request
Feb 11, 2026
…ror_range Triggers.Policy.ErrorRange generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g. usage docs, diagrams, etc.: