-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle
already_started
when starting instance (#111)
**Requirements** - [x] I have added test coverage for new or changed functionality - [x] I have followed the repository's [pull request submission guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests) - [ ] I have validated my changes against all supported platform versions **Related issues** https://github.com/launchdarkly/erlang-server-sdk/blob/242986ec2dd4e42cf603ef2005de1fd96444aa42/src/ldclient_instance.erl#L61 **Describe the solution you've provided** N/A **Describe alternatives you've considered** N/A **Additional context** Add any other context about the pull request here.
- Loading branch information
Showing
2 changed files
with
78 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
-module(ldclient_start_SUITE). | ||
|
||
-include_lib("common_test/include/ct.hrl"). | ||
|
||
-compile(export_all). | ||
|
||
%%==================================================================== | ||
%% ct functions | ||
%%==================================================================== | ||
all() -> | ||
[ | ||
test_already_running_client | ||
]. | ||
|
||
init_per_suite(Config) -> | ||
{ok, _} = application:ensure_all_started(ldclient), | ||
Config. | ||
|
||
end_per_suite(_) -> | ||
ok = application:stop(ldclient). | ||
|
||
init_per_testcase(_, Config) -> | ||
Options = #{ | ||
send_events => false, | ||
feature_store => ldclient_storage_map, | ||
datasource => testdata | ||
}, | ||
ldclient:start_instance("", Options), | ||
Config. | ||
|
||
end_per_testcase(_, _Config) -> | ||
ldclient:stop_all_instances(). | ||
|
||
%%==================================================================== | ||
%% Tests | ||
%%==================================================================== | ||
|
||
test_already_running_client(_) -> | ||
{error, already_started, _} = ldclient:start_instance("", #{ | ||
send_events => false, | ||
feature_store => ldclient_storage_map, | ||
datasource => testdata | ||
}). |