Exemplo n.º 1
0
    def test_meta_collect(self):
        meta_collector = PlusObjectMetaCollector(object=self.plus_obj)
        meta_collector.collect()

        meta = self.plus_obj.metad.current
        assert_that(meta, equal_to(
            {
                'type': 'nginx_plus',
                'local_name': 'test_obj',
                'local_id': 'a9b8f9caa98ee30806a4a7c17ba393330059317600d768e4c81b2d585f7b9a6a',
                'root_uuid': 'root123',
                'hostname': context.hostname,
                'version': None  # Version will fail because this test is done in a vacuum without parent nginx
            }
        ))
Exemplo n.º 2
0
    def test_meta_collect(self):
        meta_collector = PlusObjectMetaCollector(object=self.plus_obj)
        meta_collector.collect()

        meta = self.plus_obj.metad.current
        assert_that(
            meta,
            equal_to({
                'type': 'nginx_plus',
                'local_name': 'test_obj',
                'local_id':
                'a9b8f9caa98ee30806a4a7c17ba393330059317600d768e4c81b2d585f7b9a6a',
                'root_uuid': 'root123',
                'hostname': context.hostname,
                'version':
                None  # Version will fail because this test is done in a vacuum without parent nginx
            }))
Exemplo n.º 3
0
    def __init__(self, **kwargs):
        super(PlusObject, self).__init__(**kwargs)

        # Reset intervals to standardize intervals for all Plus objects
        self.intervals = context.app_config['containers']['plus'][
            'poll_intervals']

        self.root_uuid = context.uuid
        self.parent_local_id = self.data['parent_local_id']
        self.local_name = self.data['local_name']
        self.name = self.local_name
        self.plus_status_internal_url_cache = None

        self.collectors = [
            PlusObjectMetaCollector(object=self,
                                    interval=self.intervals['meta'])
        ]
Exemplo n.º 4
0
    def __init__(self, **kwargs):
        super(PlusObject, self).__init__(**kwargs)

        # Reset intervals to standardize intervals for all Plus objects
        self.intervals = context.app_config['containers']['plus'][
            'poll_intervals']

        # TODO: Refactor root_uuid as a general property that queries root object from context. Perhaps cache like local_id.
        self.root_uuid = self.data.get('root_uuid') or (
            context.objects.root_object.uuid
            if context.objects.root_object else None)
        self.parent_local_id = self.data['parent_local_id']
        self.local_name = self.data['local_name']

        self.plus_status_internal_url_cache = None

        self.collectors = [
            PlusObjectMetaCollector(object=self,
                                    interval=self.intervals['meta'])
        ]