Skip to content
go-while edited this page Oct 23, 2026 · 4 revisions

nntp-testkit

nntp-testkit is a set of Go packages for testing NNTP software:

  • fakeserver: a fake NNTP server. It runs a fixed script, your own handler, or a stateful store of groups and articles with a built-in RFC 3977 reader. Fault hooks make it slow, cut replies short or answer like real servers that don't follow the RFC to the letter.
  • client: a strict test client. It reports wire-level mistakes of the server under test: bare LF, bad dot-stuffing, a missing terminator, bytes after a complete reply.
  • proc: runs an external server binary for a test (on stdin/stdout or TCP), stops it afterwards and prints its logs when the test fails.
  • conformance: a stub for planned black-box RFC checks.

It uses only the standard library and needs Go 1.26 or later. It never contacts a host that a test did not name. License: GPLv2.

It is written for the test suites of go-pugleaf, nntp-server and nntp-proxy, and for the end-to-end tests of NewsCache (tests/e2e): there the C++ server runs under proc, the strict client talks to it, and a fakeserver store is its upstream news server.

Releases

The current release is v0.5.0 (2026-10-23). See Releases and Versioning.

go get github.com/go-while/nntp-testkit@latest

Pages

Page What it covers
Getting Started Install, a first test, the hang guard, testing a server binary
Fake Server Script, Handler and Store mode, options, what the server records, TLS, the streaming and IHAVE peer
Store and Groups Groups, articles, numbering, expiry and cancels, generated groups of any size, StoreOptions
NNTP Commands The commands the Store server answers, and its reply codes
Faults Delays, overrides, cut and slow replies, endless replies
Real World Server Behaviours Which quirks of real servers can be simulated, and what is missing
Strict Client The test client and the mistakes strict mode reports
Running Server Binaries proc: start, stop and log an external server
Releases and Versioning Tags, Go versions, what changed in each release
Development Running the kit's own tests, adding a behaviour, releasing

The full contract of each package is in its doc.go (go doc -all ./fakeserver), and the README has the API tables.

Clone this wiki locally