package test
import "github.com/Azure/azure-sdk-for-go/sdk/messaging/azservicebus/internal/test"
Index ¶
- Constants
- Variables
- func CaptureLogsForTest(echo bool) func() []string
- func CaptureLogsForTestWithChannel(messagesCh chan string, echo bool) func() []string
- func CreateExpiringQueue(t *testing.T, qd *atom.QueueDescription) (string, func())
- func EnableStdoutLogging(t *testing.T)
- func GetConnectionString(t *testing.T, name EnvKey) string
- func MustAMQPUUID() amqp.UUID
- func MustGetEnvVar(t *testing.T, name EnvKey) string
- func MustGetEnvVars[KeyT ~string](keys []KeyT) map[KeyT]string
- func NewClient[OptionsT any, ClientT any](t *testing.T, args NewClientArgs[OptionsT, ClientT], options *NewClientOptions[OptionsT]) *ClientT
- func RandomString(prefix string, length int) string
- func RequireClose(t *testing.T, closeable interface { Close(ctx context.Context) error })
- func RequireLinksClose(t *testing.T, closeable interface { Close(ctx context.Context, permanent bool) error })
- func RequireNSClose(t *testing.T, closeable interface { Close(permanent bool) error })
- type EnvKey
- type IdentityVars
- type NewClientArgs
- type NewClientOptions
Constants ¶
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 ¶
Functions ¶
func CaptureLogsForTest ¶
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 ¶
func CreateExpiringQueue ¶
func CreateExpiringQueue(t *testing.T, qd *atom.QueueDescription) (string, func())
func EnableStdoutLogging ¶
EnableStdoutLogging turns on logging to stdout for diagnostics.
func GetConnectionString ¶
func MustAMQPUUID ¶
func MustAMQPUUID() amqp.UUID
func MustGetEnvVar ¶
func MustGetEnvVars ¶
func NewClient ¶
func NewClient[OptionsT any, ClientT any](t *testing.T, args NewClientArgs[OptionsT, ClientT], options *NewClientOptions[OptionsT]) *ClientT
func RandomString ¶
RandomString generates a random string with prefix
func RequireClose ¶
func RequireLinksClose ¶
func RequireLinksClose(t *testing.T, closeable interface { Close(ctx context.Context, permanent bool) error })
func RequireNSClose ¶
Types ¶
type EnvKey ¶
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 ¶
type IdentityVars struct { Endpoint string PremiumEndpoint string Cred azcore.TokenCredential }
func GetIdentityVars ¶
func GetIdentityVars(t *testing.T) *IdentityVars
type NewClientArgs ¶
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 ¶
type NewClientOptions[OptionsT any] struct { ClientOptions *OptionsT UseConnectionString bool UsePremium bool }
Source Files ¶
- Version
- v1.8.0 (latest)
- Published
- Feb 8, 2025
- Platform
- linux/amd64
- Imports
- 19 packages
- Last checked
- 4 months ago –
Tools for package owners.