tigron

module
v0.0.0-...-53e7b27 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2025 License: Apache-2.0

README

Tigron test framework

no-one likes you, if [ $? -eq 0 ]

A modern testing framework for command-line applications.

TL;DR

TBD

Documentation

TBD

For now, see nerdctl-specific testing documentation.

Motivation and goals

Testing (go) binaries is a journey fraught with many pitfalls.

While some tooling exist (the venerable bats, or the solid work going on at gotestyourself), they either focus on relatively low-level testing primitives (assert, exec), or do not integrate well into the natural go environment (bats requires you to write shell scripts), and routinely require additional third-party tools for advanced scenarios (hello unbuffer), and for the developer to write a large set of "helpers".

Projects and companies thus routinely end-up growing in-house tooling, that generally suffer from a number of rampant issues: lack of structure and expressiveness, helpers spaghetti, unclear test lifecycle (specifically cleanup), resource leakage and cross test interaction, ultimately encouraging bad test design leading to degraded and un-scalable situations (flakyness being of course the number 1 scourge).

Tigron was developed specifically to address these issues, based on the experience testing nerdctl, a large cli with a lot of integration tests.

Tigron does not replace gotest.tools, nor gotestsum. In fact, it leverages and encourages use of these where appropriate.

Tigron ambition is to provide a ready-to-use, clean, simple, go-native framework meant specifically to write tests for cli binaries, encouraging good test design and a stronger basis to build tests suite. It also comes with a set of helpers to accomodate most advanced scenarios (command backgrounding, stdin manipulation, support for pseudo ttys, environment filtering, etc.)

Hack

Initial setup

Clone, then:

./hack/dev-setup-linux.sh
# Or
# ./hack/dev-setup-macos.sh

make install-dev-tools
Work
# Update dependencies
make up
# Re-order imports, gofmt, go mod tidy, etc
make fix
# Ensure linters are happy
make lint
# Run tests
make test

Directories

Path Synopsis
Package expect provides a set of simple concrete test.Comparator implementations to use by tests on stdout, along with exit code expectations.
Package expect provides a set of simple concrete test.Comparator implementations to use by tests on stdout, along with exit code expectations.
Package internal provides an assert library, pty, a command wrapper, and a leak detection library for internal use in Tigron.
Package internal provides an assert library, pty, a command wrapper, and a leak detection library for internal use in Tigron.
assertive
Package assertive is an experimental, zero-dependencies assert library.
Package assertive is an experimental, zero-dependencies assert library.
com
Package com is a lightweight wrapper around golang command execution.
Package com is a lightweight wrapper around golang command execution.
formatter
Package formatter provides simple formatting helpers for internal consumption.
Package formatter provides simple formatting helpers for internal consumption.
highk
Package highk (for "high-κ dielectric") is a highly experimental leak detection library (for file descriptors and go routines).
Package highk (for "high-κ dielectric") is a highly experimental leak detection library (for file descriptors and go routines).
logger
Package logger is a very simple stub allowing developers to hook whatever logger they want to debug internal behavior of the com package.
Package logger is a very simple stub allowing developers to hook whatever logger they want to debug internal behavior of the com package.
mimicry
Package mimicry provides a very rough and rudimentary mimicry library to help with internal tigron testing.
Package mimicry provides a very rough and rudimentary mimicry library to help with internal tigron testing.
mocks
Package mocks provides a collection of tigron internal mocks to ease testing.
Package mocks provides a collection of tigron internal mocks to ease testing.
pty
Package pty provides a simple to manipulate pty Open method.
Package pty provides a simple to manipulate pty Open method.
Package require provides a set of concrete test.Requirements to express the need for a specific architecture, OS, or binary, along with Not() and All() which allow Requirements composition.
Package require provides a set of concrete test.Requirements to express the need for a specific architecture, OS, or binary, along with Not() and All() which allow Requirements composition.
Package test is the main entrypoint for Tigron.
Package test is the main entrypoint for Tigron.
Package tig defines interfaces for third-party packages that tigron needs to interact with.
Package tig defines interfaces for third-party packages that tigron needs to interact with.
Package utils provides generic helpers that are regularly useful for a range of test authors.
Package utils provides generic helpers that are regularly useful for a range of test authors.
testca
Package testca provides helpers to create a self-signed CA certificate, and the ability to generate signed certificates from it.
Package testca provides helpers to create a self-signed CA certificate, and the ability to generate signed certificates from it.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL