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

executor_test: make expectations order-independent #569

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,10 @@ defmodule Edgehog.UpdateCampaigns.PushRollout.ExecutorTest do
base_image_url = update_campaign.base_image.url
target_device_ids = Enum.map(update_campaign.update_targets, & &1.device.device_id)

# Set an expectation for each target on the OTARequest mock and send back a message
# to wait for all devices
Enum.each(target_device_ids, fn device_id ->
expect(OTARequestV1Mock, :update, fn _client, ^device_id, _uuid, ^base_image_url ->
send_sync(parent, {ref, device_id})
:ok
end)
# Expect target_count update calls and send back a message for each device
expect(OTARequestV1Mock, :update, target_count, fn _client, device_id, _uuid, ^base_image_url ->
send_sync(parent, {ref, device_id})
:ok
end)

pid = start_executor!(update_campaign)
Expand Down
Loading