e1a3e09c67 | ||
---|---|---|
.. | ||
opts | ||
.editorconfig | ||
README.md | ||
accessPropertiesOnClosedObjects.js | ||
aq1.js | ||
aq2.js | ||
aq3.js | ||
aq4.js | ||
aq5.js | ||
aq6.js | ||
aq7.js | ||
aq8.js | ||
aq9.js | ||
aq10.js | ||
aq11.js | ||
asyncStack.js | ||
autoCommit.js | ||
autoCommit4nestedExecutes.js | ||
autoCommitForSelect.js | ||
bigInt.js | ||
bindTimestamp.js | ||
binding.js | ||
binding_DMLInsert.js | ||
binding_DMLReturningInto.js | ||
binding_buffer_string.js | ||
binding_defaultBindIn.js | ||
binding_defaultBindInout.js | ||
binding_functionBindIn.js | ||
binding_functionBindInout.js | ||
binding_functionBindOut.js | ||
binding_procedureBindIn.js | ||
binding_procedureBindInout.js | ||
binding_procedureBindOut.js | ||
blobDMLBindAsBuffer.js | ||
blobDMLReturningMultipleRowsAsBuffer.js | ||
blobDMLReturningMultipleRowsAsStream.js | ||
blobPlsqlBindAsBuffer_bindin.js | ||
blobPlsqlBindAsBuffer_bindinout.js | ||
blobPlsqlBindAsBuffer_bindout.js | ||
blobStream.js | ||
booleanBind.js | ||
callTimeout.js | ||
changePassword.js | ||
clobDMLBindAsString.js | ||
clobDMLReturningMultipleRowsAsStream.js | ||
clobDMLReturningMultipleRowsAsString.js | ||
clobPlsqlBindAsString_bindin.js | ||
clobPlsqlBindAsString_bindinout.js | ||
clobPlsqlBindAsString_bindout.js | ||
clobPlsqlString.js | ||
clobStream.js | ||
clobexample.txt | ||
columnMetadata.js | ||
connClose.js | ||
connHealthy.js | ||
connProps.js | ||
connection.js | ||
connectionClass.js | ||
constants.js | ||
currentSchema.js | ||
dataTypeAssist.js | ||
dataTypeBinaryDouble.js | ||
dataTypeBinaryFloat.js | ||
dataTypeBlob.js | ||
dataTypeChar.js | ||
dataTypeClob.js | ||
dataTypeDate.js | ||
dataTypeFloat.js | ||
dataTypeFloat2.js | ||
dataTypeJson.js | ||
dataTypeLong.js | ||
dataTypeLongRaw.js | ||
dataTypeNchar.js | ||
dataTypeNclob.js | ||
dataTypeNumber.js | ||
dataTypeNumber2.js | ||
dataTypeNvarchar2.js | ||
dataTypeRaw.js | ||
dataTypeRowid.js | ||
dataTypeTimestamp1.js | ||
dataTypeTimestamp2.js | ||
dataTypeTimestamp3.js | ||
dataTypeTimestamp4.js | ||
dataTypeTimestamp5.js | ||
dataTypeTimestamp6.js | ||
dataTypeUrowid.js | ||
dataTypeVarchar2.js | ||
dataTypeVector1.js | ||
dataTypeVector2.js | ||
dataTypeVector3.js | ||
dataTypeVector4.js | ||
dataTypeVector5.js | ||
dataTypeXML.js | ||
dbObject1.js | ||
dbObject2.js | ||
dbObject3.js | ||
dbObject4.js | ||
dbObject5.js | ||
dbObject6.js | ||
dbObject7.js | ||
dbObject8.js | ||
dbObject9.js | ||
dbObject10.js | ||
dbObject11.js | ||
dbObject12.js | ||
dbObject13.js | ||
dbObject14.js | ||
dbObject15.js | ||
dbObject16.js | ||
dbObject17.js | ||
dbObject18.js | ||
dbObject19.js | ||
dbObject20.js | ||
dbObjectOutBind.js | ||
dbObjectsNestedTable.js | ||
dbSchema.js | ||
dbType01.js | ||
dbType02.js | ||
dbType03.js | ||
dbType04.js | ||
dbconfig.js | ||
devnull.js | ||
dmlReturning.js | ||
driverName.js | ||
dupColNames1.js | ||
dupColNames2.js | ||
editionTest.js | ||
embedded_oid.js | ||
end2endTracing.js | ||
errorOffset.js | ||
errorUrl.js | ||
examineOwnedProperties.js | ||
examples.js | ||
executeMany1.js | ||
executeMany2.js | ||
executeQueue.js | ||
externalAuth.js | ||
externalProxyAuth.js | ||
fetchArraySize1.js | ||
fetchArraySize2.js | ||
fetchArraySize3.js | ||
fetchArraySize4.js | ||
fetchArraySize5.js | ||
fetchArraySize6.js | ||
fetchArraySize7.js | ||
fetchArraySize8.js | ||
fetchArraySize9.js | ||
fetchAs.js | ||
fetchAsStringWithRefCursor.js | ||
fetchBinaryTypesAsString.js | ||
fetchBlobAsBuffer1.js | ||
fetchBlobAsBuffer2.js | ||
fetchBlobAsBuffer3.js | ||
fetchBlobAsBuffer4.js | ||
fetchClobAsString1.js | ||
fetchClobAsString2.js | ||
fetchClobAsString3.js | ||
fetchClobAsString4.js | ||
fetchLobAsStrBuf.js | ||
fetchNClobAsString.js | ||
fetchRawAsString.js | ||
fetchRowidAsString.js | ||
fetchTimestampAsString.js | ||
fetchTypeHandler.js | ||
fetchUrowidAsString.js | ||
fetchUrowidAsString_indexed.js | ||
fuzzydinosaur.jpg | ||
getDataOfLob.js | ||
getStmtInfo.js | ||
hooks.js | ||
implicitResults.js | ||
indexedTables01.js | ||
insertAll.js | ||
insertNaNToNumber.js | ||
instanceof1.js | ||
invalidNumber.js | ||
jsObjectGetter1.js | ||
jsObjectGetter2.js | ||
jsonBind1.js | ||
jsonBind2.js | ||
jsonDualityViews1.js | ||
jsonDualityViews2.js | ||
jsonDualityViews3.js | ||
jsonDualityViews4.js | ||
jsonDualityViews5.js | ||
jsonDualityViews6.js | ||
jsonDualityViews7.js | ||
keepInStmtCache.js | ||
lastRowid.js | ||
list.txt | ||
listIndexes.js | ||
lobBind1.js | ||
lobBind2.js | ||
lobBindAsStringBuffer.js | ||
lobClose.js | ||
lobProperties1.js | ||
lobProperties2.js | ||
lobResultSet.js | ||
longDMLBind.js | ||
longProcedureBind_in.js | ||
longProcedureBind_inout.js | ||
longProcedureBind_out.js | ||
longrawDMLBind.js | ||
longrawProcedureBind_in.js | ||
longrawProcedureBind_inout.js | ||
longrawProcedureBind_out.js | ||
maxRows.js | ||
methodName.js | ||
multipleLobInsertion.js | ||
nclobDMLBindAsString.js | ||
nestedCursor01.js | ||
nestedCursor02.js | ||
nestedCursor03.js | ||
nestedCursor04.js | ||
nestedCursor05.js | ||
nullColumnValues.js | ||
optimisticLock.js | ||
passwordExpiryWarning.js | ||
pipelinedTables.js | ||
plsqlBindCursorsIN.js | ||
plsqlBindIndexedTable1.js | ||
plsqlBindIndexedTable2.js | ||
plsqlBindList.js | ||
plsqlBindScalar.js | ||
plsqlRowtype.js | ||
plsqlWarnings.js | ||
pool.js | ||
poolCache.js | ||
poolClose.js | ||
poolDrain.js | ||
poolExpansion.js | ||
poolPing.js | ||
poolReconfigure.js | ||
poolShrinkage.js | ||
poolTimeout.js | ||
prefetchRows.js | ||
procAndFuncs.js | ||
properties.js | ||
random.js | ||
resultSet1.js | ||
resultSet2.js | ||
resultSetClose.js | ||
resultsetToStream.js | ||
rowidDMLBindAsString.js | ||
rowidFunctionBindAsString_bind.js | ||
rowidFunctionBindAsString_bindinout.js | ||
rowidProcedureBindAsString_bindin.js | ||
rowidProcedureBindAsString_bindinout.js | ||
rowidProcedureBindAsString_bindout.js | ||
rsGetAllRows1.js | ||
rsGetAllRows2.js | ||
runCQN.js | ||
sessionTag.js | ||
soda1.js | ||
soda2.js | ||
soda3.js | ||
soda4.js | ||
soda5.js | ||
soda6.js | ||
soda7.js | ||
soda8.js | ||
soda9.js | ||
soda10.js | ||
soda11.js | ||
soda12.js | ||
soda13.js | ||
soda14.js | ||
sodaInstanceof.js | ||
sodaMetaDataCache.js | ||
sodaOpLock.js | ||
sodaOverwrite.js | ||
sodaUtil.js | ||
sodahint.js | ||
sql.js | ||
sqlParser.js | ||
sqlWithWarnings.js | ||
stream1.js | ||
stream2.js | ||
streamErrorEvent.js | ||
testsUtil.js | ||
tpc.js | ||
tpcResume.js | ||
tree.jpg | ||
uninitializedLob.js | ||
urowidDMLBindAsString1.js | ||
urowidDMLBindAsString2.js | ||
urowidFunctionBindAsString1.js | ||
urowidFunctionBindAsString2.js | ||
urowidFunctionBindAsString3.js | ||
urowidFunctionBindAsString4.js | ||
urowidProcedureBindAsString1.js | ||
urowidProcedureBindAsString2.js | ||
urowidProcedureBindAsString3.js | ||
urowidProcedureBindAsString4.js | ||
urowidProcedureBindAsString5.js | ||
urowidProcedureBindAsString6.js | ||
userName.js | ||
writableProperties1.js |
README.md
Test node-oracledb
This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License 2.0 as shown at https://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
If you elect to accept the software under the Apache License, Version 2.0, the following applies:
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://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.
Contents
- Preparations
- Run tests
- Enable tests that require extra configuration
- Contribute New Tests
- Troubleshoot
1. Preparations
See INSTALL for installation details.
On macOS, run a command like:
ln -s $HOME/Downloads/instantclient_19_8/libclntsh.dylib $(npm root)/oracledb/build/Release
Note: the test suite is on GitHub.
1.1 Create a working directory
mkdir <some-directory>
cd <some-directory>
1.2 Clone 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', and 'eslint'
modules are installed by this command.
The test suite uses mocha.
1.4 Configure Database credentials
Set the following environment variables to provide credentials for the test suite.
-
NODE_ORACLEDB_USER
provides the username of the schema user which you used for testing. Use the parameter createUser specified intest/dbconfig.js
to create a new user within the test suite. Test suite does create such users. -
NODE_ORACLEDB_PASSWORD
provides the password of the schema user which you used for testing. if you're generating a password for the user, use the predefined function testsUtil.generateRandomPassword. -
NODE_ORACLEDB_CONNECTIONSTRING
provides the connection string that points to your database's location. -
NODE_ORACLEDB_EXTERNALAUTH
provides the options for external authentication tests. Setting this environment variable to "true" will enable the tests that require external authentication. To ensure external authentication tests works, firstly make sure the Oracle external authentication service is correctly configured. See Documentation for External Authentication for details. -
NODE_ORACLEDB_DBA_PRIVILEGE
provides the options for DBA privilege. Setting this environment variable to "true" will enable the tests and utilities that require DBA privilege. -
NODE_ORACLEDB_DBA_USER
provides the username of the DBA user which you used for testing, disabled ifNODE_ORACLEDB_DBA_PRIVILEGE
is nottrue
. -
NODE_ORACLEDB_DBA_PASSWORD
provides the password of the DBA user which you used for testing, disabled ifNODE_ORACLEDB_DBA_PRIVILEGE
is nottrue
. -
NODE_ORACLEDB_PROXY_SESSION_USER
provides the username of a schema user that can connect through the schema user which you used for testing using proxy authentication. Setting this environment variable will enable the tests that require proxy authentication. -
NODE_ORACLEDB_QA
. This boolean environment variable serves as the toggle switch of certain tests. Some tests, such ascallTimeout.js
, use hard-coded variables as assertion condition. The test results may be inconsistent in different network situations. -
NODE_ORACLEDB_DRCP
provides an option for skipping the test run when DRCP is enabled. Setting this environment variable totrue
will skip certain test case runs due to DRCP restrictions. -
NODE_ORACLEDB_IMPLICIT_POOL
provides an option for skipping the test run when Implicit connection pooling is enabled. Setting this environment variable totrue
will skip certain test case runs due to Implicit connection pooling restrictions. -
NODE_ORACLEDB_DRIVER_MODE
provides an option to set the 'Thin' or 'Thick' modes of node-oracledb. Setting this environment variable tothick
will enable Thick mode. Setting it tothin
will retain the Thin mode. The default mode is Thin. -
NODE_ORACLEDB_WALLET_LOCATION
provides the local directory name for the wallets that may be required for mutual TLS (mTLS) connections, especially to Oracle Cloud Autonomous Databases optionally. The wallet location can also be provided as a part of the database connect string. -
NODE_ORACLEDB_WALLET_PASSWORD
provides the password for the wallets that may be required for mutual TLS (mTLS) connections, especially to Oracle Cloud Autonomous Databases. -
NODE_ORACLEDB_CLIENT_LIB_DIR
provides an optional path for the Oracle Client libraries to be used in Windows and macOS platforms, when using Thick mode in node-oracledb.
Note: the test suite requires the schema to have these privileges: CREATE TABLE, CREATE SESSION, CREATE PROCEDURE, CREATE SEQUENCE, CREATE TRIGGER, and CREATE TYPE.
1.5 Set NODE_PATH
export NODE_PATH=<some-directory>/node-oracledb/lib
2. Run tests
See mochajs.org for more information on running tests with mocha.
2.1 Run the complete test suite
cd node-oracledb
npm test
2.2 Run specified tests
cd node_oracledb
./node_modules/.bin/mocha test/<test-names>
3. Enable tests that requires extra configuration
The following test(s) are automatically skipped if their required environment variable(s) are not properly set.
3.1 externalProxyAuth.js
This test aims to test the combined usage of external authentication and proxy authentication. To run this test, you need to complete the following prerequisite setups.
-
Enable external authentication on the schema user which you used for testing. See Documentation for External Authentication for more information on external authentication. Then use the following command to enable external authentication in the test suite.
export NODE_ORACLEDB_EXTERNALAUTH true
-
Enable proxy authentication on another schema user specified by environment variable
NODE_ORACLEDB_PROXY_SESSION_USER
that connects through the schema user which you used for testing. See Documentation for Pool Proxy Authentication for more information on proxy authentication. Then use the following command to enable proxy authentication in the test suite.export NODE_ORACLEDB_PROXY_SESSION_USER "Your_Proxy_Authenticating_User"
3.2 SODA tests
To execute SODA tests, Oracle Database users require the SODA_APP role granted to them by a DBA. If SODA_APP is not granted, SODA tests will be skipped.
To grant the SODA_APP role to a Oracle Database user, typically a DBA would execute:
```
grant SODA_APP to <Oracle Database user>
```
4. Contribute New Tests
See CONTRIBUTING for general information on contribution requirements.
For easy correlation between results and test code, each test is assigned a number. The Test List shows the numbering of tests.
In order to include your tests in the suite, add each new test file
name to test/opts/mocha.opts
.
5. Troubleshoot
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.
5.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.
5.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
5.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
andRETRY_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>))
)
5.4 ORA-03114: not connected to ORACLE
We first encountered this error with test/callTimeout.js
. It uses some
hard-coded variables as assertion conditions, which may lead to assertion fails
in slow networks.
The solution is to comment out the line sqlnet.recv_timeout=<minutes>
from
the sqlnet.ora
file.