Fix flaky test
Waiting for the timeout option to be set means we could still sneak in
and grab the old FDB database handle before fabric2_server updated it in
the application environment.
This new approach just waits until the handle has been updated by
watching the value in the application environment directly.
diff --git a/src/fabric/test/fabric2_tx_options_tests.erl b/src/fabric/test/fabric2_tx_options_tests.erl
index b93cc3d..3232922 100644
--- a/src/fabric/test/fabric2_tx_options_tests.erl
+++ b/src/fabric/test/fabric2_tx_options_tests.erl
@@ -84,9 +84,15 @@
meck:reset(erlfdb),
+ % Wait until after fabric2_server has updated the new fdb handle
+ OldDbHandle = get(?PDICT_DB_KEY),
config:delete("fdb_tx_options", "size_limit", false),
- % Assert that we get a new handle and are setting our default values
- meck:wait(erlfdb, set_option, ['_', timeout, '_'], 4000),
+ test_util:wait(fun() ->
+ case application:get_env(fabric, db) of
+ {ok, OldDbHandle} -> wait;
+ {ok, _} -> ok
+ end
+ end),
erase(?PDICT_DB_KEY),
{ok, Db1} = fabric2_db:open(DbName, [?ADMIN_CTX]),