Skip to content

Commit

Permalink
Merge pull request #1017 from eddbbt/resolve-flakiness
Browse files Browse the repository at this point in the history
Resolve test flakiness
  • Loading branch information
Annopaolo authored and eddbbt committed Dec 2, 2024
2 parents b266a4e + 461cb5b commit 5a50a68
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@
defmodule Astarte.RealmManagement.APIWeb.TriggerControllerTest do
use Astarte.RealmManagement.APIWeb.ConnCase

alias Astarte.RealmManagement.API.JWTTestHelper
alias Astarte.RealmManagement.Mock

@create_attrs %{}
@invalid_attrs %{}

@test_realm "test"

setup %{conn: conn} do
Mock.DB.put_jwt_public_key_pem(@test_realm, JWTTestHelper.public_key_pem())
{:ok, conn: put_req_header(conn, "accept", "application/json")}
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ defmodule Astarte.TriggerEngine.AMQPConsumer.AMQPConsumerTrackerTest do

# make sure we update the consumer list without waiting for the update timeout
AMQPConsumerTracker.handle_info(:update_consumers, [])
Process.sleep(3000)

assert Enum.member?(
Registry.select(Registry.AMQPConsumerRegistry, [{{:"$1", :_, :_}, [], [:"$1"]}]),
Expand All @@ -93,6 +94,7 @@ defmodule Astarte.TriggerEngine.AMQPConsumer.AMQPConsumerTrackerTest do

# make sure we update the consumer list without waiting for the update timeout
AMQPConsumerTracker.handle_info(:update_consumers, [])
Process.sleep(3000)

assert not Enum.member?(
Registry.select(Registry.AMQPConsumerRegistry, [{{:"$1", :_, :_}, [], [:"$1"]}]),
Expand Down

0 comments on commit 5a50a68

Please sign in to comment.