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:
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.
OK, so on further digging - it appears the ruby client wrapper I'm using doesn't propagate the connection settings during the initialisation of the wrapper? So this leaves me wondering if I may have set TZ manually when experimenting on the commandline. So ruby aside....my question is now more simple. How can I state in my bitbucket-pipeline.yml config - where I define my mysql service, that I want the mysql server to operate in UTC.
The equivalent console commands are:
SET GLOBAL time_zone = '+00:00'
SET SESSION time_zone = '+00:00'
And this is what I woudl like to see when I query on startup:
SELECT @@global.time_zone, @@session.time_zone would return 2 results:
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs