Issue #3423329 by catch, kristiaanvandeneynde, dww, alexpott: Prevent session garbage collection during functional tests (cherry picked from commit 4c8f1df7)