astarte-platform / astarte_vmq_plugin

Astarte VerneMQ plugin publishes incoming messages on an AMQP exchange with some additional metadata, so they can be processed by other components.
http://astarte-platform.org/
Apache License 2.0
16 stars 10 forks source link

Queries edit for keyspace separation feature #85

Closed eddbbt closed 7 months ago

eddbbt commented 8 months ago

Plugin's queries have been rewritten to work with new keyspace separation logic, a feature that is going to be introduced in astarte.

This edit has become necessary after PR #75 that enabled db access for this repo.

Due to the small size of queries file, the entire keyspace selection is handled by a single private function use_realm/2, so translation is made here. Also, a new env variable named DOCKER_VERNEMQ_ASTARTE_VMQ_PLUGIN__ASTARTE_INSTANCE_ID has been added, this works as astarte_instance_id in translation function (see https://github.com/astarte-platform/astarte_core/pull/105 for details), defaults to 'default' string.

Tests have been edited to match new db structure, so with a translated keyspace name (in this case, derived from a 'test' realm name).

This PR must not be merged before or after the same feature in main astarte repo, both need to me managed and merged as the same time.

resolves https://github.com/astarte-platform/astarte/issues/924

codecov[bot] commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 75.90%. Comparing base (a9e33b4) to head (cbaed2b).

:exclamation: Current head cbaed2b differs from pull request most recent head 18e67df. Consider uploading reports for the commit 18e67df to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #85 +/- ## ========================================== - Coverage 76.66% 75.90% -0.77% ========================================== Files 13 13 Lines 330 332 +2 ========================================== - Hits 253 252 -1 - Misses 77 80 +3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.