I have a Ruby on Rails app that I’m testing with Rspec, and I’ve encountered a slightly odd issue. I’ve been running the tests in parallel in 4 separate containers, and in three of those, everything works fine. However, in the fourth one, the timestamps on the objects created by Rails are being set to the following:
2021-01-01T00:00:00.000Z
rather than the current UTC date/time.
The app relies on sorting objects by the created_at timestamp, and returning the last object (the most recent). But since the created_at and updated_at timestamps are all identical, it may return any one of the created objects, which then means that the tests fail. I’ve tried setting the timezones on the containers, but this seems to have no effect, and when I SSH into them and check the timezone being used by Rails, it returns the correct date/time. So this only seems to affect the test environment, and the third container (logging from the tests shows that other containers are populating the timestamps correctly).
Has anyone else encountered anything like this before? Any insight would be very gratefully received!