testgcp

package
v1.118.2 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestDependentFolder2ProjectID             = "TEST_DEPENDENT_FOLDER_2_PROJECT_ID"
	TestDependentFolderProjectID              = "TEST_DEPENDENT_FOLDER_PROJECT_ID"
	IsolatedTestOrgName                       = "ISOLATED_TEST_ORG_NAME"
	CloudFunctionsTestProject                 = "CLOUD_FUNCTIONS_TEST_PROJECT"
	InterconnectTestProject                   = "INTERCONNECT_TEST_PROJECT"
	HighCPUQuotaTestProject                   = "HIGH_CPU_QUOTA_TEST_PROJECT"
	DLPTestBucket                             = "DLP_TEST_BUCKET"
	TestDependentOrgProjectIDWithoutQuotation = "TEST_DEPENDENT_ORG_PROJECT_ID_WITHOUT_QUOTATION"
)

Variables

View Source
var (
	TestFolderID                            = EnvVar{Key: "TEST_FOLDER_ID"}
	TestFolder2ID                           = EnvVar{Key: "TEST_FOLDER_2_ID"}
	TestOrgID                               = EnvVar{Key: "TEST_ORG_ID"}
	TestDependentOrgProjectID               = EnvVar{Key: "TEST_DEPENDENT_ORG_PROJECT_ID"}
	TestBillingAccountID                    = EnvVar{Key: "TEST_BILLING_ACCOUNT_ID"}
	IAMIntegrationTestsOrganizationID       = EnvVar{Key: "IAM_INTEGRATION_TESTS_ORGANIZATION_ID"}
	IAMIntegrationTestsBillingAccountID     = EnvVar{Key: "IAM_INTEGRATION_TESTS_BILLING_ACCOUNT_ID"}
	TestBillingAccountIDForBillingResources = EnvVar{Key: "BILLING_ACCOUNT_ID_FOR_BILLING_RESOURCES"}
	TestAttachedClusterName                 = EnvVar{Key: "TEST_ATTACHED_CLUSTER_NAME"}
	TestKCCAttachedClusterProject           = EnvVar{Key: "KCC_ATTACHED_CLUSTER_TEST_PROJECT"}
	FirestoreTestProject                    = EnvVar{Key: "FIRESTORE_TEST_PROJECT"}
	IdentityPlatformTestProject             = EnvVar{Key: "IDENTITY_PLATFORM_TEST_PROJECT"}
	RecaptchaEnterpriseTestProject          = EnvVar{Key: "RECAPTCHA_ENTERPRISE_TEST_PROJECT"}
	TestDependentNoNetworkProjectID         = EnvVar{Key: "TEST_DEPENDENT_NO_NETWORK_PROJECT_ID"} // A dependent project with default network disabled
	TestKCCVertexAIIndexBucket              = EnvVar{Key: "KCC_VERTEX_AI_INDEX_TEST_BUCKET"}
	TestKCCVertexAIIndexDataURI             = EnvVar{Key: "KCC_VERTEX_AI_INDEX_TEST_DATA_URI"}
)

Functions

func FindDefaultServiceAccount added in v1.101.0

func FindDefaultServiceAccount() (string, error)

FindDefaultServiceAccount returns the service account used to access the user's configured default GCP project. If the credentials cannot be found, returns ("", nil)

func GetCloudFunctionsTestProject

func GetCloudFunctionsTestProject(_ *testing.T) string

func GetDLPTestBucket added in v1.97.0

func GetDLPTestBucket(_ *testing.T) string

func GetDefaultProjectID

func GetDefaultProjectID(t *testing.T) string

GetDefaultProjectID returns the ID of user's configured default GCP project.

func GetDependentFolder2ProjectID added in v1.114.0

func GetDependentFolder2ProjectID(_ *testing.T) string

func GetDependentFolderProjectID added in v1.106.0

func GetDependentFolderProjectID(_ *testing.T) string

func GetHighCPUQuotaTestProject added in v1.114.0

func GetHighCPUQuotaTestProject(_ *testing.T) string

func GetIAMPolicyBindingMember

func GetIAMPolicyBindingMember(t *testing.T) string

attempts to return a valid IAM policy binding for the current credential by searching for an email in the cloud credentials file and defaulting to the current user if on a corp machine.

func GetInterconnectTestProject

func GetInterconnectTestProject(_ *testing.T) string

func GetIsolatedTestOrgName

func GetIsolatedTestOrgName(_ *testing.T) string

func GetProjectNumber added in v1.100.0

func GetProjectNumber(ctx context.Context, projectID string) (int64, error)

func NewDefaultHTTPClient

func NewDefaultHTTPClient(t *testing.T) *http.Client

func NewIAMClient

func NewIAMClient(t *testing.T) *iam.Service

func NewResourceManagerClient

func NewResourceManagerClient(t *testing.T) *cloudresourcemanager.Service

func NewStorageClient

func NewStorageClient(t *testing.T) *storage.Service

func ResourceSupportsDeletion

func ResourceSupportsDeletion(resourceKind string) bool

Types

type EnvVar added in v1.112.0

type EnvVar struct {
	Key string
	// contains filtered or unexported fields
}

EnvVar is a wrapper around a value that can be set by an environment variable. This approach allows the value to be changed in tests more easily.

func (*EnvVar) Get added in v1.112.0

func (v *EnvVar) Get() string

func (*EnvVar) Set added in v1.112.0

func (v *EnvVar) Set(s string)

type GCPProject added in v1.100.0

type GCPProject struct {
	ProjectID     string
	ProjectNumber int64
}

func GetDefaultProject added in v1.100.0

func GetDefaultProject(t *testing.T) GCPProject

GetDefaultProject returns the ID of user's configured default GCP project.

Jump to

Keyboard shortcuts

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