]> granicus.if.org Git - ejabberd/commitdiff
Fix elixir tests
authorPaweł Chmielowski <pchmielowski@process-one.net>
Mon, 29 Jan 2018 17:28:02 +0000 (18:28 +0100)
committerPaweł Chmielowski <pchmielowski@process-one.net>
Mon, 29 Jan 2018 17:28:02 +0000 (18:28 +0100)
src/ejabberd_config.erl
test/mod_admin_extra_test.exs

index 57e205ca451a8e8a2402d2debbb9093b4b775104..f898936f56430bfdec2b3d8ddbe3d41f53364a39 100644 (file)
@@ -110,7 +110,17 @@ start(Hosts, Opts) ->
                  [named_table, public, {read_concurrency, true}]),
     catch ets:new(ejabberd_db_modules,
                  [named_table, public, {read_concurrency, true}]),
-    set_opts(set_hosts_in_options(Hosts, #state{opts = Opts})),
+    UnixTime = p1_time_compat:system_time(seconds),
+    SharedKey = case erlang:get_cookie() of
+                   nocookie ->
+                       str:sha(randoms:get_string());
+                   Cookie ->
+                       str:sha(misc:atom_to_binary(Cookie))
+               end,
+    State1 = #state{opts = Opts},
+    State2 = set_option({node_start, global}, UnixTime, State1),
+    State3 = set_option({shared_key, global}, SharedKey, State2),
+    set_opts(set_hosts_in_options(Hosts, State3)),
     ok.
 
 %% @doc Get the filename of the ejabberd configuration file.
@@ -1057,12 +1067,7 @@ get_version() ->
 -spec get_myhosts() -> [binary()].
 
 get_myhosts() ->
-    case get_option(hosts) of
-       V when is_list(V) ->
-           V;
-       _ ->
-           []
-    end.
+    get_option(hosts).
 
 -spec get_mylang() -> binary().
 
index 38c19dd64cb76b063e6ccdf76434c054487a0742..610d354e19d538991b1046b0ca750f362fb576bd 100644 (file)
@@ -50,8 +50,8 @@ defmodule EjabberdModAdminExtraTest do
                :acl.start_link
                :ejabberd_access_permissions.start_link()
                :ejabberd_commands.start_link
-        :ok = :ejabberd_config.start([@domain], [])
-        :gen_mod.start_link
+    :ok = :ejabberd_config.start(["domain"], [])
+    :gen_mod.start_link
                :mod_admin_extra.start(@domain, [])
                :sel_application.start_app(:moka)
                :ejabberd_hooks.start_link