Ejemplo n.º 1
0
    def run_filters_applying_test(self):
        supervisor = Supervisor()

        with requests_mock.mock() as m:
            m.post(
                '%s/%s/agent/' % (DEFAULT_API_URL, DEFAULT_API_KEY),
                text=self.mock_request_data
            )

            supervisor.init_object_managers()
            for manager_name in supervisor.object_manager_order:
                supervisor.object_managers[manager_name]._discover_objects()
            nginx_manager = supervisor.object_managers['nginx']
            nginx_obj = nginx_manager.objects.find_all(types=nginx_manager.types)[0]
            assert_that(nginx_obj.filters, has_length(0))

            # talk 1st time
            supervisor.talk_to_cloud(force=True)
            for manager_name in supervisor.object_manager_order:
                supervisor.object_managers[manager_name]._discover_objects()

            nginx_manager = supervisor.object_managers['nginx']
            nginx_obj = nginx_manager.objects.find_all(types=nginx_manager.types)[0]

            assert_that(nginx_obj.filters, has_length(1))
Ejemplo n.º 2
0
    def test_talk_to_cloud(self):
        """
        Checks that we apply all changes from cloud to agent config and object configs
        """
        supervisor = Supervisor()

        with requests_mock.mock() as m:
            m.post(
                '%s/%s/agent/' % (DEFAULT_API_URL, DEFAULT_API_KEY),
                text='{"config": {"cloud": {"push_interval": 30.0, "talk_interval": 60.0, "api_timeout": 10.0}, "containers": {"nginx": {"max_test_duration": 30.0, "run_test": false, "poll_intervals": {"metrics": 20.0, "configs": 20.0, "meta": 30.0, "discover": 10.0, "logs": 10.0}, "upload_ssl": true, "upload_config": true}, "system": {"poll_intervals": {"metrics": 20.0, "meta": 30.0, "discover": 10.0}}}}, "objects": [{"object":{"type":"nginx", "local_id": "b636d4376dea15405589692d3c5d3869ff3a9b26b0e7bb4bb1aa7e658ace1437"}, "config":{"upload_ssl":true}, "filters":[ {"metric": "nginx.http.method.post", "filter_rule_id": 9, "data": [{"$request_uri": "/api/timeseries"}]} ] }], "messages": [], "versions": {"current": 0.29, "old": 0.26, "obsolete": 0.21}}'
            )

            supervisor.init_object_managers()
            for container in supervisor.object_managers.itervalues():
                container._discover_objects()

            old_object_configs = deepcopy(supervisor.object_managers['nginx'].object_configs)

            supervisor.talk_to_cloud(force=True)
            for container in supervisor.object_managers.itervalues():
                container._discover_objects()

            # check that agent config was changed
            assert_that(context.app_config.config, not_(equal_to(self.old_cloud_config)))

            # check that object configs were also changed
            nginx_container = supervisor.object_managers['nginx']
            assert_that(nginx_container.object_configs, not_(equal_to(old_object_configs)))
Ejemplo n.º 3
0
    def run_filters_applying_test(self):
        supervisor = Supervisor()

        supervisor.init_object_managers()
        for manager_name in supervisor.object_manager_order:
            supervisor.object_managers[manager_name]._discover_objects()
        nginx_manager = supervisor.object_managers['nginx']
        nginx_obj = nginx_manager.objects.find_all(
            types=nginx_manager.types)[0]
        assert_that(nginx_obj.filters, has_length(0))

        with requests_mock.mock() as m:
            m.post('%s/%s/agent/' % (DEFAULT_API_URL, DEFAULT_API_KEY),
                   text=self.mock_request_data)

            # talk 1st time
            supervisor.talk_to_cloud(force=True)

        for manager_name in supervisor.object_manager_order:
            supervisor.object_managers[manager_name]._discover_objects()

        nginx_manager = supervisor.object_managers['nginx']
        nginx_obj = nginx_manager.objects.find_all(
            types=nginx_manager.types)[0]

        assert_that(nginx_obj.filters, has_length(1))
Ejemplo n.º 4
0
    def test_filters_applying(self):
        supervisor = Supervisor()

        with requests_mock.mock() as m:
            m.post(
                '%s/%s/agent/' % (DEFAULT_API_URL, DEFAULT_API_KEY),
                text=
                '{"config": {"cloud": {"push_interval": 60.0, "talk_interval": 60.0, "api_timeout": 10.0}, "containers": {"nginx": {"max_test_duration": 30.0, "run_test": false, "poll_intervals": {"metrics": 20.0, "configs": 20.0, "meta": 30.0, "discover": 10.0, "logs": 10.0}, "upload_ssl": true, "upload_config": true}, "system": {"poll_intervals": {"metrics": 20.0, "meta": 30.0, "discover": 10.0}}}}, "objects": [{"object":{"type":"nginx", "root_uuid": "6789abcde", "local_id": "b636d4376dea15405589692d3c5d3869ff3a9b26b0e7bb4bb1aa7e658ace1437"}, "config":{"upload_ssl":true}, "filters":[ {"metric": "nginx.http.method.post", "filter_rule_id": 9, "data": [{"$request_uri": "/api/timeseries"}]} ] }], "messages": [], "versions": {"current": 0.29, "old": 0.26, "obsolete": 0.21}}'
            )

            supervisor.init_object_managers()
            for manager_name in supervisor.object_manager_order:
                supervisor.object_managers[manager_name]._discover_objects()
            nginx_manager = supervisor.object_managers['nginx']
            nginx_obj = nginx_manager.objects.objects[
                nginx_manager.objects.objects_by_type[nginx_manager.type][0]]
            assert_that(nginx_obj.filters, has_length(0))

            # talk 1st time
            supervisor.talk_to_cloud(force=True)
            for manager_name in supervisor.object_manager_order:
                supervisor.object_managers[manager_name]._discover_objects()

            nginx_manager = supervisor.object_managers['nginx']
            nginx_obj = nginx_manager.objects.objects[
                nginx_manager.objects.objects_by_type[nginx_manager.type][0]]

            assert_that(nginx_obj.filters, has_length(1))
Ejemplo n.º 5
0
    def test_talk_to_cloud(self):
        """
        Checks that we apply all changes from cloud to agent config and object configs
        """
        supervisor = Supervisor()

        with requests_mock.mock() as m:
            m.post(
                '%s/%s/agent/' % (DEFAULT_API_URL, DEFAULT_API_KEY),
                text=
                '{"config": {"cloud": {"push_interval": 30.0, "talk_interval": 60.0, "api_timeout": 10.0}, "containers": {"nginx": {"max_test_duration": 30.0, "run_test": false, "poll_intervals": {"metrics": 20.0, "configs": 20.0, "meta": 30.0, "discover": 10.0, "logs": 10.0}, "upload_ssl": true, "upload_config": true}, "system": {"poll_intervals": {"metrics": 20.0, "meta": 30.0, "discover": 10.0}}}}, "objects": [{"object":{"type":"nginx", "local_id": "b636d4376dea15405589692d3c5d3869ff3a9b26b0e7bb4bb1aa7e658ace1437"}, "config":{"upload_ssl":true}, "filters":[ {"metric": "nginx.http.method.post", "filter_rule_id": 9, "data": [["$request_uri", "~", "/api/timeseries"]]} ] }], "messages": [], "versions": {"current": 0.29, "old": 0.26, "obsolete": 0.21}}'
            )

            supervisor.init_object_managers()
            for container in supervisor.object_managers.itervalues():
                container._discover_objects()

            old_object_configs = deepcopy(
                supervisor.object_managers['nginx'].object_configs)

            supervisor.talk_to_cloud(force=True)
            for container in supervisor.object_managers.itervalues():
                container._discover_objects()

            # check that agent config was changed
            assert_that(context.app_config.config,
                        not_(equal_to(self.old_cloud_config)))

            # check that object configs were also changed
            nginx_container = supervisor.object_managers['nginx']
            assert_that(nginx_container.object_configs,
                        not_(equal_to(old_object_configs)))
Ejemplo n.º 6
0
    def test_filters_applying(self):
        supervisor = Supervisor()

        with requests_mock.mock() as m:
            m.post(
                '%s/%s/agent/' % (DEFAULT_API_URL, DEFAULT_API_KEY),
                text='{"config": {"cloud": {"push_interval": 60.0, "talk_interval": 60.0, "api_timeout": 10.0}, "containers": {"nginx": {"max_test_duration": 30.0, "run_test": false, "poll_intervals": {"metrics": 20.0, "configs": 20.0, "meta": 30.0, "discover": 10.0, "logs": 10.0}, "upload_ssl": true, "upload_config": true}, "system": {"poll_intervals": {"metrics": 20.0, "meta": 30.0, "discover": 10.0}}}}, "objects": [{"object":{"type":"nginx", "root_uuid": "6789abcde", "local_id": "b636d4376dea15405589692d3c5d3869ff3a9b26b0e7bb4bb1aa7e658ace1437"}, "config":{"upload_ssl":true}, "filters":[ {"metric": "nginx.http.method.post", "filter_rule_id": 9, "data": [{"$request_uri": "/api/timeseries"}]} ] }], "messages": [], "versions": {"current": 0.29, "old": 0.26, "obsolete": 0.21}}'
            )

            supervisor.init_object_managers()
            for manager_name in supervisor.object_manager_order:
                supervisor.object_managers[manager_name]._discover_objects()
            nginx_manager = supervisor.object_managers['nginx']
            nginx_obj = nginx_manager.objects.objects[
                nginx_manager.objects.objects_by_type[nginx_manager.type][0]]
            assert_that(nginx_obj.filters, has_length(0))

            # talk 1st time
            supervisor.talk_to_cloud(force=True)
            for manager_name in supervisor.object_manager_order:
                supervisor.object_managers[manager_name]._discover_objects()

            nginx_manager = supervisor.object_managers['nginx']
            nginx_obj = nginx_manager.objects.objects[
                nginx_manager.objects.objects_by_type[nginx_manager.type][0]]

            assert_that(nginx_obj.filters, has_length(1))
Ejemplo n.º 7
0
    def test_talk_to_cloud_no_change(self):
        """
        Checks that we apply all changes from cloud to agent config and object configs
        """
        supervisor = Supervisor()

        with requests_mock.mock() as m:
            m.post(
                '%s/%s/agent/' % (DEFAULT_API_URL, DEFAULT_API_KEY),
                text=
                '{"config": {"cloud": {"push_interval": 30.0, "talk_interval": 60.0, "api_timeout": 10.0}, "containers": {"nginx": {"parse_delay": 60.0, "max_test_duration": 30.0, "run_test": true, "poll_intervals": {"metrics": 20.0, "configs": 20.0, "meta": 30.0, "discover": 10.0, "logs": 10.0}, "upload_ssl": true, "upload_config": true}, "system": {"poll_intervals": {"metrics": 20.0, "meta": 30.0, "discover": 10.0}}}}, "objects": [{"object":{"type":"nginx", "local_id": "b636d4376dea15405589692d3c5d3869ff3a9b26b0e7bb4bb1aa7e658ace1437"}, "config":{"upload_ssl":true}, "filters":[ {"metric": "nginx.http.method.post", "filter_rule_id": 9, "data": [["$request_uri", "~", "/api/timeseries"]]} ] }], "messages": [], "versions": {"current": 0.29, "old": 0.26, "obsolete": 0.21}}'
            )

            supervisor.init_object_managers()
            for container in supervisor.object_managers.itervalues():
                container._discover_objects()

            # first talk change
            supervisor.talk_to_cloud(force=True)
            for container in supervisor.object_managers.itervalues():
                container._discover_objects()

            time.sleep(1)

            # second talk no change
            old_restart_time = deepcopy(supervisor.last_cloud_talk_restart)
            supervisor.talk_to_cloud(force=True)
            for container in supervisor.object_managers.itervalues():
                container._discover_objects()

            assert_that(supervisor.last_cloud_talk_restart,
                        equal_to(old_restart_time))
Ejemplo n.º 8
0
    def test_load_ext_managers(self):
        supervisor = Supervisor()
        assert_that(supervisor.object_managers, has_length(0))

        # load regular ones
        supervisor.init_object_managers()
        assert_that(supervisor.object_managers, has_length(4))

        # load external ones
        supervisor.load_ext_managers()
        assert_that(supervisor.object_managers, has_length(7))
Ejemplo n.º 9
0
    def test_dont_load_string_false_ext_managers(self):
        context.app_config['extensions'] = dict(phpfpm='False')

        supervisor = Supervisor()
        assert_that(supervisor.object_managers, has_length(0))

        # load regular ones
        supervisor.init_object_managers()
        assert_that(supervisor.object_managers, has_length(4))

        # load external ones
        supervisor.load_ext_managers()
        assert_that(supervisor.object_managers, has_length(4))  # none loaded
Ejemplo n.º 10
0
    def test_dont_load_missing_ext_managers(self):
        context.app_config['extensions'] = {}

        supervisor = Supervisor()
        assert_that(supervisor.object_managers, has_length(0))

        # load regular ones
        supervisor.init_object_managers()
        assert_that(supervisor.object_managers, has_length(4))

        # load external ones
        supervisor.load_ext_managers()
        assert_that(supervisor.object_managers, has_length(4))  # non loaded
Ejemplo n.º 11
0
    def test_load_ext_managers(self):
        supervisor = Supervisor()
        assert_that(supervisor.object_managers, has_length(0))

        # load regular ones
        supervisor.init_object_managers()
        assert_that(supervisor.object_managers, has_length(4))

        # load external ones
        supervisor.load_ext_managers()
        assert_that(supervisor.object_managers, has_length(7))

        # check indexed configs
        assert_that(context.app_config._configs, has_length(2))
Ejemplo n.º 12
0
    def test_load_ext_managers(self):
        supervisor = Supervisor()
        assert_that(supervisor.object_managers, has_length(0))

        for name in ('configurator', 'mysql', 'phpfpm'):
            context.capabilities[name] = True

        # load regular ones
        supervisor.init_object_managers()
        assert_that(supervisor.object_managers, has_length(4))

        # load external ones
        supervisor.load_ext_managers()
        assert_that(supervisor.object_managers, has_length(7))

        # check indexed configs
        assert_that(context.app_config._configs, has_length(2))
Ejemplo n.º 13
0
    def test_enable_ext_managers_from_backend(self):
        supervisor = Supervisor()
        assert_that(supervisor.object_managers, has_length(0))

        with requests_mock.mock() as m:
            m.post(
                '%s/%s/agent/' % (DEFAULT_API_URL, DEFAULT_API_KEY),
                text=
                '{"config": {"cloud": {"push_interval": 30.0, "talk_interval": 60.0, "api_timeout": 10.0}, "containers": {"nginx": {"parse_delay": 60.0, "max_test_duration": 30.0, "run_test": true, "poll_intervals": {"metrics": 20.0, "configs": 20.0, "meta": 30.0, "discover": 10.0, "logs": 10.0}, "upload_ssl": true, "upload_config": true}, "system": {"poll_intervals": {"metrics": 20.0, "meta": 30.0, "discover": 10.0}}}}, "objects": [{"object":{"type":"nginx", "local_id": "b636d4376dea15405589692d3c5d3869ff3a9b26b0e7bb4bb1aa7e658ace1437"}, "config":{"upload_ssl":true}, "filters":[ {"metric": "nginx.http.method.post", "filter_rule_id": 9, "data": [["$request_uri", "~", "/api/timeseries"]]} ] }], "messages": [], "versions": {"current": 0.29, "old": 0.26, "obsolete": 0.21}, "capabilities": {"php-fpm": true}}'
            )
            supervisor.talk_to_cloud(force=True)

        # load regular ones
        supervisor.init_object_managers()
        assert_that(supervisor.object_managers, has_length(6))

        # load external ones
        supervisor.load_ext_managers()
        assert_that(supervisor.object_managers, has_length(6))
        # only phpfpm (and phpfpm-pool) loaded

        # check indexed configs
        assert_that(context.app_config._configs, has_length(1))
Ejemplo n.º 14
0
    def test_filters_unchanged(self):
        """
        Checks that agent is able to determine filters changes
        """
        supervisor = Supervisor()

        with requests_mock.mock() as m:
            m.post(
                '%s/%s/agent/' % (DEFAULT_API_URL, DEFAULT_API_KEY),
                text='{"config": {"cloud": {"push_interval": 60.0, "talk_interval": 60.0, "api_timeout": 15.0}, "containers": {"nginx": {"max_test_duration": 30.0, "run_test": false, "poll_intervals": {"metrics": 20.0, "configs": 20.0, "meta": 30.0, "discover": 10.0, "logs": 10.0}, "upload_ssl": true, "upload_config": true}, "system": {"poll_intervals": {"metrics": 20.0, "meta": 30.0, "discover": 10.0}}}}, "objects": [{"object":{"type":"nginx", "root_uuid": "6789abcde", "local_id": "b636d4376dea15405589692d3c5d3869ff3a9b26b0e7bb4bb1aa7e658ace1437"}, "config":{"upload_ssl":true}, "filters":[ {"metric": "nginx.http.method.post", "filter_rule_id": 9, "data": [{"$request_uri": "/api/timeseries"}]} ] }], "messages": [], "versions": {"current": 0.29, "old": 0.26, "obsolete": 0.21}}'
            )

            supervisor.init_object_managers()
            for object_manager_name in supervisor.object_manager_order:
                object_manager = supervisor.object_managers[object_manager_name]
                object_manager._discover_objects()
            old_nginx_configs = deepcopy(supervisor.object_managers['nginx'].object_configs)

            # talk 1st time - everything changes
            supervisor.talk_to_cloud(force=True)
            for container in supervisor.object_managers.itervalues():
                container._discover_objects()

            # check that agent config was changed
            assert_that(context.app_config.config, not_(equal_to(self.old_cloud_config)))
            self.old_cloud_config = deepcopy(context.app_config.config)

            # check that object configs were also changed (because filters were pushed)
            nginx_container = supervisor.object_managers['nginx']
            assert_that(nginx_container.object_configs, not_(equal_to(old_nginx_configs)))

            # talk 2nd time - changes again (filters)
            supervisor.talk_to_cloud(force=True)
            for object_manager_name in supervisor.object_manager_order:
                object_manager = supervisor.object_managers[object_manager_name]
                object_manager._discover_objects()

            # save some vars to check later
            old_nginx_configs = deepcopy(nginx_container.object_configs)
            nginx_object_init_time = supervisor.object_managers['nginx'].objects.objects[5].init_time

            time.sleep(2)

            # talk 3nd time - no change
            supervisor.talk_to_cloud(force=True)
            for object_manager_name in supervisor.object_manager_order:
                object_manager = supervisor.object_managers[object_manager_name]
                object_manager._discover_objects()

            # check that agent config was not changed
            assert_that(context.app_config.config, equal_to(self.old_cloud_config))

            # check that object configs were not changed
            nginx_container = supervisor.object_managers['nginx']
            assert_that(nginx_container.object_configs, equal_to(old_nginx_configs))

            # check that we still use previously created objects
            assert_that(
                supervisor.object_managers['nginx'].objects.objects[5].init_time,
                equal_to(nginx_object_init_time)
            )
Ejemplo n.º 15
0
    def test_filters_unchanged(self):
        """
        Checks that agent is able to determine filters changes
        """
        supervisor = Supervisor()

        supervisor.init_object_managers()
        for object_manager_name in supervisor.object_manager_order:
            object_manager = supervisor.object_managers[object_manager_name]
            object_manager._discover_objects()
        old_nginx_configs = deepcopy(
            supervisor.object_managers['nginx'].object_configs)

        with requests_mock.mock() as m:
            m.post(
                '%s/%s/agent/' % (DEFAULT_API_URL, DEFAULT_API_KEY),
                text=
                '{"config": {"cloud": {"push_interval": 60.0, "talk_interval": 60.0, "api_timeout": 15.0}, "containers": {"nginx": {"parse_delay": 0, "max_test_duration": 30.0, "run_test": true, "poll_intervals": {"metrics": 20.0, "configs": 20.0, "meta": 30.0, "discover": 10.0, "logs": 10.0}, "upload_ssl": true, "upload_config": true}, "system": {"poll_intervals": {"metrics": 20.0, "meta": 30.0, "discover": 10.0}}}}, "objects": [{"object":{"type":"nginx", "root_uuid": "6789abcde", "local_id": "b636d4376dea15405589692d3c5d3869ff3a9b26b0e7bb4bb1aa7e658ace1437"}, "config":{"upload_ssl":true}, "filters":[ {"metric": "nginx.http.method.post", "filter_rule_id": 9, "data": [["$request_uri", "~", "/api/timeseries"]]} ] }], "messages": [], "versions": {"current": 0.29, "old": 0.26, "obsolete": 0.21}}'
            )

            # talk 1st time - everything changes
            supervisor.talk_to_cloud(force=True)

        for manager in supervisor.object_managers.itervalues():
            manager._discover_objects()

        # check that agent config was changed
        assert_that(context.app_config.config,
                    not_(equal_to(self.old_cloud_config)))
        self.old_cloud_config = deepcopy(context.app_config.config)

        # check that object configs were also changed (because filters were pushed)
        nginx_manager = supervisor.object_managers['nginx']
        assert_that(nginx_manager.object_configs,
                    not_(equal_to(old_nginx_configs)))

        with requests_mock.mock() as m:
            m.post(
                '%s/%s/agent/' % (DEFAULT_API_URL, DEFAULT_API_KEY),
                text=
                '{"config": {"cloud": {"push_interval": 60.0, "talk_interval": 60.0, "api_timeout": 15.0}, "containers": {"nginx": {"parse_delay": 0, "max_test_duration": 30.0, "run_test": true, "poll_intervals": {"metrics": 20.0, "configs": 20.0, "meta": 30.0, "discover": 10.0, "logs": 10.0}, "upload_ssl": true, "upload_config": true}, "system": {"poll_intervals": {"metrics": 20.0, "meta": 30.0, "discover": 10.0}}}}, "objects": [{"object":{"type":"nginx", "root_uuid": "6789abcde", "local_id": "b636d4376dea15405589692d3c5d3869ff3a9b26b0e7bb4bb1aa7e658ace1437"}, "config":{"upload_ssl":true}, "filters":[ {"metric": "nginx.http.method.post", "filter_rule_id": 9, "data": [["$request_uri", "~", "/api/timeseries"]]} ] }], "messages": [], "versions": {"current": 0.29, "old": 0.26, "obsolete": 0.21}}'
            )

            # talk 2nd time - changes again (filters)
            supervisor.talk_to_cloud(force=True)
            for object_manager_name in supervisor.object_manager_order:
                object_manager = supervisor.object_managers[
                    object_manager_name]
                object_manager._discover_objects()

            # save some vars to check later
            old_nginx_configs = deepcopy(nginx_manager.object_configs)
            nginx_object_init_time = supervisor.object_managers[
                'nginx'].objects.objects[4].init_time

            time.sleep(2)

            # talk 3nd time - no change
            supervisor.talk_to_cloud(force=True)

        for object_manager_name in supervisor.object_manager_order:
            object_manager = supervisor.object_managers[object_manager_name]
            object_manager._discover_objects()

        # check that agent config was not changed
        assert_that(context.app_config.config, equal_to(self.old_cloud_config))

        # check that object configs were not changed
        nginx_manager = supervisor.object_managers['nginx']
        assert_that(nginx_manager.object_configs, equal_to(old_nginx_configs))

        # check that we still use previously created objects
        print supervisor.object_managers['nginx'].objects.objects
        assert_that(
            supervisor.object_managers['nginx'].objects.objects[4].init_time,
            equal_to(nginx_object_init_time))
Ejemplo n.º 16
0
    def test_talk_to_cloud_container_change(self):
        """
        Checks that we detect changes from manager
        """
        supervisor = Supervisor()

        # TODO: managers -> nginx -> run_test must be in this order
        #       (true/false rather than false/true) breaks this test.

        supervisor.init_object_managers()
        for manager in supervisor.object_managers.itervalues():
            manager._discover_objects()

        with requests_mock.mock() as m:
            m.post(
                '%s/%s/agent/' % (DEFAULT_API_URL, DEFAULT_API_KEY),
                text=
                '{"config": {"cloud": {"push_interval": 30.0, "talk_interval": 60.0, "api_timeout": 10.0}, "containers": {"nginx": {"parse_delay": 60.0, "max_test_duration": 30.0, "run_test": true, "poll_intervals": {"metrics": 20.0, "configs": 20.0, "meta": 30.0, "discover": 10.0, "logs": 10.0}, "upload_ssl": true, "upload_config": true}, "system": {"poll_intervals": {"metrics": 20.0, "meta": 30.0, "discover": 10.0}}}}, "objects": [{"object":{"type":"nginx", "local_id": "b636d4376dea15405589692d3c5d3869ff3a9b26b0e7bb4bb1aa7e658ace1437"}, "config":{"upload_ssl":true}, "filters":[ {"metric": "nginx.http.method.post", "filter_rule_id": 9, "data": [["$request_uri", "~", "/api/timeseries"]]} ] }], "messages": [], "versions": {"current": 0.29, "old": 0.26, "obsolete": 0.21}}'
            )

            # first talk change
            supervisor.talk_to_cloud(force=True)

        for manager in supervisor.object_managers.itervalues():
            manager._discover_objects()

        time.sleep(1)

        with requests_mock.mock() as m:
            m.post(
                '%s/%s/agent/' % (DEFAULT_API_URL, DEFAULT_API_KEY),
                text=
                '{"config": {"cloud": {"push_interval": 30.0, "talk_interval": 60.0, "api_timeout": 10.0}, "containers": {"nginx": {"parse_delay": 60.0, "max_test_duration": 30.0, "run_test": true, "poll_intervals": {"metrics": 20.0, "configs": 20.0, "meta": 30.0, "discover": 10.0, "logs": 10.0}, "upload_ssl": true, "upload_config": true}, "system": {"poll_intervals": {"metrics": 20.0, "meta": 30.0, "discover": 10.0}}}}, "objects": [{"object":{"type":"nginx", "local_id": "b636d4376dea15405589692d3c5d3869ff3a9b26b0e7bb4bb1aa7e658ace1437"}, "config":{"upload_ssl":true}, "filters":[ {"metric": "nginx.http.method.post", "filter_rule_id": 9, "data": [["$request_uri", "~", "/api/timeseries"]]} ] }], "messages": [], "versions": {"current": 0.29, "old": 0.26, "obsolete": 0.21}}'
            )

            # second talk no change
            old_restart_time = deepcopy(supervisor.last_cloud_talk_restart)
            supervisor.talk_to_cloud(force=True)

        for manager in supervisor.object_managers.itervalues():
            manager._discover_objects()

        assert_that(supervisor.last_cloud_talk_restart,
                    equal_to(old_restart_time))

        with requests_mock.mock() as m:
            m.post(
                '%s/%s/agent/' % (DEFAULT_API_URL, DEFAULT_API_KEY),
                text=
                '{"config": {"cloud": {"push_interval": 30.0, "talk_interval": 60.0, "api_timeout": 10.0}, "containers": {"nginx": {"parse_delay": 60.0, "max_test_duration": 30.0, "run_test": false, "poll_intervals": {"metrics": 20.0, "configs": 20.0, "meta": 30.0, "discover": 10.0, "logs": 10.0}, "upload_ssl": true, "upload_config": true}, "system": {"poll_intervals": {"metrics": 20.0, "meta": 30.0, "discover": 10.0}}}}, "objects": [{"object":{"type":"nginx", "local_id": "b636d4376dea15405589692d3c5d3869ff3a9b26b0e7bb4bb1aa7e658ace1437"}, "config":{"upload_ssl":true}, "filters":[ {"metric": "nginx.http.method.post", "filter_rule_id": 9, "data": [["$request_uri", "~", "/api/timeseries"]]} ] }], "messages": [], "versions": {"current": 0.29, "old": 0.26, "obsolete": 0.21}}'
            )

            old_object_configs = deepcopy(
                supervisor.object_managers['nginx'].object_configs)

            time.sleep(1)

            # third talk change to manager only
            old_restart_time = deepcopy(supervisor.last_cloud_talk_restart)
            supervisor.talk_to_cloud(force=True)

        for manager in supervisor.object_managers.itervalues():
            manager._discover_objects()

        assert_that(supervisor.last_cloud_talk_restart,
                    not_(equal_to(old_restart_time)))

        # check that object configs not changed
        nginx_manager = supervisor.object_managers['nginx']
        assert_that(nginx_manager.object_configs, equal_to(old_object_configs))