This repository was archived by the owner on Feb 10, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
This repository was archived by the owner on Feb 10, 2026. It is now read-only.
'Variable.update_time' fails where system clock is not UTC #111
Copy link
Copy link
Closed
Labels
api: runtimeconfigIssues related to the googleapis/python-runtimeconfig API.Issues related to the googleapis/python-runtimeconfig API.
Description
$ nox -s unit-3.9
...
_______________ TestConfig.test_get_variable_w_alternate_client ________________
self = <unit.test_config.TestConfig testMethod=test_get_variable_w_alternate_client>
def test_get_variable_w_alternate_client(self):
from google.cloud._helpers import _rfc3339_to_datetime
VARIABLE_NAME = "my-variable/abcd"
VARIABLE_PATH = "%s/variables/%s" % (self.CONFIG_PATH, VARIABLE_NAME)
RESOURCE = {
"name": VARIABLE_PATH,
"value": "bXktdmFyaWFibGUtdmFsdWU=", # base64 my-variable-value
"updateTime": "2016-04-14T21:21:54.5000Z",
"state": "VARIABLE_STATE_UNSPECIFIED",
}
conn1 = _Connection()
CLIENT1 = _Client(project=self.PROJECT, connection=conn1)
conn2 = _Connection(RESOURCE)
CLIENT2 = _Client(project=self.PROJECT, connection=conn2)
config = self._make_one(client=CLIENT1, name=self.CONFIG_NAME)
variable = config.get_variable(VARIABLE_NAME, client=CLIENT2)
self.assertEqual(variable.name, VARIABLE_NAME)
self.assertEqual(variable.full_name, VARIABLE_PATH)
> self.assertEqual(
variable.update_time, _rfc3339_to_datetime(RESOURCE["updateTime"])
)
E AssertionError: datetime.datetime(2016, 4, 15, 1, 21, 54, 500000, tzinfo=datetime.timezone.utc) != datetime.datetime(2016, 4, 14, 21, 21, 54, 500000, tzinfo=datetime.timezone.utc)
tests/unit/test_config.py:203: AssertionError
...Even though it knows it is unmarshalling a UTC timestamp, the code mistakenly juggles with offsetting the time, when only milliseconds / microseconds are passed.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
api: runtimeconfigIssues related to the googleapis/python-runtimeconfig API.Issues related to the googleapis/python-runtimeconfig API.