Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/processone/ejabberd.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSergey Abramyan <sa.abramyan@gmail.com>2015-03-16 21:53:19 +0300
committerSergey Abramyan <sa.abramyan@gmail.com>2015-03-20 01:10:47 +0300
commit5ae01e8bb40915371052b7f46eeb2f92b95c2e27 (patch)
tree8cb5aeca69c1e1adc91db47bdc3c1a4f754d1c80 /test
parentaa1250a3ddf952119982970acc8a743dda6c1041 (diff)
Add SQLite support
Diffstat (limited to 'test')
-rw-r--r--test/ejabberd_SUITE.erl15
-rw-r--r--test/ejabberd_SUITE_data/ejabberd.cfg20
-rw-r--r--test/ejabberd_SUITE_data/ejabberd.yml52
-rw-r--r--test/suite.hrl1
4 files changed, 88 insertions, 0 deletions
diff --git a/test/ejabberd_SUITE.erl b/test/ejabberd_SUITE.erl
index 9ab9c247e..ec60b728d 100644
--- a/test/ejabberd_SUITE.erl
+++ b/test/ejabberd_SUITE.erl
@@ -35,6 +35,7 @@ init_per_suite(Config) ->
LDIFFile = filename:join([DataDir, "ejabberd.ldif"]),
{ok, _} = file:copy(ExtAuthScript, filename:join([CWD, "extauth.py"])),
{ok, _} = ldap_srv:start(LDIFFile),
+ file:delete("/tmp/ejabberd_test.db"),
ok = application:start(ejabberd),
NewConfig.
@@ -65,6 +66,14 @@ init_per_group(pgsql, Config) ->
Err ->
{skip, {pgsql_not_available, Err}}
end;
+init_per_group(sqlite, Config) ->
+ case catch ejabberd_odbc:sql_query(?SQLITE_VHOST, [<<"select 1;">>]) of
+ {selected, _, _} ->
+ mod_muc:shutdown_rooms(?SQLITE_VHOST),
+ set_opt(server, ?SQLITE_VHOST, Config);
+ Err ->
+ {skip, {sqlite_not_available, Err}}
+ end;
init_per_group(ldap, Config) ->
set_opt(server, ?LDAP_VHOST, Config);
init_per_group(extauth, Config) ->
@@ -88,6 +97,8 @@ end_per_group(mysql, _Config) ->
ok;
end_per_group(pgsql, _Config) ->
ok;
+end_per_group(sqlite, _Config) ->
+ ok;
end_per_group(no_db, _Config) ->
ok;
end_per_group(ldap, _Config) ->
@@ -300,6 +311,7 @@ groups() ->
{mnesia, [sequence], db_tests(mnesia)},
{mysql, [sequence], db_tests(mysql)},
{pgsql, [sequence], db_tests(pgsql)},
+ {sqlite, [sequence], db_tests(sqlite)},
{riak, [sequence], db_tests(riak)}].
all() ->
@@ -308,6 +320,7 @@ all() ->
{group, mnesia},
{group, mysql},
{group, pgsql},
+ {group, sqlite},
{group, extauth},
{group, riak},
stop_ejabberd].
@@ -1631,6 +1644,8 @@ socks5_recv(Sock, Data) ->
%%%===================================================================
%%% SQL stuff
%%%===================================================================
+create_sql_tables(sqlite, _BaseDir) ->
+ ok;
create_sql_tables(Type, BaseDir) ->
{VHost, File} = case Type of
mysql ->
diff --git a/test/ejabberd_SUITE_data/ejabberd.cfg b/test/ejabberd_SUITE_data/ejabberd.cfg
index 458de2c7d..cb321661e 100644
--- a/test/ejabberd_SUITE_data/ejabberd.cfg
+++ b/test/ejabberd_SUITE_data/ejabberd.cfg
@@ -3,6 +3,7 @@
"mnesia.localhost",
"mysql.localhost",
"pgsql.localhost",
+ "sqlite.localhost",
"extauth.localhost",
"ldap.localhost"]}.
{define_macro, 'CERTFILE', "cert.pem"}.
@@ -120,6 +121,25 @@
{mod_roster, [{db_type, odbc}]},
{mod_vcard, [{db_type, odbc}]}]}
]}.
+{host_config, "sqlite.localhost",
+ [{auth_method, odbc},
+ {odbc_pool_size, 1},
+ {odbc_server, {sqlite, "/tmp/ejabberd_test.db"}},
+ {{add, modules}, [{mod_announce, [{db_type, odbc}]},
+ {mod_blocking, [{db_type, odbc}]},
+ {mod_caps, [{db_type, odbc}]},
+ {mod_last, [{db_type, odbc}]},
+ {mod_muc, [{db_type, odbc}]},
+ {mod_offline, [{db_type, odbc}]},
+ {mod_privacy, [{db_type, odbc}]},
+ {mod_private, [{db_type, odbc}]},
+ {mod_pubsub_odbc, [{access_createnode, pubsub_createnode},
+ {ignore_pep_from_offline, true},
+ {last_item_cache, false},
+ {plugins, ["flat", "hometree", "pep"]}]},
+ {mod_roster, [{db_type, odbc}]},
+ {mod_vcard, [{db_type, odbc}]}]}
+ ]}.
{host_config, "ldap.localhost",
[{auth_method, ldap},
{ldap_servers, ["localhost"]},
diff --git a/test/ejabberd_SUITE_data/ejabberd.yml b/test/ejabberd_SUITE_data/ejabberd.yml
index 9bd8a8b0a..1714464d5 100644
--- a/test/ejabberd_SUITE_data/ejabberd.yml
+++ b/test/ejabberd_SUITE_data/ejabberd.yml
@@ -55,6 +55,57 @@ Welcome to this XMPP server."
mod_stats: []
mod_time: []
mod_version: []
+ "sqlite.localhost":
+ odbc_type: sqlite
+ odbc_database: "/tmp/ejabberd_test.db"
+ auth_method: odbc
+ modules:
+ mod_announce:
+ db_type: odbc
+ access: local
+ mod_blocking:
+ db_type: odbc
+ mod_caps:
+ db_type: odbc
+ mod_last:
+ db_type: odbc
+ mod_muc:
+ db_type: odbc
+ mod_offline:
+ db_type: odbc
+ mod_privacy:
+ db_type: odbc
+ mod_private:
+ db_type: odbc
+ mod_pubsub_odbc:
+ access_createnode: pubsub_createnode
+ ignore_pep_from_offline: true
+ last_item_cache: false
+ plugins:
+ - "flat"
+ - "hometree"
+ - "pep"
+ mod_roster:
+ versioning: true
+ store_current_id: true
+ db_type: odbc
+ mod_vcard:
+ db_type: odbc
+ mod_vcard_xupdate:
+ db_type: odbc
+ mod_adhoc: []
+ mod_configure: []
+ mod_disco: []
+ mod_ping: []
+ mod_proxy65: []
+ mod_register:
+ welcome_message:
+ subject: "Welcome!"
+ body: "Hi.
+Welcome to this XMPP server."
+ mod_stats: []
+ mod_time: []
+ mod_version: []
"mysql.localhost":
odbc_username: "ejabberd_test"
odbc_type: mysql
@@ -242,6 +293,7 @@ hosts:
- "extauth.localhost"
- "ldap.localhost"
- "riak.localhost"
+ - "sqlite.localhost"
access:
announce:
admin: allow
diff --git a/test/suite.hrl b/test/suite.hrl
index 49bfff2d9..269620179 100644
--- a/test/suite.hrl
+++ b/test/suite.hrl
@@ -59,6 +59,7 @@
-define(MNESIA_VHOST, <<"mnesia.localhost">>).
-define(MYSQL_VHOST, <<"mysql.localhost">>).
-define(PGSQL_VHOST, <<"pgsql.localhost">>).
+-define(SQLITE_VHOST, <<"sqlite.localhost">>).
-define(LDAP_VHOST, <<"ldap.localhost">>).
-define(EXTAUTH_VHOST, <<"extauth.localhost">>).
-define(RIAK_VHOST, <<"riak.localhost">>).