I have a timezone sensitive set of tests in my code-base (ruby). I make unit-test assertions about host and dbms timezone being locked to UTC. When making a connection to MySQL (using the ruby mysql2 adapter gen) I explicitly set connection options:
Mysql2::Client.default_query_options.merge!({:database_timezone=>:utc, :application_timezone=>:utc})What this does is to ensure that the TZ model used by MySQL server is to ensure both MySQL and the adaper do NOT convert times based on assumptions about locale. This works fine in my development and production environments.
As such my unit tests assert that in the context of a connection, I query back the TZ settings and ensure they're UTC (which in my case look this way):
Instantiated @ 2017-08-21 12:21:51 UTC Ver[5.7.19] Gl[+00:00] Sn[+00:00]
Where the Global (Gl) and Session (Sn) timezones returned by MySQL are '+00:00' which is how MySQL models UTC.
That is what should be working on Bitbucket Pipeline Mysql service integraiton too, but something is not working. The same assertion on startup within unit-tests provides the following variation:
Instantiated @ 2017-08-21 12:21:51 UTC Ver[5.7.19] Gl[SYSTEM] Sn[SYSTEM]
Now - to get this output, as I understand it - the client options I set are not being consumed/set by the MySQL service I'm integrating into my pipeline? Is there a way to enable this ? Or better - to explicitly set the MySQL service to UTC inherently within the configuration YML file?
Many thanks for any suggestions/ideas. I'd really like to avoid putting in environmental conditionals into the tests - given this is very timezone sensitive.