diff --git a/docs/system_base/aide/tc_aide_fun_001.yaml b/docs/system_base/aide/tc_aide_fun_001.yaml new file mode 100644 index 0000000000000000000000000000000000000000..17d519d21d803f412ac12594ef95a7a625acd507 --- /dev/null +++ b/docs/system_base/aide/tc_aide_fun_001.yaml @@ -0,0 +1,49 @@ +作者: xufei +优先级: P1 +支持架构: noarch +执行方式: 自动 +测试类型: 功能测试 +通用标签: local +用例描述: 测试 AIDE(高级入侵检测环境) 功能 +修改人: xufei + +前置条件: +- 可访问软件仓库 +- 具有root权限 +- 有足够的磁盘空间 +- 系统支持入侵检测功能 +- 安装aide软件包 + +测试步骤: +- ## 获取版本信息 +- 获取aide包版本 +- 获取aide命令版本 +- 验证版本信息一致性 +- ## 测试帮助功能 +- 运行aide --help查看帮助 +- 验证帮助信息包含关键关键词 +- ## 检查配置文件 +- 检查aide配置文件是否存在 +- 查找备选配置文件位置 +- ## 检查数据库配置 +- 检查aide数据库配置 +- ## 检查可执行文件 +- 检查aide可执行文件路径 +- ## 检查手册页 +- 检查aide手册页是否存在 +- ## 检查包信息 +- 检查aide包详细信息 +- ## 清理环境 +- 清理临时文件卸载aide软件包 + +期望结果: +- 成功安装aide软件包 +- 成功获取aide版本信息 +- aide包版本与命令版本一致 +- 成功获取aide帮助信息 +- 成功找到aide配置文件 +- 成功检查aide数据库配置 +- 成功找到aide可执行文件 +- 成功找到aide手册页 +- 成功获取aide包信息 +- 所有命令返回码符合预期 \ No newline at end of file diff --git a/tests/system_base/aide/tc_aide_fun_001.py b/tests/system_base/aide/tc_aide_fun_001.py new file mode 100644 index 0000000000000000000000000000000000000000..1e00b95c51560dd5bfe17742420917935bbda1c3 --- /dev/null +++ b/tests/system_base/aide/tc_aide_fun_001.py @@ -0,0 +1,79 @@ +# -*- encoding: utf-8 -*- + +""" +@File: tc_aide_fun_001.py +@Time: 2026/02/28 16:23:53 +@Author: douzhichong +@Version: 1.0 +@Contact: douzhichong@inspur.com +@License: Mulan PSL v2 +@Modify: douzhichong +""" + +from common.basetest import LocalTest + + +class Test(LocalTest): + """ + See tc_aide_fun_001.yaml for details + + :avocado: tags=P1,noarch,local,aide + """ + PARAM_DIC = {"pkg_name": "aide"} + + def setUp(self): + super().setUp(self.PARAM_DIC) + + def test(self): + self.log.info("Start to run test.") + + # 鑾峰彇aide鐗堟湰 + code2,result2=self.cmd('rpm -qa aide | awk -F \'-\' \'{print $2}\'') + self.assertEqual(code2, 0, "Get aide version failed") + aide_version = result2.strip() + self.log.info(f"AIDE version from package: {aide_version}") + + # 妫鏌ide鍛戒护鐗堟湰 + code3,result3=self.cmd(f'aide --version 2>&1 | grep "{aide_version}"') + self.assertEqual(code3, 0, "Check aide version: failed!") + + # 妫鏌ide甯姪淇℃伅 + code4,result4=self.cmd('aide --help 2>&1 | grep -E "Aide|Usage:|Commands|Miscellaneous|Options"') + self.assertEqual(code4, 0, "Check aide help: failed!") + + # 妫鏌ide閰嶇疆鏂囦欢 + code5,result5=self.cmd('test -f /etc/aide.conf') + if code5 == 0: + self.log.info("aide configuration file exists") + else: + self.log.warning("aide configuration file not found, checking alternatives") + code6,result6=self.cmd('find /etc -name "*aide*" 2>/dev/null | head -3') + if code6 == 0 and result6.strip(): + self.log.info(f"Found aide configuration files: {result6}") + + # 妫鏌ide鏁版嵁搴撲綅缃 + code7,result7=self.cmd('grep -i "^database" /etc/aide.conf 2>/dev/null | head -2') + if code7 == 0 and result7.strip(): + self.log.info(f"aide database configuration: {result7.strip()}") + + # 妫鏌ide鍙墽琛屾枃浠惰矾寰 + code8,result8=self.cmd('which aide') + self.assertEqual(code8, 0, "aide command not found in PATH") + self.log.info(f"aide executable path: {result8.strip()}") + + # 妫鏌ide鎵嬪唽椤 + code9,result9=self.cmd('man -w aide 2>/dev/null || echo "no man page"') + if "no man page" not in result9: + self.log.info("aide man page found") + + # 妫鏌ide鍖呬俊鎭 + code10,result10=self.cmd('rpm -qi aide | head -5') + if code10 == 0: + self.log.info(f"aide package info: {result10}") + + self.log.info("End to run test.") + + def tearDown(self): + super().tearDown(self.PARAM_DIC) + +