def test_check_cpu_usage_gets_nova_usage(tenant, keystone, nova, now): with freeze_time(now): update_expiry.check_cpu_usage(keystone, nova, tenant) nova.usage.get.assert_called_with( tenant.id, datetime.datetime(2011, 1, 1, 0, 0), now + datetime.timedelta(days=1))
def test_check_cpu_usage(percentage, expected_limit, tenant, keystone, nova, usage): usage.total_vcpus_usage = USAGE_LIMIT_HOURS * percentage - 1 limit = update_expiry.check_cpu_usage(keystone, nova, tenant) assert limit == expected_limit