package jars

import "github.com/apache/beam/sdks/v2/go/test/integration/internal/jars"

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

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

func Run(dur time.Duration, jar string, args ...string) (Process, error)

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.

Source Files

jars.go proc.go proc_unix.go run_unix.go

Version
v2.66.0 (latest)
Published
Jun 23, 2025
Platform
linux/amd64
Imports
5 packages
Last checked
8 hours ago

Tools for package owners.