diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-07-22 23:09:36 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-07-22 23:09:36 +0100 |
commit | 8e1977685713c68ff483fe02e010deaa685b453a (patch) | |
tree | 2727c320a9ea1b28502633a7009a3180199ab691 /test | |
parent | Create test table before setting up repl (diff) | |
download | mygrate-8e1977685713c68ff483fe02e010deaa685b453a.tar.bz2 mygrate-8e1977685713c68ff483fe02e010deaa685b453a.tar.xz mygrate-8e1977685713c68ff483fe02e010deaa685b453a.zip |
First cut replicating row updates
Diffstat (limited to 'test')
-rw-r--r-- | test/test-e2e.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/test-e2e.cpp b/test/test-e2e.cpp index 9394e13..60dca86 100644 --- a/test/test-e2e.cpp +++ b/test/test-e2e.cpp @@ -4,10 +4,12 @@ #include "testdb-mysql.h" #include "testdb-postgresql.h" +#include <input/replStream.h> #include <output/pq/updateDatabase.h> #include <sql/createTestTable.h> #include <sql/fillTestTable.h> #include <sql/selectTestTable.h> +#include <thread> BOOST_AUTO_TEST_CASE(e2e) { @@ -32,4 +34,14 @@ BOOST_AUTO_TEST_CASE(e2e) out.copyTableContent(&mym, "session"); BOOST_CHECK_EQUAL(MyGrate::sql::selectTestTable::execute(&pqm)->rows(), 1); + + std::thread repl {&MyGrate::EventSourceBase::readEvents, src.get(), std::ref(out)}; + + auto upd = mym.prepare("UPDATE session SET session_id = ? WHERE id = ?", 2); + upd->execute(std::array<MyGrate::DbValue, 2> {"food", 1}); + + sleep(1); + + src->stopEvents(); + repl.join(); } |