Skip to content

Commit 9b772bd

Browse files
committed
Test refactoring and code cleanup
1 parent c9bdeea commit 9b772bd

File tree

10 files changed

+40
-23
lines changed

10 files changed

+40
-23
lines changed

test/changePassword.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,4 +383,41 @@ describe('161. changePassword.js', function() {
383383
await dbaConn.close();
384384
}); // 161.10
385385

386+
it('161.11 connects with password that is expiring soon', async function() {
387+
const tUser = dbConfig.user + "_st_expiring";
388+
const shortProfile = `NJS_ShortPwd_st_expiring`;
389+
390+
const dbaConn = await oracledb.getConnection(DBA_config);
391+
try {
392+
await dbaConn.execute(`drop user ${tUser} cascade`);
393+
await dbaConn.execute(`drop profile ${shortProfile} cascade`);
394+
} catch (err) {
395+
if (!(/ORA-01918:|ORA-02380:/.test(err.message)))
396+
throw err;
397+
}
398+
399+
await dbaConn.execute(`create user ${tUser} identified by ${tUser}`);
400+
await dbaConn.execute(`grant create session to ${tUser}`);
401+
402+
const credential = {
403+
user: tUser,
404+
password: tUser,
405+
connectionString: dbConfig.connectString
406+
};
407+
408+
const sql = `create profile ${shortProfile} LIMIT password_life_time 1/86400 PASSWORD_GRACE_TIME 1`;
409+
await dbaConn.execute(sql);
410+
await dbaConn.execute(`alter user ${tUser} PROFILE ${shortProfile}`);
411+
const SLEEP_TIME = 2; // sleep to let the profile get updated.
412+
await new Promise(r => setTimeout(r, SLEEP_TIME));
413+
414+
const tConn = await oracledb.getConnection(credential);
415+
await tConn.execute(`SELECT UNIQUE CLIENT_DRIVER FROM V$SESSION_CONNECT_INFO WHERE SID = SYS_CONTEXT('USERENV', 'SID')`);
416+
417+
await tConn.close();
418+
await dbaConn.execute(`drop user ${tUser} cascade`);
419+
await dbaConn.execute(`drop profile ${shortProfile} cascade`);
420+
await dbaConn.close();
421+
}); // 161.11
422+
386423
});

test/connProps.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ describe('193. connProps.js', function() {
4949

5050
if (!isRunnable) {
5151
this.skip();
52-
return;
5352
} else {
5453
const dbaConfig = {
5554
user : dbConfig.test.DBA_user,

test/dbObject12.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2019, 2022, Oracle and/or its affiliates. */
1+
/* Copyright (c) 2019, 2023, Oracle and/or its affiliates. */
22

33
/******************************************************************************
44
*
@@ -48,7 +48,6 @@ describe('211. dbObject12.js', function() {
4848
isRunnable = await testsUtil.checkPrerequisites();
4949
if (!isRunnable) {
5050
this.skip();
51-
return;
5251
} else {
5352
conn = await oracledb.getConnection(dbConfig);
5453

test/dbObject13.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2019, 2022, Oracle and/or its affiliates. */
1+
/* Copyright (c) 2019, 2023, Oracle and/or its affiliates. */
22

33
/******************************************************************************
44
*
@@ -47,7 +47,6 @@ describe('212. dbObject13.js', function() {
4747
isRunnable = await testsUtil.checkPrerequisites();
4848
if (!isRunnable) {
4949
this.skip();
50-
return;
5150
} else {
5251
conn = await oracledb.getConnection(dbConfig);
5352

test/executeQueue.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2021, 2022, Oracle and/or its affiliates. */
1+
/* Copyright (c) 2021, 2023, Oracle and/or its affiliates. */
22

33
/******************************************************************************
44
*
@@ -111,7 +111,6 @@ describe("256. executeQueue.js", function() {
111111
// Skip for older versions since this test might hang unless DISABLE_OOB=ON is in sqlnet.ora
112112
if (connection.oracleServerVersion <= 1900000000 || testsUtil.getClientVersion() <= 1900000000) {
113113
this.skip();
114-
return;
115114
}
116115

117116
oracledb.errorOnConcurrentExecute = true;

test/poolReconfigure.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,6 @@ describe('255. poolReconfigure.js', function() {
864864
// maxPerShard is supported only >= 18.3
865865
if (testsUtil.getClientVersion() < 1803000000) {
866866
this.skip();
867-
return;
868867
}
869868

870869
let maxPerShard = 10;
@@ -887,7 +886,6 @@ describe('255. poolReconfigure.js', function() {
887886
if (clientVersion < 2103000000) {
888887
if (clientVersion < 1911000000 || clientVersion >= 2000000000) {
889888
this.skip();
890-
return;
891889
}
892890
}
893891
await pool.reconfigure(config);
@@ -904,7 +902,6 @@ describe('255. poolReconfigure.js', function() {
904902
if (clientVersion < 2103000000) {
905903
if (clientVersion < 1911000000 || clientVersion >= 2000000000) {
906904
this.skip();
907-
return;
908905
}
909906
}
910907
await pool.reconfigure(config);
@@ -1347,7 +1344,6 @@ describe('255. poolReconfigure.js', function() {
13471344
if (clientVersion < 2103000000) {
13481345
if (clientVersion < 1911000000 || clientVersion >= 2000000000) {
13491346
this.skip();
1350-
return;
13511347
}
13521348
}
13531349
await pool.reconfigure(config);

test/soda6.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ describe('174. soda6.js', function() {
4545
const runnable = await testsUtil.isSodaRunnable();
4646
if (!runnable) {
4747
this.skip();
48-
return;
4948
}
5049

5150
await sodaUtil.cleanup();
@@ -366,7 +365,6 @@ describe('174. soda6.js', function() {
366365
if (clientVersion < 2103000000) {
367366
if (clientVersion < 1911000000 || clientVersion >= 2000000000) {
368367
this.skip();
369-
return;
370368
}
371369
}
372370

@@ -399,7 +397,6 @@ describe('174. soda6.js', function() {
399397
if (clientVersion < 2103000000) {
400398
if (clientVersion < 1911000000 || clientVersion >= 2000000000) {
401399
this.skip();
402-
return;
403400
}
404401
}
405402

@@ -433,7 +430,6 @@ describe('174. soda6.js', function() {
433430
if (clientVersion < 2103000000) {
434431
if (clientVersion < 1911000000 || clientVersion >= 2000000000) {
435432
this.skip();
436-
return;
437433
}
438434
}
439435

test/soda7.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ describe('175. soda7.js', () => {
4545
const runnable = await testsUtil.isSodaRunnable();
4646
if (!runnable) {
4747
this.skip();
48-
return;
4948
}
5049

5150
await sodaUtil.cleanup();

test/sodaOverwrite.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ describe('189. sodaOverwrite.js', function() {
5555
const isRunnable = isClientOK && isSodaRunnable;
5656
if (!isRunnable) {
5757
this.skip();
58-
return;
5958
}
6059

6160
await sodaUtil.cleanup();

test/userName.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ describe('248. userName.js', function() {
9090
let runnable = await testsUtil.isLongUserNameRunnable();
9191
if (!runnable) {
9292
this.skip();
93-
return;
9493
}
9594

9695
const userSchema = assist.createSchemaString(100);
@@ -115,7 +114,6 @@ describe('248. userName.js', function() {
115114
let runnable = await testsUtil.isLongUserNameRunnable();
116115
if (!runnable) {
117116
this.skip();
118-
return;
119117
}
120118

121119
const userSchema = assist.createSchemaString(128);
@@ -140,7 +138,6 @@ describe('248. userName.js', function() {
140138
let runnable = await testsUtil.isLongUserNameRunnable();
141139
if (!runnable) {
142140
this.skip();
143-
return;
144141
}
145142

146143
const dbaConn = await oracledb.getConnection(dbaCredential);
@@ -270,7 +267,6 @@ describe('248. userName.js', function() {
270267
let runnable = await testsUtil.isLongUserNameRunnable();
271268
if (!runnable) {
272269
this.skip();
273-
return;
274270
}
275271

276272
const userSchema = assist.createSchemaString(100);
@@ -294,7 +290,6 @@ describe('248. userName.js', function() {
294290
let runnable = await testsUtil.isLongUserNameRunnable();
295291
if (!runnable) {
296292
this.skip();
297-
return;
298293
}
299294

300295
const userSchema = assist.createSchemaString(128);
@@ -319,7 +314,6 @@ describe('248. userName.js', function() {
319314
let runnable = await testsUtil.isLongUserNameRunnable();
320315
if (!runnable) {
321316
this.skip();
322-
return;
323317
}
324318

325319
const userSchema = assist.createSchemaString(1000);

0 commit comments

Comments
 (0)