diff options
| author | Michael Klishin <mklishin@pivotal.io> | 2019-10-08 16:19:04 -0500 |
|---|---|---|
| committer | Michael Klishin <mklishin@pivotal.io> | 2019-10-08 16:19:04 -0500 |
| commit | b165835f53635ba9d390ae359ef3247206e4e9af (patch) | |
| tree | 97fd2237034f4dcf843512e0c82a3ddb88ed2544 | |
| parent | f710876288872948c6cb64074ab800fb75e83986 (diff) | |
| download | rabbitmq-server-git-b165835f53635ba9d390ae359ef3247206e4e9af.tar.gz | |
rabbit_feature_flags:on_load/1: EUnit test env compatibility
rabbit.feature_flags_file would not be set in an EUnit test
environment, so proceed with code loading if eunit is loaded.
References #2133.
| -rw-r--r-- | src/rabbit_feature_flags.erl | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/rabbit_feature_flags.erl b/src/rabbit_feature_flags.erl index 9591cd691d..066a3db0a4 100644 --- a/src/rabbit_feature_flags.erl +++ b/src/rabbit_feature_flags.erl @@ -2269,13 +2269,20 @@ share_new_feature_flags_after_app_load(FeatureFlags, Timeout) -> node(), FeatureFlags, Timeout). on_load() -> + Vsn = rabbit_data_coercion:to_list(rabbit_misc:version()), case application:get_env(rabbit, feature_flags_file) of {ok, _} -> ok; _ -> - "Refusing to load '" ?MODULE_STRING "' in what appears to " - "be a pre-feature-flags running node " - "(" ++ rabbit_misc:version() ++ "). This is fine: it is " - "probably a remote node querying this node for its feature " - "flags." + %% rabbit.feature_flags_file would not be set in unit tests. MK. + case code:is_loaded(eunit) of + false -> + "Refusing to load '" ?MODULE_STRING "' in what appears to " + "be a pre-feature-flags running node " + "(" ++ Vsn ++ "). This is fine: it is " + "probably a remote node querying this node for its feature " + "flags."; + {file, _} -> ok; + _ -> ok + end end. |
