Commit c642e618 authored by Spiros Koulouzis's avatar Spiros Koulouzis

fix run tests

parent 6f7c2d0c
...@@ -3,9 +3,11 @@ ...@@ -3,9 +3,11 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="462ede19-adfe-472b-975e-fefefa973fe0" name="Default Changelist" comment=""> <list default="true" id="462ede19-adfe-472b-975e-fefefa973fe0" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../openAPI/TOSCA/OutputParameters.yml" beforeDir="false" afterPath="$PROJECT_DIR$/../openAPI/TOSCA/OutputParameters.yml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/planner/planner.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/planner/planner.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/controllers/default_controller.py" beforeDir="false" afterPath="$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/controllers/default_controller.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/planner/simple_spec_alayzer.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/planner/simple_spec_alayzer.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/service/tosca_template_service.py" beforeDir="false" afterPath="$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/service/tosca_template_service.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/planner/specification_analyzer.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/planner/specification_analyzer.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/rpc_server.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/rpc_server.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/tests/test_planner.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/tests/test_planner.py" afterDir="false" />
</list> </list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
...@@ -38,7 +40,7 @@ ...@@ -38,7 +40,7 @@
<property name="TODO_SCOPE" value="All Places" /> <property name="TODO_SCOPE" value="All Places" />
<property name="full.screen.before.presentation.mode" value="false" /> <property name="full.screen.before.presentation.mode" value="false" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../drip-deployer" /> <property name="last_opened_file_path" value="$PROJECT_DIR$/../drip-deployer" />
<property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" /> <property name="settings.editor.selected.configurable" value="project.propDebugger" />
</component> </component>
<component name="RecentsManager"> <component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS"> <key name="MoveFile.RECENT_KEYS">
...@@ -141,8 +143,8 @@ ...@@ -141,8 +143,8 @@
<recent_temporary> <recent_temporary>
<list> <list>
<item itemvalue="Python.rpc_server" /> <item itemvalue="Python.rpc_server" />
<item itemvalue="Python tests.Unittests in tests" />
<item itemvalue="Python.test_planner" /> <item itemvalue="Python.test_planner" />
<item itemvalue="Python tests.Unittests in tests" />
<item itemvalue="Python.basic_planner" /> <item itemvalue="Python.basic_planner" />
</list> </list>
</recent_temporary> </recent_temporary>
...@@ -336,11 +338,6 @@ ...@@ -336,11 +338,6 @@
<line>64</line> <line>64</line>
<option name="timeStamp" value="1" /> <option name="timeStamp" value="1" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/src/rpc_server.py</url>
<line>105</line>
<option name="timeStamp" value="302" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line"> <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/venv/lib/python3.6/site-packages/toscaparser/elements/scalarunit.py</url> <url>file://$PROJECT_DIR$/venv/lib/python3.6/site-packages/toscaparser/elements/scalarunit.py</url>
<line>71</line> <line>71</line>
......
...@@ -5,11 +5,10 @@ from toscaparser.topology_template import TopologyTemplate ...@@ -5,11 +5,10 @@ from toscaparser.topology_template import TopologyTemplate
import operator import operator
from src.planner.simple_spec_alayzer import SimpleAnalyzer from planner.simple_spec_alayzer import SimpleAnalyzer
from src.planner.spec_service import * from utils.tosca_helper import *
from src.utils.tosca_helper import * from planner.specification_analyzer import *
from src.planner.specification_analyzer import * from utils import tosca_helper as tosca_util
from src.utils import tosca_helper as tosca_util
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
......
...@@ -3,8 +3,8 @@ import copy ...@@ -3,8 +3,8 @@ import copy
from toscaparser.nodetemplate import NodeTemplate from toscaparser.nodetemplate import NodeTemplate
from toscaparser.properties import Property from toscaparser.properties import Property
from src.utils import tosca_helper as tosca_util from utils import tosca_helper as tosca_util
from src.planner.specification_analyzer import SpecificationAnalyzer from planner.specification_analyzer import SpecificationAnalyzer
import networkx as nx import networkx as nx
import logging import logging
......
...@@ -3,7 +3,6 @@ from abc import abstractmethod, ABCMeta ...@@ -3,7 +3,6 @@ from abc import abstractmethod, ABCMeta
from toscaparser.tosca_template import ToscaTemplate from toscaparser.tosca_template import ToscaTemplate
import networkx as nx import networkx as nx
from src.utils import tosca_helper as tosca_util
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
......
...@@ -78,9 +78,10 @@ def handle_delivery(message): ...@@ -78,9 +78,10 @@ def handle_delivery(message):
tosca_folder_path = os.path.join(tempfile.gettempdir(), "planner_files", str(input_current_milli_time())) tosca_folder_path = os.path.join(tempfile.gettempdir(), "planner_files", str(input_current_milli_time()))
except NameError: except NameError:
import sys import sys
millis = int(round(time.time() * 1000))
tosca_folder_path = os.path.dirname(os.path.abspath(sys.argv[0])) + os.path.join(tempfile.gettempdir(), tosca_folder_path = os.path.dirname(os.path.abspath(sys.argv[0])) + os.path.join(tempfile.gettempdir(),
"planner_files", "planner_files",
str(current_milli_time())) str(millis))
if not os.path.exists(tosca_folder_path): if not os.path.exists(tosca_folder_path):
os.makedirs(tosca_folder_path) os.makedirs(tosca_folder_path)
...@@ -110,7 +111,7 @@ def handle_delivery(message): ...@@ -110,7 +111,7 @@ def handle_delivery(message):
if __name__ == "__main__": if __name__ == "__main__":
logging.basicConfig(level=logging.INFO) logging.basicConfig(level=logging.INFO)
if sys.argv[1] == "test_local": if sys.argv[1] == "test_local":
tosca_path = "../../TOSCA/" tosca_path = "../TOSCA/"
input_tosca_file_path = tosca_path + '/application_example_2_topologies.yaml' input_tosca_file_path = tosca_path + '/application_example_2_topologies.yaml'
conf = {'url': "http://host"} conf = {'url': "http://host"}
spec_service = SpecService(conf) spec_service = SpecService(conf)
...@@ -118,7 +119,7 @@ if __name__ == "__main__": ...@@ -118,7 +119,7 @@ if __name__ == "__main__":
test_tosca_template = test_planner.resolve_requirements() test_tosca_template = test_planner.resolve_requirements()
test_tosca_template = test_planner.set_infrastructure_specifications() test_tosca_template = test_planner.set_infrastructure_specifications()
template_dict = tosca_util.get_tosca_template_2_topology_template_dictionary(test_tosca_template) template_dict = tosca_util.get_tosca_template_2_topology_template_dictionary(test_tosca_template)
# logger.info("template ----: \n" + yaml.dump(template)) logger.info("template ----: \n" + yaml.dump(template_dict))
try: try:
tosca_folder_path = os.path.join(tempfile.gettempdir(), tosca_path) tosca_folder_path = os.path.join(tempfile.gettempdir(), tosca_path)
...@@ -128,7 +129,7 @@ if __name__ == "__main__": ...@@ -128,7 +129,7 @@ if __name__ == "__main__":
tosca_folder_path = os.path.dirname(os.path.abspath(sys.argv[0])) + os.path.join(tempfile.gettempdir(), tosca_folder_path = os.path.dirname(os.path.abspath(sys.argv[0])) + os.path.join(tempfile.gettempdir(),
tosca_path) tosca_path)
tosca_file_name = 'tosca_template' tosca_file_name = 'tosca_template'
input_tosca_file_path = tosca_path + '/application_example_output.yaml' input_tosca_file_path = tosca_path + '/application_example_2_topologies.yaml'
with open(input_tosca_file_path, 'w') as outfile: with open(input_tosca_file_path, 'w') as outfile:
outfile.write(yaml.dump(template_dict)) outfile.write(yaml.dump(template_dict))
......
...@@ -15,7 +15,7 @@ class MyTestCase(unittest.TestCase): ...@@ -15,7 +15,7 @@ class MyTestCase(unittest.TestCase):
def test_something(self): def test_something(self):
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
tosca_path = "../../../TOSCA/" tosca_path = "../../../TOSCA/"
input_tosca_file_path = tosca_path + '/application_example.yaml' input_tosca_file_path = tosca_path + '/application_example_2_topologies.yaml'
dir_path = os.path.dirname(os.path.realpath(__file__)) dir_path = os.path.dirname(os.path.realpath(__file__))
print(dir_path) print(dir_path)
......
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