diff options
author | Paul J. Davis <paul.joseph.davis@gmail.com> | 2020-11-10 12:46:07 -0600 |
---|---|---|
committer | Paul J. Davis <paul.joseph.davis@gmail.com> | 2020-11-10 14:09:32 -0600 |
commit | 1a138804f692d0e578a7d4a19f9f13099a59a1cd (patch) | |
tree | 58a0538fd78c30ca846f3de0edcc083639247a82 | |
parent | 7d3caa97b18a8bd953c96b39c9a986a4a11e5f34 (diff) | |
download | couchdb-1a138804f692d0e578a7d4a19f9f13099a59a1cd.tar.gz |
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.
-rw-r--r-- | src/fabric/test/fabric2_tx_options_tests.erl | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/fabric/test/fabric2_tx_options_tests.erl b/src/fabric/test/fabric2_tx_options_tests.erl index b93cc3d69..323292287 100644 --- a/src/fabric/test/fabric2_tx_options_tests.erl +++ b/src/fabric/test/fabric2_tx_options_tests.erl @@ -84,9 +84,15 @@ can_configure_options_at_runtime(_) -> 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]), |