test

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BuiltInTestQueue             = "testQueue"
	BuildInTestQueueWithSessions = "testQueueWithSessions"
)

these are created by the test-resources.bicep template - they're useful for tests where we don't need to guaranteee any state, just existence, like our connectivity/recovery tests.

Variables

View Source
var LoggingChannelValue atomic.Value

Functions

func CaptureLogsForTest added in v0.3.6

func CaptureLogsForTest(echo bool) func() []string

CaptureLogsForTest adds a logging listener which captures messages to an internal channel. Returns a function that ends log capturing and returns any captured messages. It's safe to call endCapture() multiple times, so a simple call pattern is:

endCapture := CaptureLogsForTest()
defer endCapture()				// ensure cleanup in case of test assert failures

/* some test code */

messages := endCapture()
/* do inspection of log messages */

func CaptureLogsForTestWithChannel added in v0.4.0

func CaptureLogsForTestWithChannel(messagesCh chan string, echo bool) func() []string

func CreateExpiringQueue added in v0.3.4

func CreateExpiringQueue(t *testing.T, qd *atom.QueueDescription) (string, func())

func EnableStdoutLogging added in v0.3.6

func EnableStdoutLogging(t *testing.T)

EnableStdoutLogging turns on logging to stdout for diagnostics.

func MustAMQPUUID added in v1.2.0

func MustAMQPUUID() amqp.UUID

func MustGetEnvVar added in v1.7.2

func MustGetEnvVar(t *testing.T, name EnvKey) string

func MustGetEnvVars added in v1.7.2

func MustGetEnvVars[KeyT ~string](keys []KeyT) map[KeyT]string

func NewClient added in v1.7.2

func NewClient[OptionsT any, ClientT any](t *testing.T, args NewClientArgs[OptionsT, ClientT], options *NewClientOptions[OptionsT]) *ClientT

func RandomString

func RandomString(prefix string, length int) string

RandomString generates a random string with prefix

func RequireClose added in v1.2.0

func RequireClose(t *testing.T, closeable interface {
	Close(ctx context.Context) error
})

func RequireLinksClose added in v1.2.0

func RequireLinksClose(t *testing.T, closeable interface {
	Close(ctx context.Context, permanent bool) error
})

func RequireNSClose added in v1.2.0

func RequireNSClose(t *testing.T, closeable interface {
	Close(permanent bool) error
})

Types

type EnvKey added in v1.7.2

type EnvKey string
const (
	EnvKeyEndpoint                   EnvKey = "SERVICEBUS_ENDPOINT"
	EnvKeyEndpointPremium            EnvKey = "SERVICEBUS_ENDPOINT_PREMIUM"
	EnvKeyConnectionString           EnvKey = "SERVICEBUS_CONNECTION_STRING"
	EnvKeyConnectionStringPremium    EnvKey = "SERVICEBUS_CONNECTION_STRING_PREMIUM"
	EnvKeyConnectionStringNoManage   EnvKey = "SERVICEBUS_CONNECTION_STRING_NO_MANAGE"
	EnvKeyConnectionStringSendOnly   EnvKey = "SERVICEBUS_CONNECTION_STRING_SEND_ONLY"
	EnvKeyConnectionStringListenOnly EnvKey = "SERVICEBUS_CONNECTION_STRING_LISTEN_ONLY"
)

type IdentityVars added in v1.7.2

type IdentityVars struct {
	Endpoint        string
	PremiumEndpoint string
	Cred            azcore.TokenCredential
}

func GetIdentityVars added in v1.3.0

func GetIdentityVars(t *testing.T) *IdentityVars

type NewClientArgs added in v1.7.2

type NewClientArgs[OptionsT any, ClientT any] struct {
	NewClientFromConnectionString func(connectionString string, options *OptionsT) (*ClientT, error)
	NewClient                     func(endpoint string, cred azcore.TokenCredential, options *OptionsT) (*ClientT, error)
}

type NewClientOptions added in v1.7.2

type NewClientOptions[OptionsT any] struct {
	ClientOptions       *OptionsT
	UseConnectionString bool
	UsePremium          bool
}

Jump to

Keyboard shortcuts

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