You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ariatosca.apache.org by em...@apache.org on 2017/07/05 21:01:55 UTC

[4/6] incubator-ariatosca git commit: ARIA-254 Scaling capabilities and policies

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/9d99fed0/tests/modeling/test_models.py
----------------------------------------------------------------------
diff --git a/tests/modeling/test_models.py b/tests/modeling/test_models.py
index bbc7352..e1167fc 100644
--- a/tests/modeling/test_models.py
+++ b/tests/modeling/test_models.py
@@ -509,19 +509,15 @@ class TestServiceModification(object):
 
 class TestNodeTemplate(object):
     @pytest.mark.parametrize(
-        'is_valid, name, default_instances, max_instances, min_instances, properties',
+        'is_valid, name, properties',
         [
-            (False, m_cls, 1, 1, 1, {}),
-            (False, 'name', m_cls, 1, 1, {}),
-            (False, 'name', 1, m_cls, 1, {}),
-            (False, 'name', 1, 1, m_cls, {}),
-            (False, 'name', 1, 1, 1, m_cls),
+            (False, m_cls, {}),
+            (False, 'name', m_cls),
 
-            (True, 'name', 1, 1, 1, {}),
+            (True, 'name', {}),
         ]
     )
-    def test_node_template_model_creation(self, service_storage, is_valid, name, default_instances,
-                                          max_instances, min_instances, properties):
+    def test_node_template_model_creation(self, service_storage, is_valid, name, properties):
         node_template = _test_model(
             is_valid=is_valid,
             storage=service_storage,
@@ -529,9 +525,6 @@ class TestNodeTemplate(object):
             model_kwargs=dict(
                 name=name,
                 type=service_storage.type.list()[0],
-                default_instances=default_instances,
-                max_instances=max_instances,
-                min_instances=min_instances,
                 properties=properties,
                 service_template=service_storage.service_template.list()[0]
             ))
@@ -620,9 +613,6 @@ class TestNodeHostAddress(object):
         kwargs = dict(
             name='node_template',
             type=storage.type.list()[0],
-            default_instances=1,
-            max_instances=1,
-            min_instances=1,
             service_template=storage.service_template.list()[0]
         )
         if host_address:

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/9d99fed0/tests/orchestrator/context/test_operation.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/context/test_operation.py b/tests/orchestrator/context/test_operation.py
index 9550d12..111e121 100644
--- a/tests/orchestrator/context/test_operation.py
+++ b/tests/orchestrator/context/test_operation.py
@@ -466,7 +466,7 @@ def operation_common(ctx, holder):
     holder['actor_name'] = ctx.task.actor.name
     holder['task_name'] = ctx.task.name
     holder['function'] = ctx.task.function
-    holder['arguments'] = dict(i.unwrapped for i in ctx.task.arguments.values())
+    holder['arguments'] = dict(i.unwrapped for i in ctx.task.arguments.itervalues())
 
 
 @operation

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/9d99fed0/tests/resources/service-templates/tosca-simple-1.0/node-cellar/node-cellar.yaml
----------------------------------------------------------------------
diff --git a/tests/resources/service-templates/tosca-simple-1.0/node-cellar/node-cellar.yaml b/tests/resources/service-templates/tosca-simple-1.0/node-cellar/node-cellar.yaml
index a34301c..2d39967 100644
--- a/tests/resources/service-templates/tosca-simple-1.0/node-cellar/node-cellar.yaml
+++ b/tests/resources/service-templates/tosca-simple-1.0/node-cellar/node-cellar.yaml
@@ -155,7 +155,7 @@ topology_template:
         capabilities:
           - scalable:
               properties:
-                - max_instances: { greater_or_equal: 8 }
+                - max_instances: { greater_or_equal: 5 }
 
     mongodb:
       description: >-
@@ -171,7 +171,7 @@ topology_template:
               capabilities:
                 - scalable:
                     properties:
-                      - max_instances: { greater_or_equal: 8 }
+                      - max_instances: { greater_or_equal: 5 }
             relationship:
               interfaces:
                 Configure:
@@ -225,7 +225,7 @@ topology_template:
       capabilities:
         scalable:
           properties:
-            max_instances: 10
+            max_instances: 5 # overrides the policy
 
     data_host:
       copy: loadbalancer_host
@@ -246,7 +246,7 @@ topology_template:
       capabilities:
         scalable:
           properties:
-            max_instances: 10
+            max_instances: 6 # overrides the policy
 
     data_volume:
       type: openstack.Volume
@@ -273,10 +273,21 @@ topology_template:
 
   policies:
   
-    scaling:
+    app_scaling:
+      type: aria.Scaling
+      properties:
+        max_instances: 10
+        default_instances: 2
+      targets:
+        - node_cellar
+        - nodejs
+  
+    host_scaling:
       type: openstack.Scaling
       properties:
         bandwidth_threshold: 2 GB
+        max_instances: 10
+        default_instances: 2
       targets: # node templates or groups
         - node_cellar_group
     

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/9d99fed0/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/nodejs.yaml
----------------------------------------------------------------------
diff --git a/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/nodejs.yaml b/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/nodejs.yaml
index 4fd4e72..19cc7b9 100644
--- a/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/nodejs.yaml
+++ b/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/nodejs.yaml
@@ -51,6 +51,7 @@ node_types:
       host: # @override
         type: tosca.capabilities.Container
         valid_source_types: [ nodejs.Application ]
+        occurrences: [ 0, 1 ]
 
   nodejs.Application:
     derived_from: tosca.nodes.WebApplication

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/9d99fed0/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/openstack.yaml
----------------------------------------------------------------------
diff --git a/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/openstack.yaml b/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/openstack.yaml
index de5fb47..99ee902 100644
--- a/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/openstack.yaml
+++ b/tests/resources/service-templates/tosca-simple-1.0/node-cellar/types/openstack.yaml
@@ -15,6 +15,7 @@
 
 imports:
   - os.yaml
+  - aria-1.0
 
 dsl_definitions:
 
@@ -169,7 +170,7 @@ policy_types:
   openstack.Scaling:
     description: >-
       OpenStack scaling policy.
-    derived_from: tosca.policies.Scaling
+    derived_from: aria.Scaling
     properties:
       bandwidth_threshold:
         type: scalar-unit.size