azure

package
v0.0.0-rc8 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

README

Testcontainers for Azurite and Event Hubs

Azurite

The Azurite open-source emulator provides a free local environment for testing your Azure Blob, Queue Storage, and Table Storage applications.

Blob Storage is optimized for storing massive amounts of unstructured data. Unstructured data is data that doesn't adhere to a particular data model or definition, such as text or binary data.

Azure Queue Storage is a service for storing large numbers of messages. You access messages from anywhere in the world via authenticated calls using HTTP or HTTPS.

Table storage is used to store petabytes of semi-structured data and keep costs down. Unlike many data stores—on-premises or cloud-based—Table storage lets you scale up without having to manually shard your dataset.

Testcontainer reference from here

Event Hubs

Azure Event Hubs is a native data-streaming service in the cloud that can stream millions of events per second, with low latency, from any source to any destination.

Same testcontainer reference was used here as well

Code:

  • AzuriteContainer struct represents the Azurite container type used in the module
  • EventHubContainer struct depends on Azurite container
  • type Service is a set of constants with types of services
  • withEventHub writes config

Documentation

Index

Constants

View Source
const (
	// Default ports used by Azurite
	BlobPort  = "10000/tcp"
	QueuePort = "10001/tcp"
	TablePort = "10002/tcp"
)
View Source
const (
	// AccountName is the default testing account name used by Azurite
	AccountName string = "devstoreaccount1"
	// AccountKey is the default testing account key used by Azurite
	AccountKey string = "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="
)
View Source
const (
	EventHubPort = "5672/tcp"
)

Variables

This section is empty.

Functions

func WithEventHub

func WithEventHub(req *testcontainers.GenericContainerRequest) error

func WithInMemoryPersistence

func WithInMemoryPersistence(megabytes float64) testcontainers.CustomizeRequestOption

This option is only available for Azurite v3.28.0 and later.

Types

type AzuriteContainer

type AzuriteContainer struct {
	testcontainers.Container
	Settings options
}

AzuriteContainer represents the Azurite container type used in the module

func RunAzurite

func RunAzurite(ctx context.Context, img string, opts ...testcontainers.ContainerCustomizer) (*AzuriteContainer, error)

Run creates an instance of the Azurite container type

func (*AzuriteContainer) MustServiceURL

func (c *AzuriteContainer) MustServiceURL(ctx context.Context, srv Service) string

func (*AzuriteContainer) ServiceURL

func (c *AzuriteContainer) ServiceURL(ctx context.Context, srv Service) (string, error)

type EventHubContainer

type EventHubContainer struct {
	testcontainers.Container
	Settings options
}

EventHubContainer represents the Eventhub container type used in the module

func RunEventHub

func RunEventHub(ctx context.Context, img string, blobAddress string, opts ...testcontainers.ContainerCustomizer) (*EventHubContainer, error)

Run creates an instance of the Eventhub container type

func (*EventHubContainer) MustServiceURL

func (c *EventHubContainer) MustServiceURL(ctx context.Context) string

func (*EventHubContainer) ServiceURL

func (c *EventHubContainer) ServiceURL(ctx context.Context) (string, error)

type Service

type Service string
const (
	BlobService  Service = "blob"
	QueueService Service = "queue"
	TableService Service = "table"

	EventHubService = "eventhub"
)

Jump to

Keyboard shortcuts

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