surrealdb / surrealdb.go

SurrealDB SDK for Golang
https://surrealdb.com
Apache License 2.0
231 stars 62 forks source link

Test websockets can be concurrent #64

Closed phughk closed 1 year ago

phughk commented 1 year ago

We want to verify the driver can make requests concurrently. We need a test that follows this pattern

conn = openConnection()
chan response = blaa // cant remember syntax
go func() {
   response << "Starting sleep"
   _, err = conn.Execute("sleep 5")
   suite.Require().NoError(err)
   response << "All good, sleep finished"
}
waitForStart << response // I should probably learn the syntax
start = time.Now()
_, err = conn.Update(doSomeUpdate())
end = time.Now()
suite.Require().NoError(err)
suite.Require().LessThan(end-start, Duration.Second(2))
completed << response // still haven't googled
completeTime = time.Now()
suite.Require().MoreThan(completed-start, Duration.Second(5))
phughk commented 1 year ago

Assigning to me, but if anyone would like to take this on the please comment or flag. I am not starting this immediately