Skip to content

Commit da4275e

Browse files
committed
LDEV-6450: Make tests independent - each sets password with try-catch instead of shared beforeAll
1 parent 5fa5495 commit da4275e

1 file changed

Lines changed: 28 additions & 13 deletions

File tree

test/tickets/LDEV-6450.cfc

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,8 @@ component extends = "org.lucee.cfml.test.LuceeTestCase" {
33
function run( testResults, testBox ){
44
describe( "Testcase for LDEV-6450 - Password cache issue (general problem with all admin actions that call store())", function(){
55

6-
var testPassword = "testpass_6450_" & randRange(10000,99999);
7-
8-
beforeAll( function() {
9-
// Set server admin password once for all tests
10-
admin
11-
action="updatePassword"
12-
type="server"
13-
oldPassword="admin"
14-
newPassword=testPassword;
15-
});
16-
176
it( "Multiple updateMapping calls should work after setPassword", function() {
7+
var testPassword = "testpass_6450_" & randRange(10000,99999);
188
var testVirtual1 = "/test_6450_mapping1_" & randRange(10000,99999);
199
var testVirtual2 = "/test_6450_mapping2_" & randRange(10000,99999);
2010
var testPhysical = getTempDirectory() & "lucee_test_6450/";
@@ -25,7 +15,19 @@ component extends = "org.lucee.cfml.test.LuceeTestCase" {
2515
}
2616

2717
try {
28-
// Step 1: Create first mapping with the password set in beforeAll
18+
// Step 0: Set server admin password (may already be set, that's ok)
19+
try {
20+
admin
21+
action="updatePassword"
22+
type="server"
23+
oldPassword="admin"
24+
newPassword=testPassword;
25+
}
26+
catch(e){
27+
// Password may already be set from previous test run, ignore
28+
}
29+
30+
// Step 1: Create first mapping with the password
2931
admin
3032
action="updateMapping"
3133
type="server"
@@ -107,6 +109,7 @@ component extends = "org.lucee.cfml.test.LuceeTestCase" {
107109
});
108110

109111
it( "Mixed admin actions (updateMapping + removeMapping) should work after setPassword - proves password cache affects all admin actions", function() {
112+
var testPassword = "testpass_6450_" & randRange(10000,99999);
110113
var testVirtual = "/test_6450_mixed_" & randRange(10000,99999);
111114
var testPhysical = getTempDirectory() & "lucee_test_6450_mixed/";
112115

@@ -115,7 +118,19 @@ component extends = "org.lucee.cfml.test.LuceeTestCase" {
115118
}
116119

117120
try {
118-
// Step 1: Create mapping with password set in beforeAll
121+
// Step 0: Set server admin password (may already be set, that's ok)
122+
try {
123+
admin
124+
action="updatePassword"
125+
type="server"
126+
oldPassword="admin"
127+
newPassword=testPassword;
128+
}
129+
catch(e){
130+
// Password may already be set from previous test run, ignore
131+
}
132+
133+
// Step 1: Create mapping with the password
119134
admin
120135
action="updateMapping"
121136
type="server"

0 commit comments

Comments
 (0)