mirror of
https://github.com/XRPLF/clio.git
synced 2025-12-06 17:27:58 +00:00
feat: Migration framework (#1768)
This PR implemented the migration framework, which contains the command line interface to execute migration and helps to migrate data easily. Please read README.md for more information about this framework.
This commit is contained in:
@@ -31,6 +31,7 @@ using namespace app;
|
||||
struct CliArgsTests : testing::Test {
|
||||
testing::StrictMock<testing::MockFunction<int(CliArgs::Action::Run)>> onRunMock;
|
||||
testing::StrictMock<testing::MockFunction<int(CliArgs::Action::Exit)>> onExitMock;
|
||||
testing::StrictMock<testing::MockFunction<int(CliArgs::Action::Migrate)>> onMigrateMock;
|
||||
};
|
||||
|
||||
TEST_F(CliArgsTests, Parse_NoArgs)
|
||||
@@ -44,7 +45,9 @@ TEST_F(CliArgsTests, Parse_NoArgs)
|
||||
EXPECT_FALSE(run.useNgWebServer);
|
||||
return returnCode;
|
||||
});
|
||||
EXPECT_EQ(action.apply(onRunMock.AsStdFunction(), onExitMock.AsStdFunction()), returnCode);
|
||||
EXPECT_EQ(
|
||||
action.apply(onRunMock.AsStdFunction(), onExitMock.AsStdFunction(), onMigrateMock.AsStdFunction()), returnCode
|
||||
);
|
||||
}
|
||||
|
||||
TEST_F(CliArgsTests, Parse_NgWebServer)
|
||||
@@ -58,7 +61,10 @@ TEST_F(CliArgsTests, Parse_NgWebServer)
|
||||
EXPECT_TRUE(run.useNgWebServer);
|
||||
return returnCode;
|
||||
});
|
||||
EXPECT_EQ(action.apply(onRunMock.AsStdFunction(), onExitMock.AsStdFunction()), returnCode);
|
||||
EXPECT_EQ(
|
||||
action.apply(onRunMock.AsStdFunction(), onExitMock.AsStdFunction(), onMigrateMock.AsStdFunction()),
|
||||
returnCode
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +78,10 @@ TEST_F(CliArgsTests, Parse_VersionHelp)
|
||||
auto const action = CliArgs::parse(argv.size(), const_cast<char const**>(argv.data()));
|
||||
|
||||
EXPECT_CALL(onExitMock, Call).WillOnce([](CliArgs::Action::Exit const& exit) { return exit.exitCode; });
|
||||
EXPECT_EQ(action.apply(onRunMock.AsStdFunction(), onExitMock.AsStdFunction()), EXIT_SUCCESS);
|
||||
EXPECT_EQ(
|
||||
action.apply(onRunMock.AsStdFunction(), onExitMock.AsStdFunction(), onMigrateMock.AsStdFunction()),
|
||||
EXIT_SUCCESS
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,5 +96,7 @@ TEST_F(CliArgsTests, Parse_Config)
|
||||
EXPECT_EQ(run.configPath, configPath);
|
||||
return returnCode;
|
||||
});
|
||||
EXPECT_EQ(action.apply(onRunMock.AsStdFunction(), onExitMock.AsStdFunction()), returnCode);
|
||||
EXPECT_EQ(
|
||||
action.apply(onRunMock.AsStdFunction(), onExitMock.AsStdFunction(), onMigrateMock.AsStdFunction()), returnCode
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user