testutil

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: Apache-2.0 Imports: 43 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exec

func Exec(t *testing.T, env *TestEnv, args ...string) (stdout, stderr string, err error)

Exec builds and executes the root command with the given args, returning captured stdout, stderr, and any error from cmd.Execute().

func FakeJWT added in v0.34.0

func FakeJWT(t *testing.T, claims map[string]any) string

FakeJWT returns an unsigned JWT with claims, shaped like the access tokens of the login server.

func FindContextEntry

func FindContextEntry(t *testing.T, path, name string) *config.ContextEntry

FindContextEntry reads the YAML config file at path and returns a pointer to the ContextEntry whose Name matches name, or nil if not found.

func WriteConfigFile

func WriteConfigFile(t *testing.T, dir string, content map[string]any) string

WriteConfigFile marshals content as JSON and writes it to dir/config.json. Returns the full path for use with --config or QDRANT_CLOUD_CONFIG.

func WriteContextConfigFile

func WriteContextConfigFile(t *testing.T, dir, currentContext string, contexts map[string]map[string]string) string

WriteContextConfigFile writes a context-format YAML config file to dir/config.yaml. Contexts are written as a YAML slice (- name: ...) sorted by name for deterministic output. Each context's values are keyed by their YAML names: endpoint, api_key, api_key_command, account_id, and auth ("oauth" for a context that uses the OAuth login). Returns the full path for use with --config or QDRANT_CLOUD_CONFIG.

func WriteYAMLConfigFile

func WriteYAMLConfigFile(t *testing.T, dir string, content map[string]any) string

WriteYAMLConfigFile marshals content as YAML and writes it to dir/config.yaml. Returns the full path for use with --config or QDRANT_CLOUD_CONFIG.

Types

type FakeAccountService added in v0.20.0

FakeAccountService is a test fake that implements AccountServiceServer. Use the *Calls fields to configure responses and inspect captured requests.

func (*FakeAccountService) CreateAccountInvite added in v0.20.0

CreateAccountInvite records the call and dispatches via CreateAccountInviteCalls.

func (*FakeAccountService) DeleteAccountInvite added in v0.20.0

DeleteAccountInvite records the call and dispatches via DeleteAccountInviteCalls.

func (*FakeAccountService) GetAccount added in v0.20.0

GetAccount records the call and dispatches via GetAccountCalls.

func (*FakeAccountService) GetAccountInvite added in v0.20.0

GetAccountInvite records the call and dispatches via GetAccountInviteCalls.

func (*FakeAccountService) GetAccountMember added in v0.20.0

GetAccountMember records the call and dispatches via GetAccountMemberCalls.

func (*FakeAccountService) ListAccountInvites added in v0.20.0

ListAccountInvites records the call and dispatches via ListAccountInvitesCalls.

func (*FakeAccountService) ListAccountMembers added in v0.20.0

ListAccountMembers records the call and dispatches via ListAccountMembersCalls.

func (*FakeAccountService) ListAccounts added in v0.20.0

ListAccounts records the call and dispatches via ListAccountsCalls.

func (*FakeAccountService) UpdateAccount added in v0.20.0

UpdateAccount records the call and dispatches via UpdateAccountCalls.

type FakeAuthService added in v0.19.0

FakeAuthService is a test fake that implements AuthServiceServer. Use the *Calls fields to configure responses and inspect captured requests.

func (*FakeAuthService) CreateManagementKey added in v0.19.0

CreateManagementKey records the call and dispatches via CreateManagementKeyCalls.

func (*FakeAuthService) DeleteManagementKey added in v0.19.0

DeleteManagementKey records the call and dispatches via DeleteManagementKeyCalls.

func (*FakeAuthService) ListManagementKeys added in v0.19.0

ListManagementKeys records the call and dispatches via ListManagementKeysCalls.

type FakeBackupService added in v0.2.0

FakeBackupService is a test fake that implements BackupServiceServer. Use the *Calls fields to configure responses and inspect captured requests.

func (*FakeBackupService) CreateBackup added in v0.2.0

CreateBackup records the call and dispatches via CreateBackupCalls.

func (*FakeBackupService) CreateBackupSchedule added in v0.2.0

CreateBackupSchedule records the call and dispatches via CreateBackupScheduleCalls.

func (*FakeBackupService) DeleteBackup added in v0.2.0

DeleteBackup records the call and dispatches via DeleteBackupCalls.

func (*FakeBackupService) DeleteBackupSchedule added in v0.2.0

DeleteBackupSchedule records the call and dispatches via DeleteBackupScheduleCalls.

func (*FakeBackupService) GetBackup added in v0.2.0

GetBackup records the call and dispatches via GetBackupCalls.

func (*FakeBackupService) GetBackupSchedule added in v0.2.0

GetBackupSchedule records the call and dispatches via GetBackupScheduleCalls.

func (*FakeBackupService) ListBackupRestores added in v0.2.0

ListBackupRestores records the call and dispatches via ListBackupRestoresCalls.

func (*FakeBackupService) ListBackupSchedules added in v0.2.0

ListBackupSchedules records the call and dispatches via ListBackupSchedulesCalls.

func (*FakeBackupService) ListBackups added in v0.2.0

ListBackups records the call and dispatches via ListBackupsCalls.

func (*FakeBackupService) RestoreBackup added in v0.2.0

RestoreBackup records the call and dispatches via RestoreBackupCalls.

func (*FakeBackupService) UpdateBackupSchedule added in v0.2.0

UpdateBackupSchedule records the call and dispatches via UpdateBackupScheduleCalls.

type FakeBookingService

FakeBookingService is a test fake that implements BookingServiceServer. Use the *Calls fields to configure responses and inspect captured requests.

func (*FakeBookingService) GetPackage added in v0.4.1

GetPackage records the call and dispatches via GetPackageCalls.

func (*FakeBookingService) ListGlobalInferenceModels added in v0.29.0

ListGlobalInferenceModels records the call and dispatches via ListGlobalInferenceModelsCalls.

func (*FakeBookingService) ListGlobalPackages added in v0.29.0

ListGlobalPackages records the call and dispatches via ListGlobalPackagesCalls.

func (*FakeBookingService) ListPackages

ListPackages records the call and dispatches via ListPackagesCalls.

type FakeClusterService

FakeClusterService is a test fake that implements ClusterServiceServer. Use the *Calls fields to configure responses and inspect captured requests.

func (*FakeClusterService) CreateCluster

CreateCluster records the call and dispatches via CreateClusterCalls.

func (*FakeClusterService) CreateClusterFromBackup added in v0.18.0

CreateClusterFromBackup records the call and dispatches via CreateClusterFromBackupCalls.

func (*FakeClusterService) DeleteCluster

DeleteCluster records the call and dispatches via DeleteClusterCalls.

func (*FakeClusterService) GetCluster

GetCluster records the call and dispatches via GetClusterCalls.

func (*FakeClusterService) GetClusterDownscaleRisk added in v0.28.0

GetClusterDownscaleRisk records the call and dispatches via GetClusterDownscaleRiskCalls.

func (*FakeClusterService) ListClusters

ListClusters records the call and dispatches via ListClustersCalls.

func (*FakeClusterService) ListQdrantReleases

ListQdrantReleases records the call and dispatches via ListQdrantReleasesCalls.

func (*FakeClusterService) RestartCluster

RestartCluster records the call and dispatches via RestartClusterCalls.

func (*FakeClusterService) SuggestClusterName

SuggestClusterName records the call and dispatches via SuggestClusterNameCalls.

func (*FakeClusterService) SuspendCluster

SuspendCluster records the call and dispatches via SuspendClusterCalls.

func (*FakeClusterService) UnsuspendCluster

UnsuspendCluster records the call and dispatches via UnsuspendClusterCalls.

func (*FakeClusterService) UpdateCluster

UpdateCluster records the call and dispatches via UpdateClusterCalls.

type FakeDatabaseApiKeyService

FakeDatabaseApiKeyService is a test fake that implements DatabaseApiKeyServiceServer. Use the *Calls fields to configure responses and inspect captured requests.

func (*FakeDatabaseApiKeyService) CreateDatabaseApiKey

CreateDatabaseApiKey records the call and dispatches via CreateDatabaseApiKeyCalls.

func (*FakeDatabaseApiKeyService) DeleteDatabaseApiKey

DeleteDatabaseApiKey records the call and dispatches via DeleteDatabaseApiKeyCalls.

func (*FakeDatabaseApiKeyService) ListDatabaseApiKeys

ListDatabaseApiKeys records the call and dispatches via ListDatabaseApiKeysCalls.

type FakeHybridService added in v0.15.0

FakeHybridService is a test fake that implements HybridCloudServiceServer. Use the *Calls fields to configure responses and inspect captured requests.

func (*FakeHybridService) CreateHybridCloudEnvironment added in v0.15.0

CreateHybridCloudEnvironment records the call and dispatches via CreateHybridCloudEnvironmentCalls.

func (*FakeHybridService) DeleteHybridCloudEnvironment added in v0.15.0

DeleteHybridCloudEnvironment records the call and dispatches via DeleteHybridCloudEnvironmentCalls.

func (*FakeHybridService) GenerateBootstrapCommands added in v0.15.0

GenerateBootstrapCommands records the call and dispatches via GenerateBootstrapCommandsCalls.

func (*FakeHybridService) GetHybridCloudEnvironment added in v0.15.0

GetHybridCloudEnvironment records the call and dispatches via GetHybridCloudEnvironmentCalls.

func (*FakeHybridService) ListHybridCloudEnvironments added in v0.15.0

ListHybridCloudEnvironments records the call and dispatches via ListHybridCloudEnvironmentsCalls.

func (*FakeHybridService) UpdateHybridCloudEnvironment added in v0.15.0

UpdateHybridCloudEnvironment records the call and dispatches via UpdateHybridCloudEnvironmentCalls.

type FakeIAMService added in v0.20.0

FakeIAMService is a test fake that implements IAMServiceServer. Use the *Calls fields to configure responses and inspect captured requests.

func (*FakeIAMService) AssignUserRoles added in v0.20.0

AssignUserRoles records the call and dispatches via AssignUserRolesCalls.

func (*FakeIAMService) CreateRole added in v0.20.0

CreateRole records the call and dispatches via CreateRoleCalls.

func (*FakeIAMService) DeleteRole added in v0.20.0

DeleteRole records the call and dispatches via DeleteRoleCalls.

func (*FakeIAMService) DeleteUser added in v0.25.0

DeleteUser records the call and dispatches via DeleteUserCalls.

func (*FakeIAMService) GetAuthenticatedUser added in v0.20.0

GetAuthenticatedUser records the call and dispatches via GetAuthenticatedUserCalls.

func (*FakeIAMService) GetRole added in v0.20.0

GetRole records the call and dispatches via GetRoleCalls.

func (*FakeIAMService) ListPermissions added in v0.20.0

ListPermissions records the call and dispatches via ListPermissionsCalls.

func (*FakeIAMService) ListRoles added in v0.20.0

ListRoles records the call and dispatches via ListRolesCalls.

func (*FakeIAMService) ListUserRoles added in v0.20.0

ListUserRoles records the call and dispatches via ListUserRolesCalls.

func (*FakeIAMService) ListUsers added in v0.20.0

ListUsers records the call and dispatches via ListUsersCalls.

func (*FakeIAMService) UpdateRole added in v0.20.0

UpdateRole records the call and dispatches via UpdateRoleCalls.

type FakeMeteringService added in v0.37.0

FakeMeteringService is a test fake that implements MeteringServiceServer. Use the *Calls fields to configure responses and inspect captured requests.

func (*FakeMeteringService) GetUsageBreakdown added in v0.37.0

GetUsageBreakdown records the call and dispatches via GetUsageBreakdownCalls.

type FakeMonitoringService added in v0.17.0

FakeMonitoringService is a test fake that implements MonitoringServiceServer. Use the *Calls fields to configure responses and inspect captured requests.

func (*FakeMonitoringService) GetClusterLogs added in v0.17.0

GetClusterLogs records the call and dispatches via GetClusterLogsCalls.

func (*FakeMonitoringService) GetClusterSummaryMetrics added in v0.36.0

GetClusterSummaryMetrics records the call and dispatches via GetClusterSummaryMetricsCalls.

func (*FakeMonitoringService) GetClusterUsageMetrics added in v0.36.0

GetClusterUsageMetrics records the call and dispatches via GetClusterUsageMetricsCalls.

func (*FakeMonitoringService) ListClusterAlerts added in v0.32.0

ListClusterAlerts records the call and dispatches via ListClusterAlertsCalls.

type FakeOAuthServer added in v0.34.0

type FakeOAuthServer struct {
	// Cluster names the environment: the API is api.<Cluster>.qdrant.io, the login server
	// login.<Cluster>.qdrant.io. The default is development-cloud.
	Cluster string
	// AccessToken and RefreshToken are what a login issues.
	AccessToken  string
	RefreshToken string
	// RefreshedAccessToken is what a refresh issues.
	RefreshedAccessToken string
	// ExpiresIn is the expires_in of token responses; 0 leaves it out.
	ExpiresIn int
	// RefreshError, when set, is the error code a refresh gets.
	RefreshError string
	// contains filtered or unexported fields
}

FakeOAuthServer is the OAuth setup of one Qdrant Cloud environment: the API's protected-resource metadata and the login server (OpenID configuration, token, device authorization and revocation endpoints). With WithOAuthServer, every OAuth request of the CLI goes to it, whatever its host. The browser login gets the code "test-code" without a browser.

func NewFakeOAuthServer added in v0.34.0

func NewFakeOAuthServer() *FakeOAuthServer

NewFakeOAuthServer returns a FakeOAuthServer for the development environment that issues "access-from-login" and "refresh-from-login", valid for an hour.

func (*FakeOAuthServer) DeviceForms added in v0.34.0

func (f *FakeOAuthServer) DeviceForms() []url.Values

DeviceForms returns the forms posted to the device authorization endpoint, in order.

func (*FakeOAuthServer) Revoked added in v0.34.0

func (f *FakeOAuthServer) Revoked() []string

Revoked returns the refresh tokens that were revoked, in order.

func (*FakeOAuthServer) TokenForms added in v0.34.0

func (f *FakeOAuthServer) TokenForms() []url.Values

TokenForms returns the forms posted to the token endpoint, in order.

type FakePlatformService

FakePlatformService is a test fake that implements PlatformServiceServer. Use the *Calls fields to configure responses and inspect captured requests.

func (*FakePlatformService) ListCloudProviderRegions

ListCloudProviderRegions records the call and dispatches via ListCloudProviderRegionsCalls.

func (*FakePlatformService) ListCloudProviders

ListCloudProviders records the call and dispatches via ListCloudProvidersCalls.

type FakeServerlessBackupService added in v0.30.0

FakeServerlessBackupService is a test fake that implements the serverless BackupServiceServer. Use the *Calls fields to configure responses and inspect captured requests.

func (*FakeServerlessBackupService) CreateBackup added in v0.30.0

CreateBackup records the call and dispatches via CreateBackupCalls.

func (*FakeServerlessBackupService) CreateBackupSchedule added in v0.30.0

CreateBackupSchedule records the call and dispatches via CreateBackupScheduleCalls.

func (*FakeServerlessBackupService) DeleteBackup added in v0.30.0

DeleteBackup records the call and dispatches via DeleteBackupCalls.

func (*FakeServerlessBackupService) DeleteBackupSchedule added in v0.30.0

DeleteBackupSchedule records the call and dispatches via DeleteBackupScheduleCalls.

func (*FakeServerlessBackupService) GetBackup added in v0.30.0

GetBackup records the call and dispatches via GetBackupCalls.

func (*FakeServerlessBackupService) GetBackupSchedule added in v0.30.0

GetBackupSchedule records the call and dispatches via GetBackupScheduleCalls.

func (*FakeServerlessBackupService) ListBackupRestores added in v0.30.0

ListBackupRestores records the call and dispatches via ListBackupRestoresCalls.

func (*FakeServerlessBackupService) ListBackupSchedules added in v0.30.0

ListBackupSchedules records the call and dispatches via ListBackupSchedulesCalls.

func (*FakeServerlessBackupService) ListBackups added in v0.30.0

ListBackups records the call and dispatches via ListBackupsCalls.

func (*FakeServerlessBackupService) RestoreBackup added in v0.30.0

RestoreBackup records the call and dispatches via RestoreBackupCalls.

func (*FakeServerlessBackupService) UpdateBackupSchedule added in v0.30.0

UpdateBackupSchedule records the call and dispatches via UpdateBackupScheduleCalls.

type FakeServerlessMonitoringService added in v0.31.0

FakeServerlessMonitoringService is a test fake that implements the serverless MonitoringServiceServer. Use the *Calls fields to configure responses and inspect captured requests.

func (*FakeServerlessMonitoringService) GetSpaceInferenceMetrics added in v0.31.0

GetSpaceInferenceMetrics records the call and dispatches via GetSpaceInferenceMetricsCalls.

func (*FakeServerlessMonitoringService) GetSpaceSummaryMetrics added in v0.31.0

GetSpaceSummaryMetrics records the call and dispatches via GetSpaceSummaryMetricsCalls.

func (*FakeServerlessMonitoringService) GetSpaceUsageMetrics added in v0.31.0

GetSpaceUsageMetrics records the call and dispatches via GetSpaceUsageMetricsCalls.

func (*FakeServerlessMonitoringService) ListSpaceAlerts added in v0.31.0

ListSpaceAlerts records the call and dispatches via ListSpaceAlertsCalls.

type FakeServerlessPlatformService added in v0.31.0

FakeServerlessPlatformService is a test fake that implements the serverless PlatformServiceServer. Use the *Calls fields to configure responses and inspect captured requests.

func (*FakeServerlessPlatformService) GetCloudRegion added in v0.31.0

GetCloudRegion records the call and dispatches via GetCloudRegionCalls.

func (*FakeServerlessPlatformService) ListCloudRegions added in v0.31.0

ListCloudRegions records the call and dispatches via ListCloudRegionsCalls.

type FakeServerlessQuotaService added in v0.31.0

FakeServerlessQuotaService is a test fake that implements the serverless QuotaServiceServer. Use the *Calls fields to configure responses and inspect captured requests.

func (*FakeServerlessQuotaService) GetQuotas added in v0.31.0

GetQuotas records the call and dispatches via GetQuotasCalls.

type FakeServerlessSampleDatasetService added in v0.37.0

FakeServerlessSampleDatasetService is a test fake that implements the serverless SampleDatasetServiceServer. Use the *Calls fields to configure responses and inspect captured requests.

func (*FakeServerlessSampleDatasetService) GetSampleDatasetLoad added in v0.37.0

GetSampleDatasetLoad records the call and dispatches via GetSampleDatasetLoadCalls.

func (*FakeServerlessSampleDatasetService) ListSampleDatasetLoads added in v0.37.0

ListSampleDatasetLoads records the call and dispatches via ListSampleDatasetLoadsCalls.

func (*FakeServerlessSampleDatasetService) ListSampleDatasets added in v0.37.0

ListSampleDatasets records the call and dispatches via ListSampleDatasetsCalls.

func (*FakeServerlessSampleDatasetService) LoadSampleDataset added in v0.37.0

LoadSampleDataset records the call and dispatches via LoadSampleDatasetCalls.

type FakeServerlessSpaceApiKeyService added in v0.30.0

FakeServerlessSpaceApiKeyService is a test fake that implements the serverless SpaceApiKeyServiceServer. Use the *Calls fields to configure responses and inspect captured requests.

func (*FakeServerlessSpaceApiKeyService) CreateSpaceApiKey added in v0.30.0

CreateSpaceApiKey records the call and dispatches via CreateSpaceApiKeyCalls.

func (*FakeServerlessSpaceApiKeyService) DeleteSpaceApiKey added in v0.30.0

DeleteSpaceApiKey records the call and dispatches via DeleteSpaceApiKeyCalls.

func (*FakeServerlessSpaceApiKeyService) ListSpaceApiKeys added in v0.30.0

ListSpaceApiKeys records the call and dispatches via ListSpaceApiKeysCalls.

type FakeServerlessSpaceService added in v0.30.0

FakeServerlessSpaceService is a test fake that implements the serverless SpaceServiceServer. Use the *Calls fields to configure responses and inspect captured requests.

func (*FakeServerlessSpaceService) CreateSpace added in v0.30.0

CreateSpace records the call and dispatches via CreateSpaceCalls.

func (*FakeServerlessSpaceService) CreateSpaceFromBackup added in v0.30.0

CreateSpaceFromBackup records the call and dispatches via CreateSpaceFromBackupCalls.

func (*FakeServerlessSpaceService) DeleteSpace added in v0.30.0

DeleteSpace records the call and dispatches via DeleteSpaceCalls.

func (*FakeServerlessSpaceService) GetSpace added in v0.30.0

GetSpace records the call and dispatches via GetSpaceCalls.

func (*FakeServerlessSpaceService) ListSpaces added in v0.30.0

ListSpaces records the call and dispatches via ListSpacesCalls.

func (*FakeServerlessSpaceService) SuggestSpaceName added in v0.30.0

SuggestSpaceName records the call and dispatches via SuggestSpaceNameCalls.

func (*FakeServerlessSpaceService) UpdateSpace added in v0.30.0

UpdateSpace records the call and dispatches via UpdateSpaceCalls.

type MethodSpy added in v0.3.0

type MethodSpy[Req, Resp any] struct {
	// contains filtered or unexported fields
}

MethodSpy records calls to a single RPC method and optionally dispatches to per-call or fallback handlers. Use the *Calls fields on fake services instead of managing call counters and captured requests manually.

Priority when handling a call: *Func field > OnCall handler > Always handler > Unimplemented default.

func (*MethodSpy[Req, Resp]) All added in v0.3.0

func (m *MethodSpy[Req, Resp]) All() []Req

All returns a copy of all captured requests in call order.

func (*MethodSpy[Req, Resp]) Always added in v0.3.0

func (m *MethodSpy[Req, Resp]) Always(fn func(context.Context, Req) (Resp, error)) *MethodSpy[Req, Resp]

Always sets a fallback handler invoked for every call that has no matching OnCall entry. If neither OnCall nor Always is set the method falls back to the gRPC Unimplemented default.

func (*MethodSpy[Req, Resp]) Count added in v0.3.0

func (m *MethodSpy[Req, Resp]) Count() int

Count returns how many times the method has been called.

func (*MethodSpy[Req, Resp]) Last added in v0.3.0

func (m *MethodSpy[Req, Resp]) Last() (Req, bool)

Last returns the most recent request and true, or the zero value and false if never called.

func (*MethodSpy[Req, Resp]) OnCall added in v0.3.0

func (m *MethodSpy[Req, Resp]) OnCall(i int, fn func(context.Context, Req) (Resp, error)) *MethodSpy[Req, Resp]

OnCall registers a handler for the i-th call (0-indexed). Chainable.

func (*MethodSpy[Req, Resp]) Reset added in v0.3.0

func (m *MethodSpy[Req, Resp]) Reset()

Reset clears captured requests and all registered handlers.

func (*MethodSpy[Req, Resp]) Returns added in v0.3.0

func (m *MethodSpy[Req, Resp]) Returns(resp Resp, err error) *MethodSpy[Req, Resp]

Returns sets a fixed response returned for every call (shorthand for Always with a constant return).

type Option

type Option func(*envConfig)

Option configures a TestEnv.

func WithAPIKey

func WithAPIKey(key string) Option

WithAPIKey sets the API key used by the test client's auth interceptor.

func WithAccountID

func WithAccountID(id string) Option

WithAccountID sets the default account ID pre-configured on the test state.

func WithOAuthServer added in v0.34.0

func WithOAuthServer(f *FakeOAuthServer) Option

WithOAuthServer sends the OAuth requests of the login to f instead of failing them.

func WithSecretStore added in v0.34.0

func WithSecretStore(secrets oauth.SecretStore) Option

WithSecretStore keeps the OAuth tokens in secrets instead of a new in-memory keychain. Use it to test a keychain that fails.

func WithVersion

func WithVersion(v string) Option

WithVersion sets the CLI version used in the user-agent header.

type RequestCapture

type RequestCapture struct {
	// contains filtered or unexported fields
}

RequestCapture is a server-side unary interceptor that records incoming metadata.

func (*RequestCapture) Last

func (rc *RequestCapture) Last() metadata.MD

Last returns the metadata from the most recent request.

type TestEnv

type TestEnv struct {
	State                       *state.State
	Server                      *FakeClusterService
	BookingServer               *FakeBookingService
	PlatformServer              *FakePlatformService
	DatabaseApiKeyServer        *FakeDatabaseApiKeyService
	BackupServer                *FakeBackupService
	HybridServer                *FakeHybridService
	MonitoringServer            *FakeMonitoringService
	AuthServer                  *FakeAuthService
	IAMServer                   *FakeIAMService
	AccountServer               *FakeAccountService
	MeteringServer              *FakeMeteringService
	ServerlessSpaceServer       *FakeServerlessSpaceService
	ServerlessSpaceApiKeyServer *FakeServerlessSpaceApiKeyService
	ServerlessBackupServer      *FakeServerlessBackupService
	ServerlessPlatformServer    *FakeServerlessPlatformService
	ServerlessQuotaServer       *FakeServerlessQuotaService
	ServerlessMonitoringServer  *FakeServerlessMonitoringService
	ServerlessDatasetServer     *FakeServerlessSampleDatasetService
	Capture                     *RequestCapture
	Cleanup                     func()
}

TestEnv bundles everything a test needs.

func NewBareTestEnv

func NewBareTestEnv(t *testing.T, opts ...Option) *TestEnv

NewBareTestEnv creates a test environment with a bufconn-backed gRPC server but with no config values pre-populated in viper. Use this when the test itself controls how config is loaded — for example, to verify that account_id is read from a config file, an environment variable, or a CLI flag. WithAPIKey and WithAccountID have no effect here.

func NewTestEnv

func NewTestEnv(t *testing.T, opts ...Option) *TestEnv

NewTestEnv creates a test environment with a bufconn-backed gRPC server and a pre-populated config. account_id and api_key are set via the highest viper priority (Set), so they reliably override any machine environment variables. Use this for testing command behaviour where a valid account ID is needed but its specific source doesn't matter. Defaults: account_id="test-account-id". Override with WithAccountID / WithAPIKey.

Jump to

Keyboard shortcuts

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