Core Library0.xAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

class libtmux-java latest

TmuxExtension

Gives each test its own tmux server and checks its exit during teardown.

Source and package
Qualified name
io.github.libtmux.junit5.TmuxExtension
Package
io.github.libtmux.junit5
Distribution
io.github.libtmux:libtmux
Source
libtmux-junit5/src/main/java/io/github/libtmux/junit5/TmuxExtension.java
class io.github.libtmux.junit5.TmuxExtension

Description#

A shutdown hook also cleans up on JVM termination. A hard kill skips it; a later fixture run sharing the root reaps servers whose owning JVM is gone.

All state lives in the extension store, never in fields. JUnit reuses one declaratively registered extension instance for every test in a class, so a field is shared state the moment tests run in parallel, and one test's teardown then reaches another test's server.

The server is started eagerly, before the test body, and the aggregate that owns it is registered before any process exists. Registering afterwards leaves a window in which a failure partway through setup leaks a running tmux that nothing is left holding.

Teardown is driven from a lifecycle callback and the aggregate is also AutoCloseable for the framework's own store handling. Relying on store auto-close alone is a silent dependency on a configuration property: with it disabled that design releases nothing and reports nothing. The aggregate closes exactly once, so either path alone is sufficient.

Members9#

  • afterEach method
  • beforeEach method
  • deleteTree method
  • Fixture class One test's server, socket and directory, released exactly once.
  • fixtureRoot method
  • reapAbandoned method Ends every tmux server under root whose owning JVM is gone, and answers how many ended. Runs while other runs are using the same root, so it may only touch abandoned servers.
  • resolveParameter method
  • startOf method When a process started, in a form every JVM on this machine reads the same way: the kernel's own ticks since boot on Linux, and the platform's start instant elsewhere.
  • supportsParameter method

Guides#

Pages that discuss TmuxExtension.

Esc

Type to search.

Reference previewOpen reference