Skip to content

Commit

Permalink
Demonstrate file watcher issue
Browse files Browse the repository at this point in the history
Have to give the gen_server time to fail fully to see the test fail
because the supervisor will restart fast/often enough to get through
the test run otherwise.
  • Loading branch information
matt-glover committed Dec 21, 2021
1 parent 18ab646 commit c408b1b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/ldclient_file_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ check_file_watcher(_) ->
{{0, true, fallthrough}, _} = ldclient_eval:flag_key_for_user(watch_files, <<"test-flag">>, #{key => <<"user123">>}, "foo"),
%The timestamp for the modified time is in seconds. So we wait a moment to get a new timestamp compared to creation.
timer:sleep(1200),
%Sleep long enough for the gen_server to stop retrying/recovering to demonstrate the failure
timer:sleep(5000),
file:write_file("tmpfile.json", ["{\"flagValues\": {\"test-flag\": false}}"]),
timer:sleep(1000),
{{0, false, fallthrough}, _} = ldclient_eval:flag_key_for_user(watch_files, <<"test-flag">>, #{key => <<"user123">>}, "foo").
Expand Down

0 comments on commit c408b1b

Please sign in to comment.