public CliSessionState startSessionState(boolean canReuseSession) throws IOException {

    HiveConf.setVar(conf,
        HiveConf.ConfVars.HIVE_AUTHENTICATOR_MANAGER,
        "org.apache.hadoop.hive.ql.security.DummyAuthenticator");

    //FIXME: check why mr is needed for starting a session state from conf
    String execEngine = conf.get("hive.execution.engine");
    conf.set("hive.execution.engine", "mr");

    CliSessionState ss = new CliSessionState(conf);
    ss.in = System.in;
    ss.out = new SessionStream(System.out);
    ss.err = new SessionStream(System.out);

    SessionState oldSs = SessionState.get();

    miniClusters.restartSessions(canReuseSession, ss, oldSs);

    closeSession(oldSs);
    SessionState.start(ss);

    isSessionStateStarted = true;

    conf.set("hive.execution.engine", execEngine);
    return ss;
  }
Clear out any side effects of running tests
itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java