Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get compiling in 8.8.4 #1

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
get tests running
michaelglass committed Mar 16, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 3229722e6c025fc66b5458ec345c703d7ebf6412
14 changes: 6 additions & 8 deletions test/BinLog.hs
Original file line number Diff line number Diff line change
@@ -3,8 +3,6 @@

module BinLog where

import Control.Exception
import Control.Monad
import Data.Text.Encoding (encodeUtf8)
import Data.Time.Clock.POSIX
import Data.Time.Format
@@ -17,21 +15,21 @@ import Test.Tasty.HUnit
eventProducer :: IO ()
eventProducer = do
c <- connect defaultConnectInfo {ciUser = "testMySQLHaskell", ciDatabase = "testMySQLHaskell"}
execute_ c q1
execute_ c q2
_ <- execute_ c q1
_ <- execute_ c q2
return ()

tests :: MySQLConn -> Assertion
tests c = do
Just blt <- getLastBinLogTracker c
x@(fd, _, _) <- dumpBinLog c 1002 blt False
x <- dumpBinLog c 1002 blt False
rowEventStream <- decodeRowBinLogEvent x

let Just t = parseTimeM True defaultTimeLocale "%F %T" "2016-08-08 17:25:59" :: Maybe LocalTime
z <- getCurrentTimeZone
let timestamp = round $ utcTimeToPOSIXSeconds (localTimeToUTC z t)

Just (RowUpdateEvent _ _ tme ue) <- Stream.read rowEventStream
Just (RowUpdateEvent _ _ _tme ue) <- Stream.read rowEventStream
assertEqual "decode update event cloumn" (updateColumnCnt ue) 30
assertEqual
"decode update event rows"
@@ -101,10 +99,10 @@ tests c = do
)
]

Just (RowUpdateEvent _ _ tme ue) <- Stream.read rowEventStream
Just (RowUpdateEvent _ _ _tme ue') <- Stream.read rowEventStream
assertEqual
"decode update event rows"
(updateRowData ue)
(updateRowData ue')
[ ( [ BinLogLong 0,
BinLogBit 224, -- 0b11100000
BinLogTiny (-128),
20 changes: 9 additions & 11 deletions test/BinLogNew.hs
Original file line number Diff line number Diff line change
@@ -3,8 +3,6 @@

module BinLogNew where

import Control.Exception
import Control.Monad
import Data.Time.Clock.POSIX
import Data.Time.Format
import Data.Time.LocalTime
@@ -16,22 +14,22 @@ import Test.Tasty.HUnit
eventProducer :: IO ()
eventProducer = do
c <- connect defaultConnectInfo {ciUser = "testMySQLHaskell", ciDatabase = "testMySQLHaskell"}
execute_ c q1
execute_ c q2
execute_ c q3
_ <- execute_ c q1
_ <- execute_ c q2
_ <- execute_ c q3
return ()

tests :: MySQLConn -> Assertion
tests c = do
Just blt <- getLastBinLogTracker c
x@(fd, _, _) <- dumpBinLog c 1002 blt False
x <- dumpBinLog c 1002 blt False
rowEventStream <- decodeRowBinLogEvent x

let Just t = parseTimeM True defaultTimeLocale "%F %T%Q" "2016-08-08 17:25:59.1234" :: Maybe LocalTime
z <- getCurrentTimeZone
let timestamp = round $ utcTimeToPOSIXSeconds (localTimeToUTC z t)

Just (RowUpdateEvent _ _ tme ue) <- Stream.read rowEventStream
Just (RowUpdateEvent _ _ _tme ue) <- Stream.read rowEventStream
assertEqual "decode update event cloumn" (updateColumnCnt ue) 4
assertEqual
"decode update event rows"
@@ -49,10 +47,10 @@ tests c = do
)
]

Just (RowUpdateEvent _ _ tme ue) <- Stream.read rowEventStream
Just (RowUpdateEvent _ _ _tme ue') <- Stream.read rowEventStream
assertEqual
"decode update event rows"
(updateRowData ue)
(updateRowData ue')
[ ( [ BinLogLong 0,
BinLogDateTime2 2016 8 8 17 25 59 120000,
BinLogTimeStamp2 timestamp 123400,
@@ -66,10 +64,10 @@ tests c = do
)
]

Just (RowUpdateEvent _ _ tme ue) <- Stream.read rowEventStream
Just (RowUpdateEvent _ _ _tme ue'') <- Stream.read rowEventStream
assertEqual
"decode update event rows"
(updateRowData ue)
(updateRowData ue'')
[ ( [ BinLogLong 0,
BinLogDateTime2 2016 8 8 17 25 59 100000,
BinLogTimeStamp2 timestamp 123000,
Loading