googlearchive / simian

Simian is an enterprise-class Mac OS X software deployment solution. Google App Engine hosted server, with a client powered by the Munki open-source project.
Apache License 2.0
332 stars 51 forks source link

FAIL: testSet (settings_datastore_test.DatastoreSettingsTest) #56

Closed sillywilly42 closed 7 years ago

sillywilly42 commented 7 years ago

For a while now this Simian test has been failing for me. I think it's a DST timezone issue. I get this output:

Testing settings_datastore_test
...F
======================================================================
FAIL: testSet (settings_datastore_test.DatastoreSettingsTest)
testSet (settings_datastore_test.DatastoreSettingsTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "src/tests/simian/settings_datastore_test.py", line 98, in testSet
    datetime.timedelta(seconds=1), datetime.datetime.now() - stamp)
AssertionError: datetime.timedelta(0, 1) not greater than datetime.timedelta(0, 3600, 3474)

The issue is that the timestamp returned by models.Settings.GetItem('long_name') is an hour in the past. I temporarily fixed it by changing this line to:

datetime.timedelta(seconds=3601), datetime.datetime.now() - stamp)

maximermilov commented 7 years ago

Does changing datetime.datetime.now() to datetime.datetime.utcnow() helps?

sillywilly42 commented 7 years ago

@maximermilov: Yes - that works

maximermilov commented 7 years ago

Fixed in https://github.com/google/simian/commit/2a3f021f9c17b8cf11c29b8d32324a76be37dac1