File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -222,6 +222,24 @@ func TestDbRunnerQueryTimeout(t *testing.T) {
222222 assert .Equal (t , context .DeadlineExceeded , queryError .Parent )
223223}
224224
225+ func TestDbRunnerReadonly (t * testing.T ) {
226+ t .Parallel ()
227+
228+ runner , err := sqlrunner .NewSQLRunner (`
229+ CREATE TABLE readonlytest (
230+ value TEXT
231+ );
232+
233+ INSERT INTO readonlytest (value) VALUES ('hello');
234+ INSERT INTO readonlytest (value) VALUES ('world');
235+ ` )
236+ require .NoError (t , err )
237+
238+ _ , err = runner .Query (context .TODO (), "INSERT INTO readonlytest (value) VALUES ('test')" )
239+ t .Log (err )
240+ require .ErrorAs (t , err , & sqlrunner.QueryError {})
241+ }
242+
225243func BenchmarkDbrunner (b * testing.B ) {
226244 b .ReportAllocs ()
227245
You can’t perform that action at this time.
0 commit comments