-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
The arguments to a query are not stored when creating a recording, and not verified when playing back recording (obviously because there is nothing to verify with). This means that it is possible to change the arguments to a query without failing existing tests, as long as the sequence of queries does not change.
As an example, consider this line in the simple query test:
copyist/drivertest/commontest/common.go
Line 115 in 0d1c754
rows, err := db.Query("SELECT name FROM customers WHERE id=$1", 1) |
If we change the
id
argument to 2 or 50 the result should change to a different name or no rows in the result set respectively. However running the test with playback (I used pqtest
but I think it should be the same for all) results in a pass with no warning that the tests need to recorded again. If you update the test to look for the correct name or error then the test fails and gives a message suggesting you might need to redo the recording.I know this example is a bit silly because you are changing the test without changing the expected result or redoing the recording, but the same thing could happen if you make changes in your application logic which ends up affecting the arguments to a query.
Is there a reason to not include the query arguments in the recording? I don't think serialization should be an issue because the library already handles that for the results.
Metadata
Metadata
Assignees
Labels
No labels