Categorygithub.com/juju/testing
modulepackage
1.2.0
Repository: https://github.com/juju/testing.git
Documentation: pkg.go.dev

# README

juju/testing

This package provides additional base test suites to be used with gocheck.

# Packages

No description provided by the author
No description provided by the author
No description provided by the author

# Functions

AssertEchoArgs is used to check the args from an execution of a command that has been patched using PatchExecutable containing EchoQuotedArgs.
CaptureOutput runs the given function and captures anything written to Stderr or Stdout during f's execution.
FindImports returns a sorted list of packages imported by the package with the given name that have the given prefix.
HomePath joins the specified path snippets and returns an absolute path under Juju home.
HookCommandOutput intercepts CommandOutput to a function that passes the actual command and it's output back via a channel, and returns the error passed into this function.
JujuXDGDataHomePath returns the test home path, it is just a convenience for tests, if extra path snippets are passed they will be joined to juju home.
No description provided by the author
NewCallMocker returns a CallMocker which will log calls and results utilizing the given logger.
No description provided by the author
NewTCPProxy runs a proxy that copies to and from the given remote TCP address.
PatchEnvironment provides a test a simple way to override a single environment variable.
PatchEnvPathPrepend provides a simple way to prepend path to the start of the PATH environment variable.
PatchExecutable creates an executable called 'execName' in a new test directory and that directory is added to the path.
PatchExecutableAsEchoArgs creates an executable called 'execName' in a new test directory and that directory is added to the path.
PatchExecutableThrowError is needed to test cases in which we expect exit codes from executables called from the system path.
PatchValue sets the value pointed to by the given destination to the given value, and returns a function to restore it to its original value.
ReadEchoArgs is used to read the args from an execution of a command that has been patched using PatchExecutable containing EchoQuotedArgs.
No description provided by the author

# Constants

EchoQuotedArgs is a simple bash script that prints out the basename of the command followed by the args as quoted strings.
No description provided by the author
No description provided by the author
LongWait is used when something should have already happened, or happens quickly, but we want to make sure we just haven't missed it.
No description provided by the author
ShortWait is a reasonable amount of time to block waiting for something that shouldn't actually happen.

# Variables

No description provided by the author
No description provided by the author

# Structs

CallMocker is a tool which allows tests to dynamically specify results for a given set of input parameters.
CleanupSuite adds the ability to add cleanup functions that are called during either test tear down or suite tear down depending on the method called.
FakeHome stores information about the user's home environment so it can be cast aside for tests and restored afterwards.
FakeHomeSuite sets up a fake home directory before running tests.
No description provided by the author
No description provided by the author
IsolationSuite isolates the tests from the underlaying system environment, sets up test logging and exposes cleanup facilities.
LoggingCleanupSuite is defined for backward compatibility.
LoggingSuite redirects the juju logger to the test logger when embedded in a gocheck suite type.
OsEnvSuite isolates the tests from the underlaying system environment.
PatchExecConfig holds the arguments for PatchExecHelper.GetExecCommand.
PatchExecHelper is a type that helps you patch out calls to executables by patching out the exec.Command function that creates the exec.Cmd to call them.
No description provided by the author
Stub is used in testing to stand in for some other value, to record all calls to stubbed methods/functions, and to allow users to set the values that are returned from those calls.
StubCall records the name of a called function and the passed args.
TCPProxy is a simple TCP proxy that can be used to deliberately break TCP connections.
No description provided by the author

# Interfaces

EnvironmentPatcher is an interface that requires just one method: PatchEnvironment.

# Type aliases

No description provided by the author
ResponseMap maps request paths to responses.
Restorer holds a function that can be used to restore some previous state.