aboutsummaryrefslogtreecommitdiffstats
path: root/lib/odbc/test/odbc_connect_SUITE.erl
diff options
context:
space:
mode:
authorZandra Hird <[email protected]>2015-08-13 13:00:04 +0200
committerZandra Hird <[email protected]>2015-08-13 13:00:04 +0200
commitc972a98fe58569d661e9bfad5512bcdb498f6200 (patch)
tree35e91e20e6bc93756e255dbe07f5bc6c720a2b04 /lib/odbc/test/odbc_connect_SUITE.erl
parent998663642c63d753d2c9284f5fda9447b59930d9 (diff)
parent40a02d4e75e088b31df8e25973bd741ae0c39797 (diff)
downloadotp-c972a98fe58569d661e9bfad5512bcdb498f6200.tar.gz
otp-c972a98fe58569d661e9bfad5512bcdb498f6200.tar.bz2
otp-c972a98fe58569d661e9bfad5512bcdb498f6200.zip
Merge branch 'sstrigler/fix-port-timeout' into maint
OTP-12935 * sstrigler/fix-port-timeout: add test for odbc port_timeout add doc for odbc port_timeout introduce odbc port_timeout
Diffstat (limited to 'lib/odbc/test/odbc_connect_SUITE.erl')
-rw-r--r--lib/odbc/test/odbc_connect_SUITE.erl30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/odbc/test/odbc_connect_SUITE.erl b/lib/odbc/test/odbc_connect_SUITE.erl
index 93e949faf6..2d4173a008 100644
--- a/lib/odbc/test/odbc_connect_SUITE.erl
+++ b/lib/odbc/test/odbc_connect_SUITE.erl
@@ -120,7 +120,16 @@ end_per_suite(_Config) ->
%% Note: This function is free to add any key/value pairs to the Config
%% variable, but should NOT alter/remove any existing entries.
%%--------------------------------------------------------------------
+init_per_testcase(connect_port_timeout, Config) ->
+ odbc:stop(),
+ application:load(odbc),
+ application:set_env(odbc, port_timeout, 0),
+ odbc:start(),
+ init_per_testcase_common(Config);
init_per_testcase(_TestCase, Config) ->
+ init_per_testcase_common(Config).
+
+init_per_testcase_common(Config) ->
test_server:format("ODBCINI = ~p~n", [os:getenv("ODBCINI")]),
Dog = test_server:timetrap(?default_timeout),
Temp = lists:keydelete(connection_ref, 1, Config),
@@ -135,7 +144,16 @@ init_per_testcase(_TestCase, Config) ->
%% A list of key/value pairs, holding the test case configuration.
%% Description: Cleanup after each test case
%%--------------------------------------------------------------------
+
+end_per_testcase(connect_port_timeout, Config) ->
+ application:unset_env(odbc, port_timeout),
+ odbc:stop(),
+ odbc:start(),
+ end_per_testcase_common(Config);
end_per_testcase(_TestCase, Config) ->
+ end_per_testcase_common(Config).
+
+end_per_testcase_common(Config) ->
Table = ?config(tableName, Config),
{ok, Ref} = odbc:connect(?RDBMS:connection_string(), odbc_test_lib:platform_options()),
Result = odbc:sql_query(Ref, "DROP TABLE " ++ Table),
@@ -423,6 +441,18 @@ connect_timeout(Config) when is_list(Config) ->
%% Need to return ok here "{'EXIT',timeout} return value" will
%% be interpreted as that the testcase has timed out.
ok.
+
+%%-------------------------------------------------------------------------
+connect_port_timeout(doc) ->
+ ["Test the timeout for the port program to connect back to the odbc "
+ "application within the connect function."];
+connect_port_timeout(suite) -> [];
+connect_port_timeout(Config) when is_list(Config) ->
+ %% Application environment var 'port_timeout' has been set to 0 by
+ %% init_per_testcase/2.
+ {error,timeout} = odbc:connect(?RDBMS:connection_string(),
+ odbc_test_lib:platform_options()).
+
%%-------------------------------------------------------------------------
timeout(doc) ->
["Test that timeouts don't cause unwanted behavior sush as receiving"