コード例 #1
0
ファイル: test_config.py プロジェクト: serverdensity/sd-agent
    def test_conf_path_to_check_name(self, *args):
        """
        Resolve the check name from the full path.

        Note: Support Unix & Windows systems
        """
        # Samples
        check_name = u"haproxy"
        unix_check_path = u"/etc/dd-agent/conf.d/haproxy.yaml"
        win_check_path = u"C:\\ProgramData\\Datadog\\conf.d\\haproxy.yaml"
        with mock.patch("config.os.path.splitext", side_effect=ntpath.splitext):
            with mock.patch("config.os.path.split", side_effect=ntpath.split):
                self.assertEquals(_conf_path_to_check_name(win_check_path), check_name)
        self.assertEquals(_conf_path_to_check_name(unix_check_path), check_name)
コード例 #2
0
ファイル: test_config.py プロジェクト: wjsl/dd-agent
    def test_conf_path_to_check_name(self, *args):
        """
        Resolve the check name from the full path.

        Note: Support Unix & Windows systems
        """
        # Samples
        check_name = u"haproxy"
        unix_check_path = u"/etc/dd-agent/conf.d/haproxy.yaml"
        win_check_path = u"C:\\ProgramData\\Datadog\\conf.d\\haproxy.yaml"
        with mock.patch('config.os.path.splitext',
                        side_effect=ntpath.splitext):
            with mock.patch('config.os.path.split', side_effect=ntpath.split):
                self.assertEquals(_conf_path_to_check_name(win_check_path),
                                  check_name)
        self.assertEquals(_conf_path_to_check_name(unix_check_path),
                          check_name)