build: Use common libraries#32
Conversation
noaccOS
commented
Feb 25, 2026
- use typedstruct instead of typed_struct to avoid mismatches with other astarte libraries
- remove efx as it depends on typed_struct, and use mimic in its stead
18c26cd to
7673021
Compare
Annopaolo
left a comment
There was a problem hiding this comment.
Code is good, I left some very nitpicking comments
| } | ||
| end | ||
|
|
||
| defp start_amqp_data_consumer_fixture!(queue_index) do |
There was a problem hiding this comment.
Nit: this name might be clearer. If it means "start the amqp_data_consumer fixture", then "set up" is the better verb; if it means "a fixture that starts the amqp_data_consumer", then the fixture part is redundant and "start_amqp_data_consumer" is better.
I would suggest something like start_amqp_data_consumer!() in the same fashion as the usual start_link.
This is very minor though
| {:ok, data_updater} = DataUpdater.get_data_updater_process(sharding_key) | ||
| :erlang.trace(data_updater, true, [:receive]) | ||
| Mimic.allow(MessageTracker, self(), data_updater) | ||
| allow(MockMessageHandler, self(), data_updater) |
There was a problem hiding this comment.
Isn't this setup_data_updater/1 from lines 223-231?
There was a problem hiding this comment.
Yes, after having set the expectations
I've moved expectations to a setup so that we can reuse the existing setup
| defp setup_data_updater(context) do | ||
| %{sharding_key: sharding_key} = context | ||
|
|
||
| {:ok, data_updater} = | ||
| GenServer.start_link(DataUpdater, | ||
| sharding_key: sharding_key, | ||
| message_handler: MockMessageHandler | ||
| ) | ||
|
|
||
| :erlang.trace(data_updater, true, [:receive]) | ||
|
|
||
| Mimic.allow(MessageTracker, self(), data_updater) | ||
| allow(MockMessageHandler, self(), data_updater) | ||
|
|
||
| %{data_updater: data_updater} |
There was a problem hiding this comment.
This is repeated in similar fashion in two or three files, would it be reasonable to write it only once somewhere in the test dir and simply reference it?
There was a problem hiding this comment.
done, though they're still two separate functions
7673021 to
c79af35
Compare
- use typedstruct instead of typed_struct to avoid mismatches with other astarte libraries - remove efx as it depends on typed_struct, and use mimic in its stead Signed-off-by: Francesco Noacco <francesco.noacco@secomind.com>
Signed-off-by: Francesco Noacco <francesco.noacco@secomind.com>
c79af35 to
ad820ff
Compare