Fixed nightly build environment variable check in the query processing test. Added script for separate second run in the test.