Documentation ¶
Overview ¶
Package jars contains functionality for running jars for integration tests. The main entry point for running a jar is the Run function. The Process interface is used to interact with the running jars, and most importantly for shutting down the jars once finished with them.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Process ¶
type Process interface {
Kill() error
}
Process is an interface to allow wrapping os.Process with alternate behavior depending on OS.
func Run ¶
Run runs a jar given an optional duration, a path to the jar, and any desired arguments to the jar. It returns a Process object which can be used to shut down the jar once finished.
The dur parameter is a duration for the timeout command which can be used to automatically kill the jar after a set duration, in order to avoid resource leakage. Timeout is described here: https://man7.org/linux/man-pages/man1/timeout.1.html. Durations will be translated from time.Duration to a string based on the number of minutes. If a duration is provided but the system is unable to use the timeout is unable to use the timeout command, this function will return an error. To indicate that a duration isn't needed, pass in 0.
type UnixProcess ¶
type UnixProcess struct {
// contains filtered or unexported fields
}
UnixProcess wraps os.Process and changes the Kill function to perform a more graceful shutdown, mainly for compatibility with the timeout command.
func (*UnixProcess) Kill ¶
func (p *UnixProcess) Kill() error
Kill gracefully shuts down the process. It is recommended to use this instead of directly killing the process.