[GITLAB] - UPGRADE TO v12 on Wednesday the 18th of December at 11.30AM

Commit 72a9a9db authored by Daniele Venzano's avatar Daniele Venzano

Fix unit tests

parent c184ec1e
......@@ -24,7 +24,7 @@ import jsonschema
from zoe_lib.exceptions import InvalidApplicationDescription, ZoeLibException
import zoe_lib.version
from zoe_lib.config import get_conf
import zoe_lib.config
log = logging.getLogger(__name__)
......@@ -57,7 +57,7 @@ def app_validate(data):
if service['monitor']:
found_monitor = True
service['resources']['memory']['max'] = get_conf().max_memory_limit * (1024 ** 3)
service['resources']['memory']['max'] = zoe_lib.config.get_conf().max_memory_limit * (1024 ** 3)
if service['resources']['memory']['min'] is not None and service['resources']['memory']['min'] > service['resources']['memory']['max']:
raise InvalidApplicationDescription(msg='service {} tries to reserve more memory than the administrative limit'.format(service['name']))
......@@ -17,13 +17,25 @@
import json
import pytest
from collections import namedtuple
from zoe_lib import applications
ConfigMockup = namedtuple('ConfigMockup', ['max_core_limit', 'max_memory_limit'])
def fake_get_conf():
"""Mock-up for the config.get_conf() method."""
return ConfigMockup(16, 64)
class TestApplicationsMethods:
"""Application validation tests."""
def mock_config(self, monkeypatch):
monkeypatch.setattr('zoe_lib.config.get_conf', fake_get_conf)
def test_pass_for_zapp(self):
"""Test zapp validation code."""
zapp_fp = json.load(open('tests/zapp.json', 'r'))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment