How to Test Pentagi Code Locally: Go Backend and React Frontend Guide

You can test Pentagi locally by running go test ./... in the backend directory for Go unit tests and npm run test in the frontend directory for React component tests, with Docker required for integration tests that spawn containers.

Pentagi is an autonomous penetration-testing platform built by vxcontrol that combines a Go backend with a React TypeScript frontend. Testing your changes locally before submitting ensures that the REST/GraphQL APIs, agent orchestration, LLM provider integrations, and UI components function correctly across the entire stack.

Prerequisites

Before testing Pentagi locally, install the following dependencies:

  • Docker and Docker Compose (or Podman) to run Postgres, Neo4j, Grafana, and sandboxed tool containers.
  • Go 1.22+ to compile the backend and run go test.
  • Node.js ≥20 and npm to install frontend dependencies and run Vitest.
  • Git to clone https://github.com/vxcontrol/pentagi.git.
  • Make (optional) for scripted build commands.

Clone the Repository

git clone https://github.com/vxcontrol/pentagi.git
cd pentagi

All subsequent paths are relative to this root directory.

Backend Testing (Go)

The backend test suite includes approximately 200+ tests across packages for tools, providers, authentication, and task queues.

Install Go Dependencies

cd backend
go mod download

Run the Complete Test Suite

Execute all tests recursively from the backend root:

go test ./...

This command compiles and runs every *_test.go file, including integration tests in backend/pkg/tools and backend/pkg/csum that temporarily spawn Docker containers.

Test Specific Packages

Filter tests to specific domains to save time during iterative development:

go test ./pkg/tools                    # Terminal and browser tool tests

go test ./pkg/providers/openai         # OpenAI provider logic

go test ./pkg/queue                    # Async task queue behavior

go test ./pkg/server/auth              # API token validation

Critical Backend Test Files

The following files validate core functionality according to the Pentagi source code:

Debug Failing Tests

Isolate a specific test with verbose logging:

go test ./pkg/tools -run TestTerminalExec -v

For interactive debugging, use Delve:

dlv test ./pkg/tools -- -test.run TestTerminalExec

Frontend Testing (React + TypeScript)

The React frontend uses Vitest for component and hook validation.

Install Node Modules

cd frontend
npm ci

Execute Frontend Tests

Run all TypeScript and TSX tests:

npm run test

Target a specific component:

npm run test -- src/pages/flows/FlowList.test.tsx

Key Frontend Test Files

Validate Helper Binaries

Pentagi includes CLI utilities ftester, ctester, and etester for isolated tool validation.

Build the binaries:

cd backend/cmd
go build -o ../bin/ftester ./ftester
go build -o ../bin/ctester ./ctester

Run the function tester against a provider configuration:

../bin/ftester -config examples/configs/openrouter.provider.yml -flow "Test openrouter provider"

Validate container sandboxing:

../bin/ctester -image vxcontrol/nmap -cmd "nmap -sV 127.0.0.1"

End-to-End Validation (Optional)

To verify the complete system including API, agents, and tools:

docker compose up -d

Then trigger a flow via the GraphQL endpoint at https://localhost:8443/api/v1/graphql or monitor execution logs:

docker logs -f pentagi

Pre-Commit Validation Checklist

Align your local checks with the CI pipeline defined in .github/workflows/ci.yml:


# Backend validation

go test ./...
go vet ./...
golangci-lint run  # if installed

# Frontend validation

npm run lint
npm run test

# Helper binary smoke test

go build ./cmd/ftester
../bin/ftester -config examples/configs/openrouter.provider.yml -flow "CI sanity check"

Summary

  • Backend: Run go test ./... from the backend directory to execute 200+ unit and integration tests spanning backend/pkg/tools, backend/pkg/providers, and backend/pkg/queue.
  • Frontend: Execute npm run test in the frontend directory to run Vitest against React components and GraphQL clients.
  • Helpers: Build and run ftester and ctester from backend/cmd to validate provider configurations and container sandboxes.
  • Integration: Use Docker Compose to spin up the full stack for end-to-end flow execution tests.
  • Debugging: Use go test -run TestName -v for verbose Go output and dlv test for interactive debugging.

Frequently Asked Questions

Why do my Go tests fail with Docker socket errors?

The test suite in backend/pkg/tools and backend/pkg/csum spawns containers for integration testing. Ensure your user has permissions to access /var/run/docker.sock by adding your account to the docker group, or run the tests with appropriate privileges.

How do I debug a specific failing test in the backend?

Use the -run flag to filter by test name and -v for verbose output: go test ./pkg/tools -run TestTerminalExec -v. For step-through debugging, launch Delve with dlv test ./pkg/tools -- -test.run TestTerminalExec.

What should I do if frontend tests fail due to missing GraphQL schemas?

The React tests depend on the GraphQL schema generated by the backend. Run the installer once or manually copy the schema file: cp backend/pkg/graph/schema.graphqls frontend/src/graphql/schema.graphqls, then rerun npm run test.

How do I test a new LLM provider implementation locally?

Create a *_test.go file in your new provider directory under backend/pkg/providers/<your-provider>/, following the pattern established in backend/pkg/providers/openai/openai_test.go. Run go test ./backend/pkg/providers/<your-provider> to validate request signing, model selection, and error handling.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →