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.
This commit is contained in:
WGH 2019-01-25 21:08:34 +03:00 committed by Felipe Zimmerle
parent 37cf60b8d2
commit bd6a02d69b
No known key found for this signature in database
GPG Key ID: E6DFB08CE8B11277

View File

@ -15,6 +15,8 @@
#include <string.h>
#include <unistd.h>
#include <ctime>
#include <iostream>
#include <string>
@ -136,6 +138,12 @@ void perform_unit_test(ModSecurityTest<RegressionTest> *test,
continue;
}
#ifdef WITH_LMDB
// some tests (e.g. issue-1831.json) don't like it when data persists between runs
unlink("./modsec-shared-collections");
unlink("./modsec-shared-collections-lock");
#endif
modsec = new modsecurity::ModSecurity();
modsec->setConnectorInformation("ModSecurity-regression v0.0.1-alpha" \
" (ModSecurity regression test utility)");