clitest

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoChdir

func AutoChdir()

AutoChdir automatically guesses if we need to change the current working directory so that we can find the policies folder

func PrepareSession

func PrepareSession(authPort uint16, authSrv *oauth2.AuthorizationServer, grpcURL string) (dir string, err error)

PrepareSession prepares a session for unit tests. It creates a temporary folder to save the session credentials in and does a login to the specified authorization server using test credentials. It is the responsibility of the caller to cleanup the temporary directory.

This function will use asserts and fail/panic if errors occurs.

func RunCLITest

func RunCLITest(m *testing.M, opts ...service.StartGRPCServerOption) (code int)

RunCLITest can be used in a TestMain function for CLI tests. It takes care of launching an authorization server as well as a gRPC server with the selected services supplied as options. It also automatically issues a login command to the auth service.

Since this function is primarily used in a TestMain and no testing.T object is available at this point, this function WILL panic on errors.

Types

This section is empty.

Jump to

Keyboard shortcuts

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