diff options
author | Brian Cully <bjc@kublai.com> | 2012-02-09 23:00:53 -0500 |
---|---|---|
committer | Brian Cully <bjc@kublai.com> | 2012-02-09 23:00:53 -0500 |
commit | 07369746fd460019822624c1a0651beaf19bf0ae (patch) | |
tree | 3ba8ea3fd5fa80878f8ffde375875a107cc8294b /test | |
parent | 9b1a0a6f6e98af296f36e5030fe3425e6a97d73c (diff) | |
download | mysqlerl-07369746fd460019822624c1a0651beaf19bf0ae.tar.gz mysqlerl-07369746fd460019822624c1a0651beaf19bf0ae.zip |
Add tests for invalid connection/disconnection
Diffstat (limited to 'test')
-rw-r--r-- | test/mysqlerl_connect_SUITE.erl | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/test/mysqlerl_connect_SUITE.erl b/test/mysqlerl_connect_SUITE.erl index 5f18648..03baa13 100644 --- a/test/mysqlerl_connect_SUITE.erl +++ b/test/mysqlerl_connect_SUITE.erl @@ -109,8 +109,8 @@ groups() -> %% @end %%-------------------------------------------------------------------- all() -> - [valid_connect, valid_disconnect, no_port_driver, - port_dies, owner_dies, controller_dies]. + [valid_connect, valid_disconnect, invalid_connect, invalid_disconnect, + no_port_driver, port_dies, owner_dies, controller_dies]. %%-------------------------------------------------------------------- %% @spec TestCase(Config0) -> @@ -138,6 +138,24 @@ valid_disconnect(doc) -> valid_disconnect(Config) -> ok = mysqlerl:disconnect(?config(db_ref, Config)). +invalid_connect(doc) -> + ["Test that error returns when connecting to a non-existant database."]; +invalid_connect(Config) -> + DBInfo = ct:get_config(db_info), + {error, _} = mysqlerl:connect(?config(host, DBInfo), + ?config(port, DBInfo), + ?config(name, DBInfo) ++ "nonesuchdb", + ?config(username, DBInfo), + ?config(password, DBInfo), + ?config(options, DBInfo)). + +invalid_disconnect(doc) -> + ["Test that disconnecting a disconnected returns success."]; +invalid_disconnect(Config) -> + {db_ref, DBRef} = hd(valid_connect(Config)), + ok = valid_disconnect(Config), + ok = mysqlerl:disconnect(DBRef). + no_port_driver(doc) -> ["Test that connection fails properly when the port driver is missing."]; no_port_driver(_Config) -> |