@@ -86,6 +86,9 @@ func setup(t *testing.T, options ...func(testConfig *TestConfig)) *vcsmocks.Mock
8686 // create an empty DB
8787 tmp := t .TempDir ()
8888 defaultBoltDB , err := db .New (tmp )
89+ t .Cleanup (func () {
90+ defaultBoltDB .Close ()
91+ })
8992 Ok (t , err )
9093
9194 testConfig := & TestConfig {
@@ -773,6 +776,9 @@ func TestRunAutoplanCommand_DeletePlans(t *testing.T) {
773776 setup (t )
774777 tmp := t .TempDir ()
775778 boltDB , err := db .New (tmp )
779+ t .Cleanup (func () {
780+ boltDB .Close ()
781+ })
776782 Ok (t , err )
777783 dbUpdater .Backend = boltDB
778784 applyCommandRunner .Backend = boltDB
@@ -800,6 +806,9 @@ func TestRunAutoplanCommand_FailedPreWorkflowHook_FailOnPreWorkflowHookError_Fal
800806 setup (t )
801807 tmp := t .TempDir ()
802808 boltDB , err := db .New (tmp )
809+ t .Cleanup (func () {
810+ boltDB .Close ()
811+ })
803812 Ok (t , err )
804813 dbUpdater .Backend = boltDB
805814 applyCommandRunner .Backend = boltDB
@@ -828,6 +837,9 @@ func TestRunAutoplanCommand_FailedPreWorkflowHook_FailOnPreWorkflowHookError_Tru
828837 setup (t )
829838 tmp := t .TempDir ()
830839 boltDB , err := db .New (tmp )
840+ t .Cleanup (func () {
841+ boltDB .Close ()
842+ })
831843 Ok (t , err )
832844 dbUpdater .Backend = boltDB
833845 applyCommandRunner .Backend = boltDB
@@ -852,6 +864,9 @@ func TestRunCommentCommand_FailedPreWorkflowHook_FailOnPreWorkflowHookError_Fals
852864 setup (t )
853865 tmp := t .TempDir ()
854866 boltDB , err := db .New (tmp )
867+ t .Cleanup (func () {
868+ boltDB .Close ()
869+ })
855870 Ok (t , err )
856871 dbUpdater .Backend = boltDB
857872 applyCommandRunner .Backend = boltDB
@@ -874,6 +889,9 @@ func TestRunCommentCommand_FailedPreWorkflowHook_FailOnPreWorkflowHookError_True
874889 setup (t )
875890 tmp := t .TempDir ()
876891 boltDB , err := db .New (tmp )
892+ t .Cleanup (func () {
893+ boltDB .Close ()
894+ })
877895 Ok (t , err )
878896 dbUpdater .Backend = boltDB
879897 applyCommandRunner .Backend = boltDB
@@ -892,6 +910,9 @@ func TestRunGenericPlanCommand_DeletePlans(t *testing.T) {
892910 setup (t )
893911 tmp := t .TempDir ()
894912 boltDB , err := db .New (tmp )
913+ t .Cleanup (func () {
914+ boltDB .Close ()
915+ })
895916 Ok (t , err )
896917 dbUpdater .Backend = boltDB
897918 applyCommandRunner .Backend = boltDB
@@ -914,6 +935,9 @@ func TestRunSpecificPlanCommandDoesnt_DeletePlans(t *testing.T) {
914935 setup (t )
915936 tmp := t .TempDir ()
916937 boltDB , err := db .New (tmp )
938+ t .Cleanup (func () {
939+ boltDB .Close ()
940+ })
917941 Ok (t , err )
918942 dbUpdater .Backend = boltDB
919943 applyCommandRunner .Backend = boltDB
@@ -934,6 +958,9 @@ func TestRunAutoplanCommandWithError_DeletePlans(t *testing.T) {
934958
935959 tmp := t .TempDir ()
936960 boltDB , err := db .New (tmp )
961+ t .Cleanup (func () {
962+ boltDB .Close ()
963+ })
937964 Ok (t , err )
938965 dbUpdater .Backend = boltDB
939966 applyCommandRunner .Backend = boltDB
@@ -986,6 +1013,9 @@ func TestRunGenericPlanCommand_DiscardApprovals(t *testing.T) {
9861013
9871014 tmp := t .TempDir ()
9881015 boltDB , err := db .New (tmp )
1016+ t .Cleanup (func () {
1017+ boltDB .Close ()
1018+ })
9891019 Ok (t , err )
9901020 dbUpdater .Backend = boltDB
9911021 applyCommandRunner .Backend = boltDB
@@ -1011,6 +1041,9 @@ func TestFailedApprovalCreatesFailedStatusUpdate(t *testing.T) {
10111041 setup (t )
10121042 tmp := t .TempDir ()
10131043 boltDB , err := db .New (tmp )
1044+ t .Cleanup (func () {
1045+ boltDB .Close ()
1046+ })
10141047 Ok (t , err )
10151048 dbUpdater .Backend = boltDB
10161049 applyCommandRunner .Backend = boltDB
@@ -1057,6 +1090,9 @@ func TestApprovedPoliciesUpdateFailedPolicyStatus(t *testing.T) {
10571090 setup (t )
10581091 tmp := t .TempDir ()
10591092 boltDB , err := db .New (tmp )
1093+ t .Cleanup (func () {
1094+ boltDB .Close ()
1095+ })
10601096 Ok (t , err )
10611097 dbUpdater .Backend = boltDB
10621098 applyCommandRunner .Backend = boltDB
@@ -1113,6 +1149,9 @@ func TestApplyMergeablityWhenPolicyCheckFails(t *testing.T) {
11131149 setup (t )
11141150 tmp := t .TempDir ()
11151151 boltDB , err := db .New (tmp )
1152+ t .Cleanup (func () {
1153+ boltDB .Close ()
1154+ })
11161155 Ok (t , err )
11171156 dbUpdater .Backend = boltDB
11181157 applyCommandRunner .Backend = boltDB
@@ -1191,6 +1230,9 @@ func TestRunApply_DiscardedProjects(t *testing.T) {
11911230 defer func () { autoMerger .GlobalAutomerge = false }()
11921231 tmp := t .TempDir ()
11931232 boltDB , err := db .New (tmp )
1233+ t .Cleanup (func () {
1234+ boltDB .Close ()
1235+ })
11941236 Ok (t , err )
11951237 dbUpdater .Backend = boltDB
11961238 applyCommandRunner .Backend = boltDB
0 commit comments