Agent Skillsnetalertx/NetAlertX › netalertx-testing-workflow

netalertx-testing-workflow

GitHub

在 NetAlertX devcontainer 中运行、调试 pytest 测试。强制先检查失败,支持全量/指定文件/上次失败测试,处理认证与 403 问题,必要时重建 Docker 镜像。

.github/skills/testing-workflow/SKILL.md netalertx/NetAlertX

触发场景

运行测试 检查测试失败 调试失败的测试 执行 pytest

安装

npx skills add netalertx/NetAlertX --skill netalertx-testing-workflow -g -y
更多选项

非标准路径

npx skills add https://github.com/netalertx/NetAlertX/tree/main/.github/skills/testing-workflow -g -y

不安装直接使用

npx skills use netalertx/NetAlertX@netalertx-testing-workflow

指定 Agent (Claude Code)

npx skills add netalertx/NetAlertX --skill netalertx-testing-workflow -a claude-code -g -y

安装 repo 全部 skill

npx skills add netalertx/NetAlertX --all -g -y

预览 repo 内 skill

npx skills add netalertx/NetAlertX --list

SKILL.md

Frontmatter
{
    "name": "netalertx-testing-workflow",
    "description": "Run and debug tests in the NetAlertX devcontainer. Use this when asked to run tests, check test failures, debug failing tests, or execute pytest."
}

Testing Workflow

Pre-Flight Check (MANDATORY)

Before running any tests, always check for existing failures first:

  1. Use the testFailure tool to gather current failure information
  2. Review the failures to understand what's already broken
  3. Only then proceed with test execution

Running Tests

Use VS Code's testing interface or the runTests tool with appropriate parameters:

  • To run all tests: invoke runTests without file filter
  • To run specific test file: invoke runTests with the test file path
  • To run failed tests only: invoke runTests with --lf flag

Test Location

Tests live in test/ directory. App code is under server/.

PYTHONPATH is preconfigured to include the following which should meet all needs:

  • /app # the primary location where python runs in the production system
  • /app/server # symbolic link to /wprkspaces/NetAlertX/server
  • /app/server/plugins # symbolic link to /workspaces/NetAlertX/server/plugins
  • /opt/venv/lib/pythonX.Y/site-packages
  • /workspaces/NetAlertX/test
  • /workspaces/NetAlertX/server
  • /workspaces/NetAlertX
  • /usr/lib/pythonX.Y/site-packages

Authentication in Tests

Retrieve API_TOKEN using Python (not shell):

from helper import get_setting_value
token = get_setting_value("API_TOKEN")

Troubleshooting 403 Forbidden

  1. Ensure backend is running (use devcontainer-services skill)
  2. Verify config loaded: get_setting_value("API_TOKEN") returns non-empty
  3. Re-run startup if needed (use devcontainer-setup skill)

Docker Test Image

If container changes affect tests, rebuild the test image first:

docker buildx build -t netalertx-test .

This takes ~30 seconds unless venv stage changes (~90s).

版本历史

  • 548d698 当前 2026-08-19 22:09

    修正 PYTHONPATH 中插件路径拼写错误(front/plugins 改为 server/plugins);更新文档以匹配网站监控插件引入后的目录结构变更。

  • 8aec57b 2026-07-24 22:14

同 Skill 集合

.gemini/skills/devcontainer-management/SKILL.md
.gemini/skills/mcp-activation/SKILL.md
.gemini/skills/project-navigation/SKILL.md
.gemini/skills/settings/SKILL.md
.gemini/skills/skills-index/SKILL.md
.gemini/skills/testing-workflow/SKILL.md
.github/skills/api-development/SKILL.md
.github/skills/authentication/SKILL.md
.github/skills/code-standards/SKILL.md
.github/skills/database-patterns/SKILL.md
.github/skills/database-reset/SKILL.md
.github/skills/devcontainer-configs/SKILL.md
.github/skills/devcontainer-services/SKILL.md
.github/skills/devcontainer-setup/SKILL.md
.github/skills/docker-build/SKILL.md
.github/skills/docker-prune/SKILL.md
.github/skills/mcp-activation/SKILL.md
.github/skills/plugin-run-development/SKILL.md
.github/skills/project-navigation/SKILL.md
.github/skills/sample-data/SKILL.md
.github/skills/settings-management/SKILL.md
.github/skills/skills-overview/SKILL.md

元信息

文件数
0
版本
548d698
Hash
870a0160
收录时间
2026-07-24 22:14

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-25 18:29
浙ICP备14020137号-1 $访客地图$