Skip to content
Permalink
Browse files

Try to fix flaky session_handler_scenario_test.

For unknown reasons, session_handler_scenario_test in on Travis CI is
really flaky.  This is a speculative fix for that flakiness.

Although the reason why session_handler_scenario_test is flaky only on
Travis CI is still unknown, there are actually two questionable points:
 1. CharacterFormMamanger is not reloaded among scenario tests.
 2. SessionHandlerTestBase::TearDown is not called.

This CL addresses above two points.

BUG=#317
TEST=unittest
REF_BUG=19188911
REF_CL=107067222
  • Loading branch information...
yukawa committed Nov 14, 2015
1 parent 175cb79 commit d9d63a11f1fd46913049e93b0acfb7fbd241114c
Showing with 16 additions and 1 deletion.
  1. +10 −1 src/session/session_handler_scenario_test.cc
  2. +6 −0 src/session/session_handler_test_util.cc
@@ -82,7 +82,7 @@ using testing::WithParamInterface;
class SessionHandlerScenarioTest : public SessionHandlerTestBase,
public WithParamInterface<const char *> {
protected:
virtual void SetUp() {
void SetUp() final {
// Note that singleton Config instance is backed up and restored
// by SessionHandlerTestBase's SetUp and TearDown methods.
SessionHandlerTestBase::SetUp();
@@ -96,6 +96,15 @@ class SessionHandlerScenarioTest : public SessionHandlerTestBase,
ConfigHandler::GetConfig(config_.get());
}

void TearDown() final {
request_.reset();
last_output_.reset();
config_.reset();
client_.reset();
engine_.reset();
SessionHandlerTestBase::TearDown();
}

void ClearAll() {
ResetContext();
ClearUserPrediction();
@@ -32,6 +32,7 @@
#include "base/config_file_stream.h"
#include "base/file_util.h"
#include "base/system_util.h"
#include "config/character_form_manager.h"
#include "config/config_handler.h"
#include "converter/converter_interface.h"
#include "engine/engine_interface.h"
@@ -57,6 +58,7 @@ namespace session {
namespace testing {

using commands::Command;
using config::CharacterFormManager;
using config::ConfigHandler;

bool CreateSession(SessionHandlerInterface *handler, uint64 *id) {
@@ -139,6 +141,10 @@ void SessionHandlerTestBase::ClearState() {
ConfigHandler::GetDefaultConfig(&config);
ConfigHandler::SetConfig(config);

// CharacterFormManager is not automatically updated when the config is
// updated.
CharacterFormManager::GetCharacterFormManager()->ReloadConfig(config);

// Some destructors may save the state on storages. To clear the state, we
// explicitly call destructors before clearing storages.
storage::Registry::Clear();

0 comments on commit d9d63a1

Please sign in to comment.
You can’t perform that action at this time.