@@ -2,7 +2,6 @@ package sqltest
22
33import (
44 "context"
5- "fmt"
65 "testing"
76
87 "github.com/stretchr/testify/assert"
@@ -18,13 +17,6 @@ func Test_Patch(t *testing.T) {
1817 fixture .RunMigrationFile ("../migrations/0001.sqlcode.sql" )
1918 }
2019
21- if fixture .IsPostgresql () {
22- fixture .RunMigrationFile ("../migrations/0001.sqlcode.pgsql" )
23- _ , err := fixture .DB .Exec (
24- fmt .Sprintf (`grant create on database "%s" to "sqlcode-definer-role"` , fixture .DBName ))
25- require .NoError (t , err )
26- }
27-
2820 require .NoError (t , SQL .EnsureUploaded (ctx , fixture .DB ))
2921
3022 fixture .RunIfMssql (t , "returns 1 affected row" , func (t * testing.T ) {
@@ -36,18 +28,6 @@ func Test_Patch(t *testing.T) {
3628 require .NoError (t , err )
3729 assert .Equal (t , int64 (1 ), rowsAffected )
3830 })
39-
40- // TODO: instrument a test table to perform an update operation
41- fixture .RunIfPostgres (t , "returns 0 affected rows" , func (t * testing.T ) {
42- patched := SQL .CodePatch (fixture .DB , `call [code].Test()` )
43- res , err := fixture .DB .ExecContext (ctx , patched )
44- require .NoError (t , err )
45-
46- // postgresql perform does not result with affected rows
47- rowsAffected , err := res .RowsAffected ()
48- require .NoError (t , err )
49- assert .Equal (t , int64 (0 ), rowsAffected )
50- })
5131}
5232
5333func Test_EnsureUploaded (t * testing.T ) {
@@ -63,19 +43,6 @@ func Test_EnsureUploaded(t *testing.T) {
6343 require .Len (t , schemas , 1 )
6444
6545 })
66-
67- f .RunIfPostgres (t , "uploads schema" , func (t * testing.T ) {
68- f .RunMigrationFile ("../migrations/0001.sqlcode.pgsql" )
69-
70- _ , err := f .DB .Exec (
71- fmt .Sprintf (`grant create on database "%s" to "sqlcode-definer-role"` , f .DBName ))
72- require .NoError (t , err )
73-
74- require .NoError (t , SQL .EnsureUploaded (ctx , f .DB ))
75- schemas , err := SQL .ListUploaded (ctx , f .DB )
76- require .NoError (t , err )
77- require .Len (t , schemas , 1 )
78- })
7946}
8047
8148func Test_DropAndUpload (t * testing.T ) {
@@ -88,15 +55,4 @@ func Test_DropAndUpload(t *testing.T) {
8855 require .NoError (t , SQL .EnsureUploaded (ctx , f .DB ))
8956 require .NoError (t , SQL .DropAndUpload (ctx , f .DB ))
9057 })
91-
92- f .RunIfPostgres (t , "drop and upload" , func (t * testing.T ) {
93- f .RunMigrationFile ("../migrations/0001.sqlcode.pgsql" )
94-
95- _ , err := f .DB .Exec (
96- fmt .Sprintf (`grant create on database "%s" to "sqlcode-definer-role"` , f .DBName ))
97- require .NoError (t , err )
98-
99- require .NoError (t , SQL .EnsureUploaded (ctx , f .DB ))
100- require .NoError (t , SQL .DropAndUpload (ctx , f .DB ))
101- })
10258}
0 commit comments