Time Comparison Failures¶
There are a few common causes of time-related test failures in Solano CI.
Solano CI may choose to run your tests in one of several different data centers. If you are using Rails and have configured the time zone in application.rb via config.time_zone, Solano CI will set the time zone for tests accordingly. Otherwise, you can set the time zone by specifying the value of the TZ environment variable in your config/solano.yml.
The value of the TZ environment variable should be one of the standard values found in the Olson Database such as America/New_York for the East Coast of the United States or America/Los_Angeles for the West Coast.
Ruby/Database Precision Mismatch¶
Ruby uses nanosecond-precision time. Most databases only support millisecond precision, or even less.
This is fine if you’re comparing two values that were read from the database, but it means that you can’t save Time.now, write it into the database, and expect to read back the same value.
Read our blog post for (much) more detail.