Commit b39a4be 1 parent 18c50b0 commit b39a4be Copy full SHA for b39a4be
File tree 1 file changed +10
-4
lines changed
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,10 @@ type MgoSuite struct {
151
151
// logging or debugging in mgo adds a significant overhead to the
152
152
// Juju tests, so they are disabled by default.
153
153
DebugMgo bool
154
+
155
+ // SkipTestCleanup controls collection cleanup in TearDownTest.
156
+ // When set to true, TearDownTest will not delete collections.
157
+ SkipTestCleanup bool
154
158
}
155
159
156
160
// generatePEM receives server certificate and the server private key
@@ -1008,10 +1012,12 @@ func (s *MgoSuite) TearDownTest(c *gc.C) {
1008
1012
c .Assert (err , jc .ErrorIsNil )
1009
1013
}
1010
1014
1011
- // Rather than dropping the databases (which is very slow in Mongo
1012
- // 3.2) we clear all of the collections.
1013
- err = clearDatabases (s .Session )
1014
- c .Assert (err , jc .ErrorIsNil )
1015
+ if ! s .SkipTestCleanup {
1016
+ // Rather than dropping the databases (which is very slow in Mongo
1017
+ // 3.2) we clear all of the collections.
1018
+ err = clearDatabases (s .Session )
1019
+ c .Assert (err , jc .ErrorIsNil )
1020
+ }
1015
1021
s .Session .Close ()
1016
1022
s .Session = nil
1017
1023
You can’t perform that action at this time.
0 commit comments