Skip to content

Commit

Permalink
move code
Browse files Browse the repository at this point in the history
  • Loading branch information
wayyoungboy committed Dec 11, 2024
1 parent 49bbc41 commit 588cc7d
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/handler/analyzer/analyze_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion test/analyzer/sql/test_is_null_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion test/analyzer/sql/test_sellect_all_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion test/common/ssh_client/test_docker_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion test/common/ssh_client/test_local_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion test/common/test_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion test/common/test_config_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 3 additions & 0 deletions test/common/test_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 588cc7d

Please sign in to comment.