testutil

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: None detected not legal advice Imports: 0 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
var TestProviderInstance = TestProvider{
	RawToken: "test-token-1",
}
View Source
var TestProviderInstance2 = TestProvider{
	RawToken: "test-token-2",
}

Functions

func DetailLogEnabled

func DetailLogEnabled() bool

func DetailLogMain

func DetailLogMain(m *testing.M)

func DetailLogf

func DetailLogf(
	t interface {
		Helper()
		Logf(format string, args ...interface{})
	},
	format string, args ...interface{},
)

func ParseDetailLogFlags

func ParseDetailLogFlags()

func ServerServe

func ServerServe(t testing.TB, path string) string

for test cases

func SuperServerServe

func SuperServerServe(t testing.TB, path string) string

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) Info

func (p TestProvider) Info() (email string, name string, err error)

func (TestProvider) Oauth2Token

func (p TestProvider) Oauth2Token() (*oauth2.Token, error)

Jump to

Keyboard shortcuts

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