typegoose / mongodb-memory-server

Manage & spin up mongodb server binaries with zero(or slight) configuration for tests.
https://typegoose.github.io/mongodb-memory-server/
MIT License
2.57k stars 185 forks source link

When running the tests, not all the temp directories are deleted #788

Closed orgads closed 1 year ago

orgads commented 1 year ago

Versions

package: mongo-memory-server

What is the Problem?

After running the tests, some directories named /tmp/mongo-mem-* are cleaned up, but 16 directories remain.

Example:

$ ls -F | grep mongo
mongo-mem-1Uvw57/
mongo-mem-3p8Ht8/
mongo-mem-3uX5zS/
mongo-mem-72lMFJ/
mongo-mem-92wykg/
mongo-mem-C1j0Y3/
mongo-mem-CagqwH/
mongo-mem-cCQi1V/
mongo-mem-d4QVf8/
mongo-mem-gksG2o/
mongo-mem-JPRDDc/
mongo-mem-keyfile-r4ZApt/
mongo-mem-mgKdm7/
mongo-mem-PbU7F0/
mongo-mem-wA4Et7/
mongo-mem-YFzWa8/
mongo-mem-yJXnvv/
mongodb-42303.sock=
reuse-mongo-mem-tdFMBT/

Do you know why it happenes?

no

hasezoey commented 1 year ago

were the tests successful or did they error? also, is this from the MMS test-suite?

orgads commented 1 year ago

1 test failed:

    console.warn
      An Process didnt exit with signal "SIGINT" within 10 seconds, using "SIGKILL"!
      Enable debug logs for more information

      125 |
      126 |       if (!debug.enabled('MongoMS:utils')) {
    > 127 |         console.warn(
          |                 ^
      128 |           'An Process didnt exit with signal "SIGINT" within 10 seconds, using "SIGKILL"!\n' +
      129 |             'Enable debug logs for more information'
      130 |         );

      at console.<anonymous> (../../node_modules/jest-mock/build/index.js:839:25)
      at Timeout.warn [as _onTimeout] (src/util/utils.ts:127:17)

  ● single server replset › should make use of "AutomaticAuth" (wiredTiger)

    MongoWriteConcernError: operation was interrupted

      at Connection.onMessage (../../node_modules/mongodb/src/cmap/connection.ts:444:20)
      at MessageStream.<anonymous> (../../node_modules/mongodb/src/cmap/connection.ts:241:56)
      at processIncomingData (../../node_modules/mongodb/src/cmap/message_stream.ts:188:12)
      at MessageStream._write (../../node_modules/mongodb/src/cmap/message_stream.ts:69:5)

I ran npm test in my MMS clone.

hasezoey commented 1 year ago

temporary directories only get cleaned up when calling .stop (without disabling it in the arguments) or calling .cleanup, so if a test fails the temporary directory will stay

but yes, current master does not clean-up some directories, but current beta (9.0) does, i will probably not backport all of the changes, but maybe some

hasezoey commented 1 year ago

backported ead795866054e11d133f497118f31cb9ca776c1b and 2cbfb585365b101038d0e5dd98ea2316db5515fc, so now there are no temporary directories anymore (for successful tests at least)

orgads commented 1 year ago

Thank you!