Documentation ¶
Index ¶
- func AutoChdir()
- func PrepareSession(authPort uint16, authSrv *oauth2.AuthorizationServer, grpcURL string) (dir string, err error)
- func RunCLITest(m *testing.M, opts ...server.StartGRPCServerOption) (code int)
- func RunCLITestFunc[T any](f func() T, opts ...server.StartGRPCServerOption) (retPtr *T, err error)
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 ...server.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.
func RunCLITestFunc ¶
func RunCLITestFunc[T any](f func() T, opts ...server.StartGRPCServerOption) (retPtr *T, err error)
RunCLITestFunc can be used to launch individual test functions with a gRPC server. 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.
Types ¶
This section is empty.