@@ -24,7 +24,6 @@ import (
24
24
"testing"
25
25
26
26
"github.com/dolthub/dolt/go/cmd/dolt/cli"
27
- "github.com/dolthub/dolt/go/libraries/doltcore/dbfactory"
28
27
"github.com/dolthub/dolt/go/libraries/doltcore/env"
29
28
"github.com/dolthub/dolt/go/libraries/utils/argparser"
30
29
"github.com/dolthub/dolt/go/libraries/utils/config"
@@ -46,9 +45,10 @@ func importKey(t *testing.T, ctx context.Context) {
46
45
}
47
46
48
47
func setupTestDB (t * testing.T , ctx context.Context , fs filesys.Filesys ) string {
49
- dir := t .TempDir ()
48
+ dir , err := os .MkdirTemp (os .TempDir (), "signed_commits" )
49
+ require .NoError (t , err )
50
50
dbDir := filepath .Join (dir , "db" )
51
- err : = filesys .CopyDir ("testdata/signed_commits/db/" , dbDir , fs )
51
+ err = filesys .CopyDir ("testdata/signed_commits/db/" , dbDir , fs )
52
52
require .NoError (t , err )
53
53
54
54
log .Println (dbDir )
@@ -79,9 +79,6 @@ func TestSignAndVerifyCommit(t *testing.T) {
79
79
ctx := context .Background ()
80
80
importKey (t , ctx )
81
81
dbDir := setupTestDB (t , ctx , filesys .LocalFS )
82
- t .Cleanup (func () {
83
- dbfactory .CloseAllLocalDatabases ()
84
- })
85
82
86
83
global := map [string ]string {
87
84
"user.name" : "First Last" ,
@@ -93,7 +90,7 @@ func TestSignAndVerifyCommit(t *testing.T) {
93
90
apr , err := cli .CreateCommitArgParser ().Parse (test .commitArgs )
94
91
require .NoError (t , err )
95
92
96
- _ , err = execCommand (ctx , t , dbDir , CommitCmd {}, test .commitArgs , apr , map [string ]string {}, global )
93
+ _ , err = execCommand (ctx , dbDir , CommitCmd {}, test .commitArgs , apr , map [string ]string {}, global )
97
94
98
95
if test .expectErr {
99
96
require .Error (t , err )
@@ -106,14 +103,14 @@ func TestSignAndVerifyCommit(t *testing.T) {
106
103
apr , err = cli .CreateLogArgParser (false ).Parse (args )
107
104
require .NoError (t , err )
108
105
109
- logOutput , err := execCommand (ctx , t , dbDir , LogCmd {}, args , apr , map [string ]string {}, global )
106
+ logOutput , err := execCommand (ctx , dbDir , LogCmd {}, args , apr , map [string ]string {}, global )
110
107
require .NoError (t , err )
111
108
require .
Contains (
t ,
logOutput ,
"Good signature from \" Test User <[email protected] >\" " )
112
109
})
113
110
}
114
111
}
115
112
116
- func execCommand (ctx context.Context , t * testing. T , wd string , cmd cli.Command , args []string , apr * argparser.ArgParseResults , local , global map [string ]string ) (output string , err error ) {
113
+ func execCommand (ctx context.Context , wd string , cmd cli.Command , args []string , apr * argparser.ArgParseResults , local , global map [string ]string ) (output string , err error ) {
117
114
err = os .Chdir (wd )
118
115
if err != nil {
119
116
err = fmt .Errorf ("error changing directory to %s: %w" , wd , err )
@@ -160,7 +157,7 @@ func execCommand(ctx context.Context, t *testing.T, wd string, cmd cli.Command,
160
157
161
158
initialOut := os .Stdout
162
159
initialErr := os .Stderr
163
- f , err := os .CreateTemp (t .TempDir (), "signed-commit-test-*" )
160
+ f , err := os .CreateTemp (os .TempDir (), "signed-commit-test-*" )
164
161
if err != nil {
165
162
err = fmt .Errorf ("error creating temp file: %w" , err )
166
163
return
0 commit comments