node-oracledb/test/releaseAfterFailingTerminat...

64 lines
2.0 KiB
JavaScript
Raw Normal View History

/* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. */
2015-07-20 12:42:12 +08:00
/******************************************************************************
*
* 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.
2016-03-24 14:09:53 +08:00
*
* The node-oracledb test suite uses 'mocha', 'should' and 'async'.
2015-07-20 12:42:12 +08:00
* See LICENSE.md for relevant licenses.
*
* NAME
* 54. releaseAfterFailingTerminate.js
*
* DESCRIPTION
* Testing connection release after pool's failing termination.
*
* NUMBERING RULE
* Test numbers follow this numbering rule:
* 1 - 20 are reserved for basic functional tests
* 21 - 50 are reserved for data type supporting tests
2016-03-24 14:09:53 +08:00
* 51 - are for other tests
*
2015-07-20 12:42:12 +08:00
*****************************************************************************/
var oracledb = require('oracledb');
var should = require('should');
var dbConfig = require('./dbconfig.js');
2015-07-20 12:42:12 +08:00
2016-05-16 07:57:53 +08:00
describe('54. releaseAfterFailingTerminate.js', function() {
2016-03-24 14:09:53 +08:00
2015-07-20 12:42:12 +08:00
it('can still release connections after failing pool termination', function(done){
oracledb.createPool(
2016-05-16 07:57:53 +08:00
dbConfig,
2015-07-20 12:42:12 +08:00
function(err, pool) {
should.not.exist(err);
pool.getConnection( function(err, connection){
should.not.exist(err);
2016-03-24 14:09:53 +08:00
pool.terminate(
2015-07-20 12:42:12 +08:00
function(err){
should.exist(err);
2015-07-20 15:56:29 +08:00
(err.message).should.startWith('ORA-24422:');
2016-03-24 14:09:53 +08:00
2015-07-20 12:42:12 +08:00
connection.release( function(err){
should.not.exist(err);
done();
});
}
);
});
}
);
})
})