Use utils.utcnow rather than datetime.utcnow
Fixes bug #1003587 Edit direct use of datetime.utcnow or datetime.now to utilize utils.utcnow Change-Id: I1130f6e664f252fc5da7304f495dc9f980721224
This commit is contained in:
@@ -96,7 +96,7 @@ class DbApiTestCase(test.TestCase):
|
||||
db.migration_update(ctxt, migration.id, {"status": "CONFIRMED"})
|
||||
|
||||
# Ensure the new migration is not returned.
|
||||
updated_at = datetime.datetime.utcnow()
|
||||
updated_at = utils.utcnow()
|
||||
values = {"status": "finished", "updated_at": updated_at}
|
||||
migration = db.migration_create(ctxt, values)
|
||||
results = db.migration_get_all_unconfirmed(ctxt, 10)
|
||||
@@ -120,7 +120,7 @@ class DbApiTestCase(test.TestCase):
|
||||
db.instance_update(ctxt, instance.id, {"task_state": None})
|
||||
|
||||
# Ensure the newly rebooted instance is not returned.
|
||||
updated_at = datetime.datetime.utcnow()
|
||||
updated_at = utils.utcnow()
|
||||
values = {"task_state": "rebooting", "updated_at": updated_at}
|
||||
instance = db.instance_create(ctxt, values)
|
||||
results = db.instance_get_all_hung_in_rebooting(ctxt, 10)
|
||||
|
@@ -18,7 +18,6 @@
|
||||
|
||||
import ast
|
||||
import contextlib
|
||||
import datetime
|
||||
import functools
|
||||
import os
|
||||
import re
|
||||
@@ -43,6 +42,7 @@ from nova.tests import fake_network
|
||||
from nova.tests import fake_utils
|
||||
from nova.tests.glance import stubs as glance_stubs
|
||||
from nova.tests.xenapi import stubs
|
||||
from nova import utils
|
||||
from nova.virt.xenapi import connection as xenapi_conn
|
||||
from nova.virt.xenapi import fake as xenapi_fake
|
||||
from nova.virt.xenapi import vm_utils
|
||||
@@ -1398,8 +1398,7 @@ class XenAPIBWUsageTestCase(test.TestCase):
|
||||
self.name = "instance-0001"
|
||||
self.uuid = "1-2-3-4-5"
|
||||
|
||||
result = self.conn.get_all_bw_usage([testinstance()],
|
||||
datetime.datetime.utcnow())
|
||||
result = self.conn.get_all_bw_usage([testinstance()], utils.utcnow())
|
||||
self.assertEqual(result, [])
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user