common

package
v0.0.0-...-f4b31ea Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddContentsToLog

func AddContentsToLog(fileName string, rootDir string, msgToAdd string) error

AddContentsToLog adds contents of the file of fileName to log

func BuildBucketID

func BuildBucketID() string

func FindFile

func FindFile(fileName string, rootDir string) (string, error)

FindFile finds file path in rootDir of fileName

func IsCriticalPullCrash

func IsCriticalPullCrash(code int) bool

func JsonPbUnmarshaler

func JsonPbUnmarshaler() jsonpb.Unmarshaler

JsonPbUnMarshaler returns the unmarshaler which should be used across CTR.

func Poll

func Poll(ctx context.Context, f func(context.Context) error, opts *PollOptions) error

Poll implements testing.Poll.

func PollBreak

func PollBreak(err error) error

PollBreak implements testing.PollBreak.

func PrintToLog

func PrintToLog(cmd string, stdout string, stderr string)

PrintToLog prints cmd, stdout, stderr to log

func RunWithTimeout

func RunWithTimeout(ctx context.Context, cmd *exec.Cmd, timeout time.Duration, block bool) (stdout string, stderr string, err error)

RunWithTimeout runs command with timeout limit.

func RunWithTimeoutSpecialLog

func RunWithTimeoutSpecialLog(ctx context.Context, cmd *exec.Cmd, timeout time.Duration, block bool, logstr string) (stdout string, stderr string, err error)

RunWithTimeoutRedacted runs command with timeout limit, however only will log whats provided in the logstr input. Useful when running cmds with private info, like oath tokens.

func SetUpLog

func SetUpLog() error

SetUpLog sets up the logging for CTR within /var/tmp/bbid/ctrlog.txt

func StreamScanner

func StreamScanner(stream io.Reader, logtag string)

StreamScanner makes a scanner to read from test streams.

Types

type PollOptions

type PollOptions struct {
	// Timeout specifies the maximum time to poll.
	// Non-positive values indicate no timeout (although context deadlines will still be honored).
	Timeout time.Duration
	// Interval specifies how long to sleep between polling.
	// Non-positive values indicate that a reasonable default should be used.
	Interval time.Duration
}

PollOptions provides testing.PollOptions.

Jump to

Keyboard shortcuts

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