diff --git a/src/handler/analyzer/analyze_log.py b/src/handler/analyzer/analyze_log.py index 457824e9..21dfee5f 100644 --- a/src/handler/analyzer/analyze_log.py +++ b/src/handler/analyzer/analyze_log.py @@ -23,6 +23,7 @@ import tabulate +from src.common.ssh_client.local_client import LocalClient from src.handler.base_shell_handler import BaseShellHandler from src.common.obdiag_exception import OBDIAGFormatException from src.common.constant import const @@ -321,7 +322,7 @@ def __pharse_offline_log_file(self, ssh_client, log_name, local_store_dir): :return: """ - ssh_client = ssh_client_local_client.LocalClient(context=self.context, node={"ssh_type": "local"}) + ssh_client = LocalClient(context=self.context, node={"ssh_type": "local"}) local_store_path = "{0}/{1}".format(local_store_dir, str(log_name).strip(".").replace("/", "_")) if self.grep_args is not None: grep_cmd = "grep -e '{grep_args}' {log_name} >> {local_store_path} ".format(grep_args=self.grep_args, log_name=log_name, local_store_path=local_store_path) diff --git a/test/analyzer/sql/test_is_null_rule.py b/test/analyzer/sql/test_is_null_rule.py index 6b3d4f7f..a27587e8 100644 --- a/test/analyzer/sql/test_is_null_rule.py +++ b/test/analyzer/sql/test_is_null_rule.py @@ -16,7 +16,7 @@ @desc: """ import unittest -from src.handler.analyzer.sql.rules import IsNullRule +from src.handler.analyzer.sql.rules.review.is_null import IsNullRule from sqlgpt_parser.parser.oceanbase_parser import parser from src.handler.analyzer.sql.rules.level import Level diff --git a/test/analyzer/sql/test_sellect_all_rule.py b/test/analyzer/sql/test_sellect_all_rule.py index 00609a15..b26e88d6 100644 --- a/test/analyzer/sql/test_sellect_all_rule.py +++ b/test/analyzer/sql/test_sellect_all_rule.py @@ -17,7 +17,7 @@ """ import unittest from sqlgpt_parser.parser.oceanbase_parser import parser -from src.handler.analyzer.sql.rules import SelectAllRule +from src.handler.analyzer.sql.rules.review.select_all import SelectAllRule class TestSelectAllCase(unittest.TestCase): diff --git a/test/common/ssh_client/test_docker_client.py b/test/common/ssh_client/test_docker_client.py index 73a9456a..320f2e6e 100644 --- a/test/common/ssh_client/test_docker_client.py +++ b/test/common/ssh_client/test_docker_client.py @@ -19,7 +19,7 @@ import unittest from unittest.mock import patch, MagicMock from docker import DockerClient as DockerClientSDK -from src.common.ssh_client import DockerClient +from src.common.ssh_client.docker_client import DockerClient from src.common.context import HandlerContext from src.common.obdiag_exception import OBDIAGShellCmdException diff --git a/test/common/ssh_client/test_local_client.py b/test/common/ssh_client/test_local_client.py index bd7546a6..066a237b 100644 --- a/test/common/ssh_client/test_local_client.py +++ b/test/common/ssh_client/test_local_client.py @@ -17,7 +17,7 @@ """ import unittest -import subprocess32 as subprocess +import subprocess from unittest.mock import patch, MagicMock from src.common.ssh_client.local_client import LocalClient from src.common.context import HandlerContext diff --git a/test/common/test_command.py b/test/common/test_command.py index 2042a30f..91d600eb 100644 --- a/test/common/test_command.py +++ b/test/common/test_command.py @@ -17,6 +17,8 @@ """ import unittest from unittest.mock import Mock, patch +import subprocess +from src.common.command import LocalClient, delete_file_in_folder, rm_rf_file, upload_file, download_file class TestLocalClient(unittest.TestCase): @@ -155,7 +157,7 @@ def test_upload_file_success(self): remote_path = "/remote/path/file.txt" self.ssh_client.get_name.return_value = "test_server" - result = upload_file(self.ssh_client, local_path, remote_path, self.stdio) + upload_file(self.ssh_client, local_path, remote_path, self.stdio) self.ssh_client.upload.assert_called_once_with(remote_path, local_path) self.stdio.verbose.assert_called_once_with("Please wait a moment, upload file to server test_server, local file path /local/path/file.txt, remote file path /remote/path/file.txt") diff --git a/test/common/test_config_helper.py b/test/common/test_config_helper.py index d5c66888..d5e7a4ff 100644 --- a/test/common/test_config_helper.py +++ b/test/common/test_config_helper.py @@ -17,7 +17,7 @@ """ import unittest from unittest import mock -from src.common import ConfigHelper +from src.common.config_helper import ConfigHelper class TestConfigHelper(unittest.TestCase): diff --git a/test/common/test_scene.py b/test/common/test_scene.py index c6367e8b..ec8def50 100644 --- a/test/common/test_scene.py +++ b/test/common/test_scene.py @@ -18,6 +18,9 @@ import unittest from unittest.mock import MagicMock, patch +from src.common.scene import filter_by_version, get_version_by_type +from src.common.tool import StringUtils + class TestFilterByVersion(unittest.TestCase): def setUp(self):