Skip to content

Commit 5884622

Browse files
committed
amend fileUrl func in auth_test.go
1 parent 32e6ee7 commit 5884622

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

testing/go/auth_test.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -572,8 +572,8 @@ func TestAuthDoltProcedures(t *testing.T) {
572572
"select dolt_commit('-m', 'add test table');",
573573
},
574574
Assertions: []ScriptTestAssertion{
575-
authTestAssertAsSuper(fmt.Sprintf("call dolt_backup('sync-url', '%s');", fileUrl("bak1")), nil, functions.ErrDoltProcedureSelectOnly.Error()),
576-
authTestAssertAsSuper(fmt.Sprintf("call dolt_backup('add', 'bak1', '%s');", fileUrl("bak1")), nil, functions.ErrDoltProcedureSelectOnly.Error()),
575+
authTestAssertAsSuper(fmt.Sprintf("call dolt_backup('sync-url', '%s');", authTestFireUrl("bak1")), nil, functions.ErrDoltProcedureSelectOnly.Error()),
576+
authTestAssertAsSuper(fmt.Sprintf("call dolt_backup('add', 'bak1', '%s');", authTestFireUrl("bak1")), nil, functions.ErrDoltProcedureSelectOnly.Error()),
577577

578578
authTestAssertAsSuper("call dolt_checkout('-b', 'test');", nil, functions.ErrDoltProcedureSelectOnly.Error()),
579579

@@ -588,7 +588,7 @@ func TestAuthDoltProcedures(t *testing.T) {
588588

589589
authTestAssertAsSuper("call dolt_clean('--dry-run');", nil, functions.ErrDoltProcedureSelectOnly.Error()),
590590

591-
authTestAssertAsSuper(fmt.Sprintf("call dolt_clone('%s', 'cloned_bak1');", fileUrl("bak1")), nil, functions.ErrDoltProcedureSelectOnly.Error()),
591+
authTestAssertAsSuper(fmt.Sprintf("call dolt_clone('%s', 'cloned_bak1');", authTestFireUrl("bak1")), nil, functions.ErrDoltProcedureSelectOnly.Error()),
592592

593593
authTestAssertAsSuper("set authtest.hash = ''", []sql.Row{}, ""),
594594
authTestAssertAsSuper("call dolt_commit_hash_out('authtest.hash', '-am', 'add val 3 to test table')", nil, functions.ErrDoltProcedureSelectOnly.Error()),
@@ -607,7 +607,7 @@ func TestAuthDoltProcedures(t *testing.T) {
607607
authTestAssertAsSuper("call dolt_count_commits('--from=main', '--to=test');", nil, functions.ErrDoltProcedureSelectOnly.Error()),
608608

609609
authTestAssertAsSuper("call dolt_backup('remove', 'bak1');", nil, functions.ErrDoltProcedureSelectOnly.Error()),
610-
authTestAssertAsSuper(fmt.Sprintf("call dolt_remote('add', 'origin', '%s');", fileUrl("bak1")), nil, functions.ErrDoltProcedureSelectOnly.Error()),
610+
authTestAssertAsSuper(fmt.Sprintf("call dolt_remote('add', 'origin', '%s');", authTestFireUrl("bak1")), nil, functions.ErrDoltProcedureSelectOnly.Error()),
611611

612612
authTestAssertAsSuper("call dolt_fetch('origin', 'main');", nil, functions.ErrDoltProcedureSelectOnly.Error()),
613613

@@ -667,8 +667,8 @@ func TestAuthDoltProcedures(t *testing.T) {
667667
"select dolt_commit('-m', 'add test table');",
668668
},
669669
Assertions: []ScriptTestAssertion{
670-
authTestAssertAsBasic(fmt.Sprintf("call dolt_backup('sync-url', '%s');", fileUrl("bak1")), nil, functions.ErrDoltProcedureSelectOnly.Error()),
671-
authTestAssertAsBasic(fmt.Sprintf("call dolt_backup('add', 'bak1', '%s');", fileUrl("bak1")), nil, functions.ErrDoltProcedureSelectOnly.Error()),
670+
authTestAssertAsBasic(fmt.Sprintf("call dolt_backup('sync-url', '%s');", authTestFireUrl("bak1")), nil, functions.ErrDoltProcedureSelectOnly.Error()),
671+
authTestAssertAsBasic(fmt.Sprintf("call dolt_backup('add', 'bak1', '%s');", authTestFireUrl("bak1")), nil, functions.ErrDoltProcedureSelectOnly.Error()),
672672

673673
// Grant user access to test_table before checkout to avoid merge conflict in later cherry-pick.
674674
authTestGrantBasic("schema public", "all"),
@@ -686,7 +686,7 @@ func TestAuthDoltProcedures(t *testing.T) {
686686

687687
authTestAssertAsBasic("call dolt_clean('--dry-run');", nil, functions.ErrDoltProcedureSelectOnly.Error()),
688688

689-
authTestAssertAsBasic(fmt.Sprintf("call dolt_clone('%s', 'cloned_bak1');", fileUrl("bak1")), nil, functions.ErrDoltProcedureSelectOnly.Error()),
689+
authTestAssertAsBasic(fmt.Sprintf("call dolt_clone('%s', 'cloned_bak1');", authTestFireUrl("bak1")), nil, functions.ErrDoltProcedureSelectOnly.Error()),
690690
authTestAssertAsBasic("create database cloned_bak1;", []sql.Row{}, ""),
691691

692692
authTestAssertAsSuper("set authtest.hash = '';", []sql.Row{}, ""),
@@ -706,7 +706,7 @@ func TestAuthDoltProcedures(t *testing.T) {
706706
authTestAssertAsBasic("call dolt_count_commits('--from=main', '--to=test');", nil, functions.ErrDoltProcedureSelectOnly.Error()),
707707

708708
authTestAssertAsBasic("call dolt_backup('remove', 'bak1');", nil, functions.ErrDoltProcedureSelectOnly.Error()),
709-
authTestAssertAsBasic(fmt.Sprintf("call dolt_remote('add', 'origin', '%s');", fileUrl("bak1")), nil, functions.ErrDoltProcedureSelectOnly.Error()),
709+
authTestAssertAsBasic(fmt.Sprintf("call dolt_remote('add', 'origin', '%s');", authTestFireUrl("bak1")), nil, functions.ErrDoltProcedureSelectOnly.Error()),
710710

711711
authTestAssertAsBasic("call dolt_fetch('origin', 'main');", nil, functions.ErrDoltProcedureSelectOnly.Error()),
712712

@@ -765,8 +765,8 @@ func TestAuthDoltProcedures(t *testing.T) {
765765
"select dolt_commit('-m', 'add test table');",
766766
},
767767
Assertions: []ScriptTestAssertion{
768-
authTestAssertAsSuper(fmt.Sprintf("select dolt_backup('sync-url', '%s');", fileUrl("bak1")), []sql.Row{{"{0}"}}, ""),
769-
authTestAssertAsSuper(fmt.Sprintf("select dolt_backup('add', 'bak1', '%s');", fileUrl("bak1")), []sql.Row{{"{0}"}}, ""),
768+
authTestAssertAsSuper(fmt.Sprintf("select dolt_backup('sync-url', '%s');", authTestFireUrl("bak1")), []sql.Row{{"{0}"}}, ""),
769+
authTestAssertAsSuper(fmt.Sprintf("select dolt_backup('add', 'bak1', '%s');", authTestFireUrl("bak1")), []sql.Row{{"{0}"}}, ""),
770770

771771
authTestAssertAsSuper("select dolt_checkout('-b', 'test');", []sql.Row{{"{0,\"Switched to branch 'test'\"}"}}, ""),
772772

@@ -781,7 +781,7 @@ func TestAuthDoltProcedures(t *testing.T) {
781781

782782
authTestAssertAsSuper("select dolt_clean('--dry-run');", []sql.Row{{"{0}"}}, ""),
783783

784-
authTestAssertAsSuper(fmt.Sprintf("select dolt_clone('%s', 'cloned_bak1');", fileUrl("bak1")), []sql.Row{{"{0}"}}, ""),
784+
authTestAssertAsSuper(fmt.Sprintf("select dolt_clone('%s', 'cloned_bak1');", authTestFireUrl("bak1")), []sql.Row{{"{0}"}}, ""),
785785

786786
authTestAssertAsSuper("set authtest.hash = '';", []sql.Row{}, ""),
787787
// TODO(elianddb): variadic parameter support for Dolt stored procedures functions
@@ -802,7 +802,7 @@ func TestAuthDoltProcedures(t *testing.T) {
802802
authTestSkipAsSuper("select dolt_count_commits('--from=main', '--to=test');", []sql.Row{{"{0}"}}, ""),
803803

804804
authTestAssertAsSuper("select dolt_backup('remove', 'bak1');", []sql.Row{{"{0}"}}, ""),
805-
authTestAssertAsSuper(fmt.Sprintf("select dolt_remote('add', 'origin', '%s');", fileUrl("bak1")), []sql.Row{{"{0}"}}, ""),
805+
authTestAssertAsSuper(fmt.Sprintf("select dolt_remote('add', 'origin', '%s');", authTestFireUrl("bak1")), []sql.Row{{"{0}"}}, ""),
806806

807807
authTestAssertAsSuper("select dolt_fetch('origin', 'main');", []sql.Row{{"{0}"}}, ""),
808808

@@ -836,7 +836,7 @@ func TestAuthDoltProcedures(t *testing.T) {
836836
authTestAssertAsSuper("select length(dolt_commit('-m', 'rm to_rm')::text) = 34;", []sql.Row{{"t"}}, ""),
837837
authTestAssertAsSuper(
838838
"select dolt_push('origin', 'test');",
839-
[]sql.Row{{fmt.Sprintf("{0,\"To %s\n * [new branch] test -> test\"}", fileUrl("bak1"))}},
839+
[]sql.Row{{fmt.Sprintf("{0,\"To %s\n * [new branch] test -> test\"}", authTestFireUrl("bak1"))}},
840840
""),
841841
authTestAssertAsSuper("select dolt_pull('origin', 'test');", []sql.Row{{"{0,0,\"Everything up-to-date\"}"}}, ""),
842842

@@ -870,8 +870,8 @@ func TestAuthDoltProcedures(t *testing.T) {
870870
"select dolt_commit('-m', 'add test table');",
871871
},
872872
Assertions: []ScriptTestAssertion{
873-
authTestAssertAsBasic(fmt.Sprintf("select dolt_backup('sync-url', '%s');", fileUrl("bak1")), nil, functions.ErrDoltProcedurePermissionDenied.Error()),
874-
authTestAssertAsBasic(fmt.Sprintf("select dolt_backup('add', 'bak1', '%s');", fileUrl("bak1")), nil, functions.ErrDoltProcedurePermissionDenied.Error()),
873+
authTestAssertAsBasic(fmt.Sprintf("select dolt_backup('sync-url', '%s');", authTestFireUrl("bak1")), nil, functions.ErrDoltProcedurePermissionDenied.Error()),
874+
authTestAssertAsBasic(fmt.Sprintf("select dolt_backup('add', 'bak1', '%s');", authTestFireUrl("bak1")), nil, functions.ErrDoltProcedurePermissionDenied.Error()),
875875

876876
// Grant user access to test_table before checkout to avoid merge conflict in later cherry-pick.
877877
authTestGrantBasic("schema public", "all"),
@@ -889,7 +889,7 @@ func TestAuthDoltProcedures(t *testing.T) {
889889

890890
authTestAssertAsBasic("select dolt_clean('--dry-run');", []sql.Row{{"{0}"}}, ""),
891891

892-
authTestAssertAsBasic(fmt.Sprintf("select dolt_clone('%s', 'cloned_bak1');", fileUrl("bak1")), nil, functions.ErrDoltProcedurePermissionDenied.Error()),
892+
authTestAssertAsBasic(fmt.Sprintf("select dolt_clone('%s', 'cloned_bak1');", authTestFireUrl("bak1")), nil, functions.ErrDoltProcedurePermissionDenied.Error()),
893893
authTestAssertAsBasic("create database cloned_bak1;", []sql.Row{}, ""),
894894

895895
authTestAssertAsBasic("set authtest.hash = '';", []sql.Row{}, ""),
@@ -911,7 +911,7 @@ func TestAuthDoltProcedures(t *testing.T) {
911911
authTestSkipAssertAsBasic("select dolt_count_commits('--from=main', '--to=test');", []sql.Row{{"{0}"}}, ""),
912912

913913
authTestAssertAsBasic("select dolt_backup('remove', 'bak1');", nil, functions.ErrDoltProcedurePermissionDenied.Error()),
914-
authTestAssertAsBasic(fmt.Sprintf("select dolt_remote('add', 'origin', '%s');", fileUrl("bak1")), nil, functions.ErrDoltProcedurePermissionDenied.Error()),
914+
authTestAssertAsBasic(fmt.Sprintf("select dolt_remote('add', 'origin', '%s');", authTestFireUrl("bak1")), nil, functions.ErrDoltProcedurePermissionDenied.Error()),
915915

916916
authTestAssertAsBasic("select dolt_fetch('origin', 'main');", nil, functions.ErrDoltProcedurePermissionDenied.Error()),
917917

@@ -1013,8 +1013,8 @@ func authTestGrantBasic(object string, privileges ...string) ScriptTestAssertion
10131013
}
10141014
}
10151015

1016-
// fileUrl returns a file:// URL path for a temp file.
1017-
func fileUrl(path string) string {
1016+
// authTestFireUrl returns a file:// URL path for a temp file.
1017+
func authTestFireUrl(path string) string {
10181018
path = filepath.Join(os.TempDir(), path)
10191019
return "file://" + filepath.ToSlash(filepath.Clean(path))
10201020
}

0 commit comments

Comments
 (0)