Skip to content

Commit bd6a02d

Browse files
WGH-zimmerle
authored andcommitted
Fix test issue-1831.json on LMDB
When LMDB is enabled, ModSecurity stores its persistent variables in "./modsec-shared-collections" file. Since this file wasn't cleared between tests, tests behaved differently on "in-memory per-process" and LMDB backend. This test never worked in LMDB configuration. It hasn't been discovered until now because Travis CI didn't test LMDB configuration when test was introduced.
1 parent 37cf60b commit bd6a02d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/regression/regression.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
#include <string.h>
1717

18+
#include <unistd.h>
19+
1820
#include <ctime>
1921
#include <iostream>
2022
#include <string>
@@ -136,6 +138,12 @@ void perform_unit_test(ModSecurityTest<RegressionTest> *test,
136138
continue;
137139
}
138140

141+
#ifdef WITH_LMDB
142+
// some tests (e.g. issue-1831.json) don't like it when data persists between runs
143+
unlink("./modsec-shared-collections");
144+
unlink("./modsec-shared-collections-lock");
145+
#endif
146+
139147
modsec = new modsecurity::ModSecurity();
140148
modsec->setConnectorInformation("ModSecurity-regression v0.0.1-alpha" \
141149
" (ModSecurity regression test utility)");

0 commit comments

Comments
 (0)