@@ -1153,6 +1153,14 @@ func TestAuthTests(t *testing.T) {
11531153// Each time a new Dolt procedure is introduced in a ScriptTest, it's grouped into a set of related procedures. Each set
11541154// is separated by a new line.
11551155func TestAuthDoltProcedures (t * testing.T ) {
1156+ tempDir , err := os .MkdirTemp ("" , t .Name ())
1157+ if err != nil {
1158+ t .Fatal (err )
1159+ }
1160+ t .Cleanup (func () { _ = os .RemoveAll (tempDir ) })
1161+ authTestFireUrl := func (path string ) string {
1162+ return "file://" + filepath .ToSlash (filepath .Join (tempDir , path ))
1163+ }
11561164 RunScripts (t , []ScriptTest {
11571165 {
11581166 UseLocalFileSystem : true ,
@@ -1395,6 +1403,11 @@ func TestAuthDoltProcedures(t *testing.T) {
13951403 authTestSkipAsSuper ("select dolt_count_commits('--from=main', '--to=test');" , []sql.Row {{"{0}" }}, "" ),
13961404
13971405 authTestAssertAsSuper ("select dolt_backup('remove', 'bak1');" , []sql.Row {{"{0}" }}, "" ),
1406+ authTestAssertAsSuper (fmt .Sprintf ("select dolt_backup('add', 'bak2', '%s');" , authTestFireUrl ("bak2" )), []sql.Row {{"{0}" }}, "" ),
1407+ authTestAssertAsSuper ("select dolt_backup('sync', 'bak2');" , []sql.Row {{"{0}" }}, "" ),
1408+ authTestAssertAsSuper (fmt .Sprintf ("select dolt_backup('restore', '%s', 'restored_db');" , authTestFireUrl ("bak2" )), []sql.Row {{"{0}" }}, "" ),
1409+ authTestAssertAsSuper ("drop database restored_db;" , []sql.Row {}, "" ),
1410+ authTestAssertAsSuper ("select dolt_backup('remove', 'bak2');" , []sql.Row {{"{0}" }}, "" ),
13981411 authTestAssertAsSuper (fmt .Sprintf ("select dolt_remote('add', 'origin', '%s');" , authTestFireUrl ("bak1" )), []sql.Row {{"{0}" }}, "" ),
13991412
14001413 authTestAssertAsSuper ("select dolt_fetch('origin', 'main');" , []sql.Row {{"{0}" }}, "" ),
@@ -1504,6 +1517,8 @@ func TestAuthDoltProcedures(t *testing.T) {
15041517 authTestSkipAssertAsBasic ("select dolt_count_commits('--from=main', '--to=test');" , []sql.Row {{"{0}" }}, "" ),
15051518
15061519 authTestAssertAsBasic ("select dolt_backup('remove', 'bak1');" , nil , functions .ErrDoltProcedurePermissionDenied .Error ()),
1520+ authTestAssertAsBasic ("select dolt_backup('sync', 'bak1');" , nil , functions .ErrDoltProcedurePermissionDenied .Error ()),
1521+ authTestAssertAsBasic (fmt .Sprintf ("select dolt_backup('restore', '%s', 'restored_db');" , authTestFireUrl ("bak1" )), nil , functions .ErrDoltProcedurePermissionDenied .Error ()),
15071522 authTestAssertAsBasic (fmt .Sprintf ("select dolt_remote('add', 'origin', '%s');" , authTestFireUrl ("bak1" )), nil , functions .ErrDoltProcedurePermissionDenied .Error ()),
15081523
15091524 authTestAssertAsBasic ("select dolt_fetch('origin', 'main');" , nil , functions .ErrDoltProcedurePermissionDenied .Error ()),
@@ -1605,9 +1620,3 @@ func authTestGrantBasic(object string, privileges ...string) ScriptTestAssertion
16051620 Expected : []sql.Row {},
16061621 }
16071622}
1608-
1609- // authTestFireUrl returns a file:// URL path for a temp file.
1610- func authTestFireUrl (path string ) string {
1611- path = filepath .Join (os .TempDir (), path )
1612- return "file://" + filepath .ToSlash (filepath .Clean (path ))
1613- }
0 commit comments