Documentation
¶
Overview ¶
Package testutil contains utilities for testing. It is used by test cases in other packages, but it should not be used by non-test code in other packages.
Index ¶
- Variables
- func DetailLogEnabled() bool
- func DetailLogMain(m *testing.M)
- func DetailLogf(t interface{ ... }, format string, args ...interface{})
- func ParseDetailLogFlags()
- func ServerServe(t testing.TB, path string) string
- func SuperServerServe(t testing.TB, path string) string
- func TestCallPerRPCOauthCreds(testToken string) grpc.CallOption
- func TestDialPerRPCOauthCreds(testToken string) grpc.DialOption
- func TestServerCert() (tls.Certificate, error)
- func TestTransportCreds() (grpc.DialOption, error)
- type TestProvider
Constants ¶
This section is empty.
Variables ¶
var TestProviderInstance = TestProvider{
RawToken: "test-token-1",
}
var TestProviderInstance2 = TestProvider{
RawToken: "test-token-2",
}
Functions ¶
func DetailLogEnabled ¶
func DetailLogEnabled() bool
func DetailLogMain ¶
func DetailLogf ¶
func ParseDetailLogFlags ¶
func ParseDetailLogFlags()
func TestCallPerRPCOauthCreds ¶
func TestCallPerRPCOauthCreds(testToken string) grpc.CallOption
func TestDialPerRPCOauthCreds ¶
func TestDialPerRPCOauthCreds(testToken string) grpc.DialOption
The function's primary purpose is to create a grpc.DialOption that configures the gRPC client to use OAuth2 credentials for per-RPC authentication. This means that every RPC call made by the client will include the OAuth2 access token, allowing the server to verify the client's identity and grant access to the requested resources based on the token's validity and permissions.
func TestServerCert ¶
func TestServerCert() (tls.Certificate, error)
tls.Certificate structure includes the certificate and the private key. This structure can then be used to configure a TLS listener or server.
func TestTransportCreds ¶
func TestTransportCreds() (grpc.DialOption, error)
TestTransportCreds function creates a gRPC DialOption that specifies the transport credentials for secure communication using TLS. This is useful when you need to establish a secure gRPC connection to a server.
Types ¶
type TestProvider ¶
type TestProvider struct {
RawToken string
// contains filtered or unexported fields
}
func (TestProvider) AuthProvider ¶
func (p TestProvider) AuthProvider()
func (TestProvider) Oauth2Token ¶
func (p TestProvider) Oauth2Token() (*oauth2.Token, error)