testcommon

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultEndpointSuffix       = "core.windows.net/"
	DefaultQueueEndpointSuffix  = "queue.core.windows.net/"
	AccountNameEnvVar           = "AZURE_STORAGE_ACCOUNT_NAME"
	AccountKeyEnvVar            = "AZURE_STORAGE_ACCOUNT_KEY"
	DefaultEndpointSuffixEnvVar = "AZURE_STORAGE_ENDPOINT_SUFFIX"
)
View Source
const (
	FakeStorageAccount = "fakestorage"
	FakeStorageURL     = "https://fakestorage.queue.core.windows.net"
)
View Source
const (
	QueuePrefix      = "goq"
	QueueDefaultData = "this is some default data"
)

Variables

View Source
var BasicMetadata = map[string]*string{"Foo": to.Ptr("bar")}

Functions

func AfterTest

func AfterTest(t *testing.T, suite string, test string)

func BeforeTest

func BeforeTest(t *testing.T, suite string, test string)

func CreateNewQueue

func CreateNewQueue(ctx context.Context, _require *require.Assertions, queueName string, serviceClient *azqueue.ServiceClient) *azqueue.QueueClient

func DeleteQueue

func DeleteQueue(ctx context.Context, _require *require.Assertions, queueClient *azqueue.QueueClient)

func GenerateEntityName

func GenerateEntityName(testName string) string

func GenerateName

func GenerateName(prefix string) string

func GenerateQueueName

func GenerateQueueName(testName string) string

func GetAccountInfo

func GetAccountInfo(accountType TestAccountType) (string, string)

func GetConnectionString

func GetConnectionString(accountType TestAccountType) string

func GetGenericCredential

func GetGenericCredential(accountType TestAccountType) (*azqueue.SharedKeyCredential, error)

func GetQueueClient

func GetQueueClient(queueName string, serviceClient *azqueue.ServiceClient) *azqueue.QueueClient

func GetRequiredEnv

func GetRequiredEnv(name string) (string, error)

GetRequiredEnv gets an environment variable by name and returns an error if it is not found

func GetServiceClient

func GetServiceClient(t *testing.T, accountType TestAccountType, options *azqueue.ClientOptions) (*azqueue.ServiceClient, error)

func GetServiceClientFromConnectionString

func GetServiceClientFromConnectionString(t *testing.T, accountType TestAccountType, options *azqueue.ClientOptions) (*azqueue.ServiceClient, error)

func ValidateHTTPErrorCode

func ValidateHTTPErrorCode(_require *require.Assertions, err error, code int)

func ValidateQueueErrorCode

func ValidateQueueErrorCode(_require *require.Assertions, err error, code queueerror.Code)

Types

type TestAccountType

type TestAccountType string
const (
	TestAccountDefault   TestAccountType = ""
	TestAccountSecondary TestAccountType = "SECONDARY_"
	TestAccountPremium   TestAccountType = "PREMIUM_"
)

Jump to

Keyboard shortcuts

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