Skip to content

Use Time::Fake to avoid sleeping during tests

Maxime Besson requested to merge unit-tests-fake-time into v2.0

A lot of builds fail because we rely on short expiration TTLs and sleep()s. When the CI hosts are under heavy load, sometimes we hit the short expiration TTLs too early in the test.

I propose importing the Time::Fake perl lib into the test suite, which allows to skip arbitrary time lengths without having to actually wait. That way we can have TTLs with a larger tolerance to load, but we don't have to actually wait 1 hours for a session to expire.

I wish we could use it from packages, but it's not available in CentOS. Either way, since we only use it in the test suite we probably don't have to distribute it in releases?

Because of the way the test suite is split, I had to import it both in portal/t and handler/t, perhaps there is a better way? It's pretty small so probably not much of an issue there.

Its license is the Perl license so we shouldn't have any legal issues either.

Merge request reports