Ejemplo n.º 1
0
 def test_create_noop_serializer(self):
     noop_task_types = [
         consts.ORCHESTRATOR_TASK_TYPES.skipped,
         consts.ORCHESTRATOR_TASK_TYPES.stage
     ]
     factory = self.factory_class(TransactionContext({}))
     for task_type in noop_task_types:
         task = {'id': 'test', 'type': task_type}
         self.assertIsInstance(factory.create_serializer(task),
                               task_serializer.NoopTaskSerializer)
Ejemplo n.º 2
0
 def test_create_raise_error_if_unknown_type(self):
     unsupported_task_types = [
         consts.ORCHESTRATOR_TASK_TYPES.group,
         consts.ORCHESTRATOR_TASK_TYPES.role
     ]
     factory = self.factory_class(TransactionContext({}))
     for task_type in unsupported_task_types:
         task = {'id': 'test', 'type': task_type}
         with self.assertRaises(errors.SerializerNotSupported):
             factory.create_serializer(task)
Ejemplo n.º 3
0
    def test_create_serializer_for_generic(self):
        common_task_types = set(consts.ORCHESTRATOR_TASK_TYPES)
        common_task_types.discard(consts.ORCHESTRATOR_TASK_TYPES.role)
        common_task_types.discard(consts.ORCHESTRATOR_TASK_TYPES.skipped)
        common_task_types.discard(consts.ORCHESTRATOR_TASK_TYPES.stage)
        common_task_types.discard(consts.ORCHESTRATOR_TASK_TYPES.group)

        factory = self.factory_class(TransactionContext({}))
        for task_type in common_task_types:
            task = {'id': 'test', 'type': task_type}
            self.assertIsInstance(factory.create_serializer(task),
                                  task_serializer.DefaultTaskSerializer)
Ejemplo n.º 4
0
 def setUpClass(cls):
     cls.transaction = TransactionContext(
         {
             '1': {
                 'cluster': {'id': 1},
                 'release': {'version': 'liberty-9.0'},
                 'openstack_version': 'liberty-9.0',
                 'public_ssl': {'hostname': 'localhost'},
                 'attribute': '1'
             }
         }
     )
     cls.context = task_serializer.Context(cls.transaction)
Ejemplo n.º 5
0
 def setUpClass(cls):
     cls.context = task_serializer.Context(TransactionContext({
         '1': {
             'cluster': {'id': 1},
             'release': {'version': 'liberty-9.0'},
             'openstack_version': 'liberty-9.0',
             'public_ssl': {'hostname': 'localhost'},
             'attributes': {
                 'a_str': 'text1',
                 'a_int': 1
             }
         },
         '2': {
             'cluster': {'id': 2},
             'release': {'version': 'liberty-9.0'},
             'openstack_version': 'liberty-9.0',
             'public_ssl': {'hostname': 'localhost'},
             'attributes': {
                 'a_str': 'text2',
                 'a_int': 2
             }
         }
     }))