Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(trigger_engine): port query to xandra #837

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

noaccOS
Copy link
Contributor

@noaccOS noaccOS commented Aug 22, 2023

yes there was only one query

closes #459

test(trigger_engine): await xandra cluster before starting tests

Signed-off-by: Francesco Noacco <[email protected]>
@codecov
Copy link

codecov bot commented Aug 22, 2023

Codecov Report

Merging #837 (2d52a57) into master (e0fd426) will decrease coverage by 0.07%.
Report is 12 commits behind head on master.
The diff coverage is 10.00%.

❗ Current head 2d52a57 differs from pull request most recent head 71f8dd1. Consider uploading reports for the commit 71f8dd1 to get more accurate results

@@            Coverage Diff             @@
##           master     #837      +/-   ##
==========================================
- Coverage   67.42%   67.36%   -0.07%     
==========================================
  Files         264      264              
  Lines        6429     6432       +3     
==========================================
- Hits         4335     4333       -2     
- Misses       2094     2099       +5     
Files Changed Coverage Δ
...ne_api/lib/astarte_appengine_api/device/queries.ex 80.92% <0.00%> (ø)
...ib/astarte_data_updater_plant/data_updater/impl.ex 62.16% <0.00%> (ø)
...r_engine/lib/astarte_trigger_engine/application.ex 100.00% <ø> (ø)
...gine/lib/astarte_trigger_engine/events_consumer.ex 0.00% <0.00%> (ø)
..._management/lib/astarte_realm_management/engine.ex 78.46% <100.00%> (ø)
...rigger_engine/lib/astarte_trigger_engine/config.ex 87.87% <100.00%> (+7.32%) ⬆️

... and 8 files with indirect coverage changes

trigger <- Trigger.decode(trigger_data),
{:ok, action} <- Jason.decode(trigger.action) do
{:ok, action}
else
{:error, :database_connection_error} ->
Logger.warn("Database connection error.")
{:error, %Xandra.ConnectionError{action: action, reason: reason}} ->
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The {:error, %Xandra.Error{}} case is not handled. It would be good to keep database and logic error (e.g. trigger not found) distinct

if Astarte.Core.Realm.valid_name?(realm_name) do
:ok
else
{:error, :realm_not_found, realm_name}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say to use a more explicit :invalid_realm_name atom

@noaccOS noaccOS force-pushed the trigger_engine-xandra branch 2 times, most recently from 6bd7516 to 89a1fc9 Compare September 5, 2023 10:54
feat(trigger_engine): tag connection_error log

Signed-off-by: Francesco Noacco <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use Xandra instead of CQEx in Trigger Engine
2 participants