CON-In-A-Box / CIAB-Portal

The Core of Con-In-A-Box, but so much more! Convention Meetings, Registration and Volunteers management software package
Apache License 2.0
9 stars 5 forks source link

Fix an issue with memory leaking between tests #671

Closed rkaiser-dev closed 10 months ago

rkaiser-dev commented 10 months ago

This PR addresses a memory leak issue we are seeing with tests.

Originally when implementing this against the branch I had been working on for the Department API changes, I was not able to run the tests at all as they would fail after the container started going above 130 MB memory usage. I made no changes to the configuration that would have limited it to this, so I assume it must be a default or something.

After pulling the latest from main I was able to run the tests without these changes, however it was clear that it was leaking memory despite finishing successfully.

Test output before change:

Time: 39.8 seconds, Memory: 104.00 MB

OK (102 tests, 2740 assertions)

Test output after change:

Time: 39.26 seconds, Memory: 32.00 MB

OK (102 tests, 2740 assertions)

No change to test speed, but significant improvement on memory usage. There may be more that we can do, but I feel like we covered the most important factors here, which are the container, the app, and the middleware.