surrealdb / surrealdb.go

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

Bug: Broken Tests for Fetch #116

Open sbshah97 opened 9 months ago

sbshah97 commented 9 months ago

Describe the bug

This bug is a follow up from the below PR. This requires us to fix testcases listed in TestFetch() This is not a bug in the SDK and a bug in the core engine which needs to be fixed.

https://github.com/surrealdb/surrealdb.go/pull/115

Steps to reproduce

  1. Comment out s.T().Skip
  2. Run testcase and ensure it passes successfully

Expected behaviour

The tests listed above are expected to pass.

SurrealDB version

surreal 1.0.0 for MacOS

Contact Details

sbs.191197@gmail.com

Is there an existing issue for this?

Code of Conduct

phughk commented 9 months ago

Thinking briefly here, this may be to do with deserialising the results from fetch. We might want to try to reproduce a JSON reponse to the deserialiser for a test.

phughk commented 9 months ago

Also, this might be related in case it is deserialisation: https://stackoverflow.com/questions/77553464/deserializing-a-graph-query/77582309#77582309

sbshah97 commented 9 months ago

We might want to try to reproduce a JSON reponse to the deserialiser for a test. This would be a test in the core engine surrealdb code itself?

phughk commented 9 months ago

This would be a test in the driver. We would have a fake network layer, and fake json responses.

fakeNetwork := FakeNetwork() // This doesnt exist, we would need to create a mock or something
driver := fakeNetwork.newDriver() // Hypothetically. We basically need a factory that allows a network layer to be injected for testing

fakeNetwork.when(any()).then(someJson)

let result = driver.query(bla)

assertResult(result)

Something like that

varshard commented 6 months ago

I guess this is a known issue, but would like to make it more obvious. I believe that https://github.com/surrealdb/surrealdb/issues/3028 block this issue as any parsing after fetch will result in an error.