Agent Skillsnetalertx/NetAlertX › netalertx-testing-workflow

netalertx-testing-workflow

GitHub

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

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

Trigger Scenarios

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

Install

npx skills add netalertx/NetAlertX --skill netalertx-testing-workflow -g -y
More Options

Non-standard path

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

Use without installing

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).

Version History

  • 548d698 Current 2026-08-19 22:09

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

  • 8aec57b 2026-07-24 22:14

Same Skill Collection

.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

Metadata

Files
0
Version
548d698
Hash
870a0160
Indexed
2026-07-24 22:14

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-20 20:05
浙ICP备14020137号-1 $방문자$