CodeVetter · Repo Unpack · Testing signals
fatedier/frp
Unit tests use Go's testing with testify and rodaine/table, spread through pkg/, client/, server/ and cmd/ (run via `make test`/`gotest` with the noweb tag). End-to-end tests use Ginkgo/Gomega under test/e2e with a framework that spawns real frps/frpc binaries, organized into v1/basic, v1/features, plugin, legacy and mock server helpers; `make e2e` runs hack/run-e2e.sh with 16-way parallelism. Cross-version compatibility suites run released binaries via hack/run-e2e-compatibility.sh and download scripts. The web workspace uses Vitest + @vue/test-utils; linting is via golangci-lint (.golangci.yml) plus gofmt/gofumpt/gci/vet make targets and GitHub Actions workflows.
- make gotest runs `go test -tags noweb -v --cover` over ./assets/..., ./cmd/..., ./client/..., ./server/..., ./pkg/...; make alltest adds vet and e2e.
- E2E harness: test/e2e/e2e.go RunE2ETests registers Gomega fail handler, enables EmitSpecProgress and RandomizeAllSpecs; hack/run-e2e.sh installs ginkgo v2.23.4 and runs against bin/frpc and bin/frps (overridable via FRPC_PATH/FRPS_PATH).
- E2E framework provides process management, port allocation, mock servers and request helpers under test/e2e/framework and test/e2e/pkg (cert, plugin, port, process, relay, request, rpc, ssh).
- E2E coverage areas include basic client/server behavior, config, HTTP, tcpmux, xtcp, OIDC, token_source, wire protocol, plus features: bandwidth_limit, chaos, control_replacement, group, heartbeat, monitor, real_ip, ssh_tunnel, store.
- Compatibility testing: make e2e-compatibility runs hack/run-e2e-compatibility.sh against FRP_COMPAT_BASELINE_COUNT released versions (floor 0.61.0); e2e-compatibility-last-frpc/last-frps download the last release into ./lastversion and run the suite with one side pinned old.
- Unit tests exist for config decode/load (pkg/config/v1 *_test.go, pkg/config/load_test.go), msg codecs (pkg/msg msg_test.go, wire_v2_test.go, udp_binary_test.go + benchmarks), auth OIDC (pkg/auth/oidc_test.go), source aggregator/store, client service/config_manager/control_session, server control/service/proxy, nathole analysis/discovery, vnet controller, health.
- cmd/frpc/sub has verify_test.go covering the verify subcommand; most other cmd code (proxy/admin/nathole subcommands) has no direct unit tests.
- Web frontend testing: web/package.json defines test:unit via vitest run (vitest 4.1.10, jsdom, @vue/test-utils) across workspaces shared/frpc/frps; Makefile web-ci runs npm ci, lint:check, test:unit and builds.
- Lint/format toolchain: golangci-lint run configured by .golangci.yml; make fmt (go fmt), fmt-more (gofumpt), gci (import grouping with frp prefix), vet; CI workflows include golangci-lint.yml and goreleaser.yml.
- runMultipleClients (--config_dir) is explicitly documented as 'only designed for testing. It's not guaranteed to be stable' yet is reachable via a public flag.
- Ginkgo parallel runs default to CONCURRENCY=16 in run-e2e.sh and framework.RunID isolates per-node resources.