@@ -86,6 +86,9 @@ func setup(t *testing.T, options ...func(testConfig *TestConfig)) *vcsmocks.Mock
86
86
// create an empty DB
87
87
tmp := t .TempDir ()
88
88
defaultBoltDB , err := db .New (tmp )
89
+ t .Cleanup (func () {
90
+ defaultBoltDB .Close ()
91
+ })
89
92
Ok (t , err )
90
93
91
94
testConfig := & TestConfig {
@@ -773,6 +776,9 @@ func TestRunAutoplanCommand_DeletePlans(t *testing.T) {
773
776
setup (t )
774
777
tmp := t .TempDir ()
775
778
boltDB , err := db .New (tmp )
779
+ t .Cleanup (func () {
780
+ boltDB .Close ()
781
+ })
776
782
Ok (t , err )
777
783
dbUpdater .Backend = boltDB
778
784
applyCommandRunner .Backend = boltDB
@@ -800,6 +806,9 @@ func TestRunAutoplanCommand_FailedPreWorkflowHook_FailOnPreWorkflowHookError_Fal
800
806
setup (t )
801
807
tmp := t .TempDir ()
802
808
boltDB , err := db .New (tmp )
809
+ t .Cleanup (func () {
810
+ boltDB .Close ()
811
+ })
803
812
Ok (t , err )
804
813
dbUpdater .Backend = boltDB
805
814
applyCommandRunner .Backend = boltDB
@@ -828,6 +837,9 @@ func TestRunAutoplanCommand_FailedPreWorkflowHook_FailOnPreWorkflowHookError_Tru
828
837
setup (t )
829
838
tmp := t .TempDir ()
830
839
boltDB , err := db .New (tmp )
840
+ t .Cleanup (func () {
841
+ boltDB .Close ()
842
+ })
831
843
Ok (t , err )
832
844
dbUpdater .Backend = boltDB
833
845
applyCommandRunner .Backend = boltDB
@@ -852,6 +864,9 @@ func TestRunCommentCommand_FailedPreWorkflowHook_FailOnPreWorkflowHookError_Fals
852
864
setup (t )
853
865
tmp := t .TempDir ()
854
866
boltDB , err := db .New (tmp )
867
+ t .Cleanup (func () {
868
+ boltDB .Close ()
869
+ })
855
870
Ok (t , err )
856
871
dbUpdater .Backend = boltDB
857
872
applyCommandRunner .Backend = boltDB
@@ -874,6 +889,9 @@ func TestRunCommentCommand_FailedPreWorkflowHook_FailOnPreWorkflowHookError_True
874
889
setup (t )
875
890
tmp := t .TempDir ()
876
891
boltDB , err := db .New (tmp )
892
+ t .Cleanup (func () {
893
+ boltDB .Close ()
894
+ })
877
895
Ok (t , err )
878
896
dbUpdater .Backend = boltDB
879
897
applyCommandRunner .Backend = boltDB
@@ -892,6 +910,9 @@ func TestRunGenericPlanCommand_DeletePlans(t *testing.T) {
892
910
setup (t )
893
911
tmp := t .TempDir ()
894
912
boltDB , err := db .New (tmp )
913
+ t .Cleanup (func () {
914
+ boltDB .Close ()
915
+ })
895
916
Ok (t , err )
896
917
dbUpdater .Backend = boltDB
897
918
applyCommandRunner .Backend = boltDB
@@ -914,6 +935,9 @@ func TestRunSpecificPlanCommandDoesnt_DeletePlans(t *testing.T) {
914
935
setup (t )
915
936
tmp := t .TempDir ()
916
937
boltDB , err := db .New (tmp )
938
+ t .Cleanup (func () {
939
+ boltDB .Close ()
940
+ })
917
941
Ok (t , err )
918
942
dbUpdater .Backend = boltDB
919
943
applyCommandRunner .Backend = boltDB
@@ -934,6 +958,9 @@ func TestRunAutoplanCommandWithError_DeletePlans(t *testing.T) {
934
958
935
959
tmp := t .TempDir ()
936
960
boltDB , err := db .New (tmp )
961
+ t .Cleanup (func () {
962
+ boltDB .Close ()
963
+ })
937
964
Ok (t , err )
938
965
dbUpdater .Backend = boltDB
939
966
applyCommandRunner .Backend = boltDB
@@ -986,6 +1013,9 @@ func TestRunGenericPlanCommand_DiscardApprovals(t *testing.T) {
986
1013
987
1014
tmp := t .TempDir ()
988
1015
boltDB , err := db .New (tmp )
1016
+ t .Cleanup (func () {
1017
+ boltDB .Close ()
1018
+ })
989
1019
Ok (t , err )
990
1020
dbUpdater .Backend = boltDB
991
1021
applyCommandRunner .Backend = boltDB
@@ -1011,6 +1041,9 @@ func TestFailedApprovalCreatesFailedStatusUpdate(t *testing.T) {
1011
1041
setup (t )
1012
1042
tmp := t .TempDir ()
1013
1043
boltDB , err := db .New (tmp )
1044
+ t .Cleanup (func () {
1045
+ boltDB .Close ()
1046
+ })
1014
1047
Ok (t , err )
1015
1048
dbUpdater .Backend = boltDB
1016
1049
applyCommandRunner .Backend = boltDB
@@ -1057,6 +1090,9 @@ func TestApprovedPoliciesUpdateFailedPolicyStatus(t *testing.T) {
1057
1090
setup (t )
1058
1091
tmp := t .TempDir ()
1059
1092
boltDB , err := db .New (tmp )
1093
+ t .Cleanup (func () {
1094
+ boltDB .Close ()
1095
+ })
1060
1096
Ok (t , err )
1061
1097
dbUpdater .Backend = boltDB
1062
1098
applyCommandRunner .Backend = boltDB
@@ -1113,6 +1149,9 @@ func TestApplyMergeablityWhenPolicyCheckFails(t *testing.T) {
1113
1149
setup (t )
1114
1150
tmp := t .TempDir ()
1115
1151
boltDB , err := db .New (tmp )
1152
+ t .Cleanup (func () {
1153
+ boltDB .Close ()
1154
+ })
1116
1155
Ok (t , err )
1117
1156
dbUpdater .Backend = boltDB
1118
1157
applyCommandRunner .Backend = boltDB
@@ -1191,6 +1230,9 @@ func TestRunApply_DiscardedProjects(t *testing.T) {
1191
1230
defer func () { autoMerger .GlobalAutomerge = false }()
1192
1231
tmp := t .TempDir ()
1193
1232
boltDB , err := db .New (tmp )
1233
+ t .Cleanup (func () {
1234
+ boltDB .Close ()
1235
+ })
1194
1236
Ok (t , err )
1195
1237
dbUpdater .Backend = boltDB
1196
1238
applyCommandRunner .Backend = boltDB
0 commit comments