node-oracledb/test
Christopher Jones ebb7a48ed5 Refactor tests for maxRows 2018-02-06 13:12:46 +11:00
..
opts Refactor tests for maxRows 2018-02-06 13:12:46 +11:00
.editorconfig Add test editorconfig 2016-05-16 09:35:54 +10:00
README.md Sync tests and fix missed merges 2017-06-14 11:54:15 +10:00
autoCommit.js Improve validation for invalid attribute and parameter values 2017-11-17 22:49:53 +11:00
autoCommit4nestedExecutes.js Sync tests and fix missed merges 2017-06-14 11:54:15 +10:00
autoCommitForSelect.js Test updates 2017-06-17 09:40:09 +10:00
bindTimestamp.js Test updates 2017-06-17 09:40:09 +10:00
binding.js Update tests 2017-11-17 22:59:41 +11:00
binding_DMLInsert.js Test updates 2017-06-14 10:22:07 +10:00
binding_DMLReturningInto.js Test updates 2017-06-14 10:22:07 +10:00
binding_defaultBindIn.js Test updates 2017-06-14 10:22:07 +10:00
binding_defaultBindInout.js Test updates 2017-06-14 10:22:07 +10:00
binding_functionBindIn.js Test updates 2017-06-14 10:22:07 +10:00
binding_functionBindInout.js Update tests 2017-11-17 22:59:41 +11:00
binding_functionBindOut.js Update tests 2017-11-17 22:59:41 +11:00
binding_procedureBindIn.js Update tests 2017-11-17 22:59:41 +11:00
binding_procedureBindInout.js Update tests 2017-11-17 22:59:41 +11:00
binding_procedureBindOut.js Update tests 2017-11-17 22:59:41 +11:00
blobDMLBindAsBuffer.js Prevent Lob Stream close event being emitted multiple times for error conditions with Node 8 2017-06-29 16:20:52 +10:00
blobDMLReturningMultipleRowsAsBuffer.js Test updates 2017-10-23 13:35:57 +11:00
blobDMLReturningMultipleRowsAsStream.js Test updates 2017-10-23 13:35:57 +11:00
blobPlsqlBindAsBuffer_bindin.js Ensure that statements and LOBs are closed before the connection is closed, to match ODPI-C hardening 2017-08-01 14:14:43 +10:00
blobPlsqlBindAsBuffer_bindinout.js Update testsuite 2017-07-08 12:43:45 +10:00
blobPlsqlBindAsBuffer_bindout.js Sync tests and fix missed merges 2017-06-14 11:54:45 +10:00
blobStream.js Ensure that statements and LOBs are closed before the connection is closed, to match ODPI-C hardening 2017-08-01 14:14:43 +10:00
checkClassesTypes.js Ensure that statements and LOBs are closed before the connection is closed, to match ODPI-C hardening 2017-08-01 14:14:43 +10:00
clobDMLBindAsString.js Prevent Lob Stream close event being emitted multiple times for error conditions with Node 8 2017-06-29 16:20:52 +10:00
clobDMLReturningMultipleRowsAsStream.js Test updates 2017-10-23 13:35:57 +11:00
clobDMLReturningMultipleRowsAsString.js Test updates 2017-10-23 13:35:57 +11:00
clobPlsqlBindAsString_bindin.js Ensure that statements and LOBs are closed before the connection is closed, to match ODPI-C hardening 2017-08-01 14:14:43 +10:00
clobPlsqlBindAsString_bindinout.js Sync tests and fix missed merges 2017-06-14 11:54:45 +10:00
clobPlsqlBindAsString_bindout.js Update tests 2017-11-17 22:59:41 +11:00
clobPlsqlString.js Sync tests and fix missed merges 2017-06-14 11:54:15 +10:00
clobStream.js Ensure that statements and LOBs are closed before the connection is closed, to match ODPI-C hardening 2017-08-01 14:14:43 +10:00
clobexample.txt Update URL to reflect changed OTN hierarchy 2015-11-15 08:28:11 +11:00
columnMetadata.js Ensure that statements and LOBs are closed before the connection is closed, to match ODPI-C hardening 2017-08-01 14:14:43 +10:00
connClose.js Ensure that statements and LOBs are closed before the connection is closed, to match ODPI-C hardening 2017-08-01 14:14:43 +10:00
connection.js Refactor tests for maxRows 2018-02-06 13:12:46 +11:00
constants.js Sync tests and fix missed merges 2017-06-14 11:54:45 +10:00
dataTypeAssist.js Update tests: Avoid too many async queries to one table 2017-12-13 09:16:18 +11:00
dataTypeBinaryDouble.js Update tests 2017-11-17 22:59:41 +11:00
dataTypeBinaryFloat.js Update tests 2017-11-17 22:59:41 +11:00
dataTypeBlob.js Sync tests and fix missed merges 2017-06-14 11:54:15 +10:00
dataTypeChar.js Update tests 2017-11-17 22:59:41 +11:00
dataTypeClob.js Sync tests and fix missed merges 2017-06-14 11:54:15 +10:00
dataTypeDate.js Update tests 2017-11-17 22:59:41 +11:00
dataTypeFloat.js Update tests 2017-11-17 22:59:41 +11:00
dataTypeFloat2.js Update tests 2017-11-17 22:59:41 +11:00
dataTypeLong.js Test updates 2017-06-14 10:56:58 +10:00
dataTypeLongRaw.js Test updates 2017-06-14 10:56:58 +10:00
dataTypeNchar.js Update tests 2017-11-17 22:59:41 +11:00
dataTypeNclob.js Update tests 2017-11-17 22:59:41 +11:00
dataTypeNumber.js Update tests 2017-11-17 22:59:41 +11:00
dataTypeNumber2.js Test updates 2017-06-17 09:40:09 +10:00
dataTypeNvarchar2.js Update tests 2017-11-17 22:59:41 +11:00
dataTypeRaw.js Test stabilization and updates 2017-08-16 15:14:39 +10:00
dataTypeRowid.js Update tests 2017-11-17 22:59:41 +11:00
dataTypeTimestamp1.js Update tests 2017-11-17 22:59:41 +11:00
dataTypeTimestamp2.js Resolve a race condition in tests 2017-12-12 09:51:53 +11:00
dataTypeTimestamp3.js Update tests 2017-11-17 22:59:41 +11:00
dataTypeTimestamp4.js Update tests 2017-11-17 22:59:41 +11:00
dataTypeTimestamp5.js Update tests 2017-11-17 22:59:41 +11:00
dataTypeTimestamp6.js Update tests 2017-11-17 22:59:41 +11:00
dataTypeUrowid.js Update tests 2017-11-17 22:59:41 +11:00
dataTypeVarchar2.js Update tests 2017-11-17 22:59:41 +11:00
dbconfig.js Sync tests and fix missed merges 2017-06-14 11:54:15 +10:00
devnull.js Sync tests and fix missed merges 2017-06-14 11:54:45 +10:00
dmlReturning.js Remove trailing whitespace 2017-06-14 12:42:45 +10:00
driverName.js Sync tests and fix missed merges 2017-06-14 11:54:45 +10:00
examples.js Implementation of resultSet.getRow() buffering in JavaScript instead of C++. 2017-12-12 10:03:15 +11:00
extendedMetaData.js Improve validation for invalid attribute and parameter values 2017-11-17 22:49:53 +11:00
externalAuth.js Sync tests and fix missed merges 2017-06-14 11:54:45 +10:00
fetchArraySize1.js Add tests for oracledb.fetchArraySize 2017-12-12 10:08:25 +11:00
fetchArraySize2.js Update tests: fix multiple SQL calls. Add tests for potential off-by-one cases 2017-12-13 09:17:50 +11:00
fetchArraySize3.js Update tests: fix multiple SQL calls. Add tests for potential off-by-one cases 2017-12-13 09:17:50 +11:00
fetchArraySize4.js Update tests: fix multiple SQL calls. Add tests for potential off-by-one cases 2017-12-13 09:17:50 +11:00
fetchArraySize5.js Update tests: fix multiple SQL calls. Add tests for potential off-by-one cases 2017-12-13 09:17:50 +11:00
fetchArraySize6.js Update tests: fix multiple SQL calls. Add tests for potential off-by-one cases 2017-12-13 09:17:50 +11:00
fetchArraySize7.js Update tests: fix multiple SQL calls. Add tests for potential off-by-one cases 2017-12-13 09:17:50 +11:00
fetchArraySize8.js Update tests: fix multiple SQL calls. Add tests for potential off-by-one cases 2017-12-13 09:17:50 +11:00
fetchArraySize9.js Update tests: fix multiple SQL calls. Add tests for potential off-by-one cases 2017-12-13 09:17:50 +11:00
fetchAs.js Improve attribute validation 2017-06-29 16:16:01 +10:00
fetchAsStringWithRefCursor.js Test updates 2017-10-23 13:35:57 +11:00
fetchBlobAsBuffer1.js Update tests 2017-11-17 22:59:41 +11:00
fetchBlobAsBuffer2.js Update tests 2017-11-17 22:59:41 +11:00
fetchBlobAsBuffer3.js Update tests 2017-11-17 22:59:41 +11:00
fetchBlobAsBuffer4.js Test updates 2017-06-14 10:22:07 +10:00
fetchClobAsString1.js Update tests 2017-11-17 22:59:41 +11:00
fetchClobAsString2.js Update tests 2017-11-17 22:59:41 +11:00
fetchClobAsString3.js Update tests 2017-11-17 22:59:41 +11:00
fetchClobAsString4.js Test updates 2017-06-14 10:22:07 +10:00
fetchRowidAsString.js Speed up Stream tests 2017-06-29 16:24:38 +10:00
fetchTimestampAsString.js Implementation of resultSet.getRow() buffering in JavaScript instead of C++. 2017-12-12 10:03:15 +11:00
fetchUrowidAsString.js Speed up Stream tests 2017-06-29 16:24:38 +10:00
fetchUrowidAsString_indexed.js Speed up Stream tests 2017-06-29 16:24:38 +10:00
file.js Test updates 2017-06-17 09:40:09 +10:00
fuzzydinosaur.jpg Update tests for new functionality 2015-08-17 16:19:36 +10:00
insertNaNToNumber.js Update tests 2017-11-17 22:59:41 +11:00
instanceof.js Sync tests and fix missed merges 2017-06-14 11:54:15 +10:00
list.txt Refactor tests for maxRows 2018-02-06 13:12:46 +11:00
lobBind1.js Update tests for LOB bind enhancement 2017-11-19 11:07:32 +11:00
lobBind2.js Sync tests and fix missed merges 2017-06-14 11:54:45 +10:00
lobBindAsStringBuffer.js Ensure that statements and LOBs are closed before the connection is closed, to match ODPI-C hardening 2017-08-01 14:14:43 +10:00
lobProperties1.js Ensure that statements and LOBs are closed before the connection is closed, to match ODPI-C hardening 2017-08-01 14:14:43 +10:00
lobProperties2.js Sync tests and fix missed merges 2017-06-14 11:54:45 +10:00
lobResultSet.js Sync tests and fix missed merges 2017-06-14 11:54:15 +10:00
longDMLBind.js Test updates 2017-06-17 09:40:09 +10:00
longProcedureBind_in.js Test LONG PL/SQL binding 2017-06-29 16:12:18 +10:00
longProcedureBind_inout.js Test LONG PL/SQL binding 2017-06-29 16:12:18 +10:00
longProcedureBind_out.js Test LONG PL/SQL binding 2017-06-29 16:12:18 +10:00
longrawDMLBind.js Test updates 2017-06-17 09:40:09 +10:00
longrawProcedureBind_in.js Test LONG RAW PL/SQL binding 2017-06-29 16:17:44 +10:00
longrawProcedureBind_inout.js Test LONG RAW PL/SQL binding 2017-06-29 16:17:44 +10:00
longrawProcedureBind_out.js Test LONG RAW PL/SQL binding 2017-06-29 16:17:44 +10:00
maxRows.js Refactor tests for maxRows 2018-02-06 13:12:46 +11:00
multipleLobInsertion.js Sync tests and fix missed merges 2017-06-14 11:54:45 +10:00
nclobDMLBindAsString.js Test updates 2017-06-17 09:40:09 +10:00
nestedCursor.js Test updates 2017-06-17 09:40:09 +10:00
nullColumnValues.js Test updates 2017-06-17 09:40:09 +10:00
plsqlBindIndexedTable1.js Remove trailing whitespace 2017-06-14 12:42:45 +10:00
plsqlBindIndexedTable2.js Update tests 2017-11-17 22:59:41 +11:00
plsqlBindScalar.js Update tests 2017-11-17 22:59:41 +11:00
pool.js Ensure that statements and LOBs are closed before the connection is closed, to match ODPI-C hardening 2017-08-01 14:14:43 +10:00
poolCache.js Test updates 2017-06-17 09:40:09 +10:00
poolClose.js Test updates 2017-06-17 09:40:09 +10:00
poolPing.js Improve validation for invalid attribute and parameter values 2017-11-17 22:49:53 +11:00
prefetchRows.js Add tests for oracledb.fetchArraySize 2017-12-12 10:08:25 +11:00
promises.js Sync tests and fix missed merges 2017-06-14 11:54:15 +10:00
properties.js Introduce fetchArraySize to replace prefetchRows for query fetch tuning 2017-12-12 09:56:12 +11:00
random.js Sync tests and fix missed merges 2017-06-14 11:54:45 +10:00
resultSet1.js Introduce fetchArraySize to replace prefetchRows for query fetch tuning 2017-12-12 09:56:12 +11:00
resultSet2.js Ensure that statements and LOBs are closed before the connection is closed, to match ODPI-C hardening 2017-08-01 14:14:43 +10:00
resultSetClose.js Test updates 2017-06-17 09:40:09 +10:00
resultsetToStream.js Speed up Stream tests 2017-06-29 16:24:38 +10:00
rowidDMLBindAsString.js Test updates 2017-06-17 09:40:09 +10:00
rowidFunctionBindAsString_bind.js Test updates 2017-06-14 11:16:43 +10:00
rowidFunctionBindAsString_bindinout.js Test updates 2017-06-14 11:16:43 +10:00
rowidProcedureBindAsString_bindin.js Test updates 2017-06-14 11:16:43 +10:00
rowidProcedureBindAsString_bindinout.js Test updates 2017-06-17 09:40:09 +10:00
rowidProcedureBindAsString_bindout.js Test updates 2017-06-17 09:40:09 +10:00
sql.js Test updates 2017-06-14 10:53:11 +10:00
sqlWithWarnings.js Sync tests and fix missed merges 2017-06-14 11:54:15 +10:00
stream1.js Introduce fetchArraySize to replace prefetchRows for query fetch tuning 2017-12-12 09:56:12 +11:00
stream2.js Ensure that statements and LOBs are closed before the connection is closed, to match ODPI-C hardening 2017-08-01 14:14:43 +10:00
streamErrorEvent.js Test updates 2017-10-23 13:35:57 +11:00
tree.jpg Sync tests and fix missed merges 2017-06-14 11:54:45 +10:00
uninitializedLob.js Sync tests and fix missed merges 2017-06-14 11:54:15 +10:00
urowidDMLBindAsString1.js Update tests 2017-11-17 22:59:41 +11:00
urowidDMLBindAsString2.js Update tests 2017-11-17 22:59:41 +11:00
urowidFunctionBindAsString1.js Update tests 2017-11-17 22:59:41 +11:00
urowidFunctionBindAsString2.js Update tests 2017-11-17 22:59:41 +11:00
urowidFunctionBindAsString3.js Add tests for maxSize for Bind OUT/INOUT 2017-12-12 09:46:33 +11:00
urowidFunctionBindAsString4.js Add tests for maxSize for Bind OUT/INOUT 2017-12-12 09:46:33 +11:00
urowidProcedureBindAsString1.js Update tests 2017-11-17 22:59:41 +11:00
urowidProcedureBindAsString2.js Update tests 2017-11-17 22:59:41 +11:00
urowidProcedureBindAsString3.js Add tests for big UROWID procedure bind 2017-12-12 09:47:40 +11:00
urowidProcedureBindAsString4.js Add tests for big UROWID procedure bind 2017-12-12 09:47:40 +11:00
urowidProcedureBindAsString5.js Add tests for big UROWID procedure bind 2017-12-12 09:47:40 +11:00
urowidProcedureBindAsString6.js Add tests for big UROWID procedure bind 2017-12-12 09:47:40 +11:00
v8Getter.js Test updates 2017-10-23 13:35:57 +11:00
writableProperties.js Test updates 2017-06-17 09:40:09 +10:00

README.md

Test node-oracledb

Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.

You may not use the identified files except in compliance with the Apache License, Version 2.0 (the "License.")

You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and limitations under the License.

The node-oracledb test suite uses 'mocha', 'should' and 'async'. See LICENSE for relevant licenses.

1. Preparations for running tests

See INSTALL for installation requirements and more details.

Note: the test suite is in GitHub. From node-oracledb 1.9.1 it is not included when installing from npmjs.com with npm install oracledb.

1.1 Create a working directory

mkdir <some-directory>
cd <some-directory>

1.2 Get node-oracledb from GitHub

Clone the project repository:

cd <some-directory>
git clone https://github.com/oracle/node-oracledb.git

1.3 Build

cd <some-directory>/node-oracledb
npm install

Running npm install within the node-oracledb/ directory will recompile oracledb and install all its dependent modules. These are listed in the devDependencies field of package.json file. Thus, 'mocha', 'async' and 'should' modules are installed by this command.

The test suite uses mocha, async and should.

1.4 Configure Database credentials

The database credentials for node-oracledb test suite are defined in dbconfig.js. They can also be set via environment variables shown in that file.

vi <some-directory>/node-oracledb/test/dbconfig.js
module.exports = {
  user          : process.env.NODE_ORACLEDB_USER || "hr",
  password      : process.env.NODE_ORACLEDB_PASSWORD || "welcome",
  connectString : process.env.NODE_ORACLEDB_CONNECTIONSTRING || "localhost/orcl"
};

To enable external authentication tests, please make sure Oracle Database and the authentication service have been appropriately configured. See Documentation for External Authentication for more details. And then, set the environment variable NODE_ORACLEDB_EXTERNALAUTH to be true.

Note: the test suite requires a schema with these privileges:

  • CREATE TABLE
  • CREATE SESSION
  • CREATE PROCEDURE
  • CREATE SEQUENCE
  • CREATE TRIGGER

1.5 Set NODE_PATH

export NODE_PATH=<some-directory>/node-oracledb/lib

2. Run tests

2.1 Run the complete test suite

2.1.1 On Unix-like systems

cd <some-directory>/node-oracledb
npm test

This calls the test script defined in oracledb/package.json.

2.1.2 On Windows

cd <some-directory>/node_oracledb
npm run testwindows

This calls the testwindows script defined in oracledb/package.json.

See npm scripts for more information about how npm handles the "scripts" field of package.json.

2.2 Run specified test(s)

cd <some-directory>/node_oracledb
<mocha-executable-file-directory>/mocha test/<test-names>

See mochajs.org for more information on running tests with mocha.

3. Add Tests

See CONTRIBUTING for general information on contribution requirements.

For easy correlation between results and test code, each test is assigned a number. The following number ranges have been chosen:

  • 1 - 20 are reserved for basic functional tests
  • 21 - 50 are reserved for data type supporting tests
  • 51 onwards are for other tests

In order to include your tests in the suite, add each new test file name to test/opts/mocha.opts.

Please also add a description of each individual test to the Test List.

4. Test List

See test/list.txt for the list of existing tests.

5. Tests Compatibility

  • We conduct base testing with Instant Client 11.2.0.4 and 12.1.0.2 on Linux X64 and Windows 7.

  • Users of 11.2.0.1 and 11.2.0.2 clients may see failures with poolTimeout.js and dataTypeDouble.js.

  • Slow networks may cause some tests to timeout.

6. Troubleshooting

You may encounter some troubles when running the test suite. These troubles might be caused by the concurrency issue of Mocha framework, network latencies, or database server issues. This section gives some issues that we ever saw and our solutions.

6.1 ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired

This error occurs when Node.js programs try to change database objects which hold locks. The workaround would be:

(1) Use unique DB object names for each test to avoid interference between test files. (2) Try not to use 'beforeEach' blocks for object operations to avoid the interference between cases.

6.2 ORA-00018: maximum number of sessions exceeded

This error occurs when the test suite takes up more sessions than the configured limit. You can alter the session limit on the database server side. If you do not have access to change the database session setting, you could use the below script to deliberately add an interval between tests.

arr=$(ls test/*js)
for case in ${arr[@]}
do
  var="$NODE_PATH/../node_modules/.bin/mocha --timeout 10000 $case"
  eval $var
  sleep 1
done

6.3 ORA-28865: SSL connection closed

You may encounter this error when the test suite sends more connection requests per second than the database is configured to handle.

There are two solutions:

  • Solution 1: Change database RATE_LIMIT configuration. This parameter defines the connection count allowed per second. See RATE_LIMIT for more information.

  • Solution 2: Set the RETRY_COUNT and RETRY_DELAY parameters in connectString.

For example, below is the connectString which could be defined in tnsnames.ora file.

dbaccess = (description=(RETRY_COUNT=20)(RETRY_DELAY=3)
          (address=(protocol=tcps)(port=1521)(host=<db-host>))
          (connect_data=(service_name=<service-name>))
          (security=(my_wallet_directory=<wallet-location>)(ssl_server_cert_dn=<ssl-server-cert-dn>))
       )