I have tested this patch and the test now passes but I wasn't able to test the teardown part of the test. The reason is the command to start hive server (HIVE_PORT=10000 hive --service hiveserver > /dev/null 2>&1 & echo $! ) 2> /dev/null doesn't seem to return any output when run from the test (i.e. sh.getOut() returns an empty array). While if I run the same command on bash, it returns the PID of the file as expected. This PID is then used in teardown. So, barring the testing of teardown method, this patch seems to work.
I will take a closer look at itest's shell methods to see if there is another way to retrieve the PID. In the meanwhile, if anyone has any other thoughts, please let me know.