Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithFunctionsWorker ¶
func WithFunctionsWorker() testcontainers.CustomizeRequestOption
WithFunctionsWorker enables the functions worker, which will override the default pulsar command and add a waiting strategy for the functions worker
func WithPulsarEnv ¶
func WithPulsarEnv(configVar string, configValue string) testcontainers.CustomizeRequestOption
WithPulsarEnv allows to use the native APIs and set each variable with PULSAR_PREFIX_ as prefix.
func WithTransactions ¶
func WithTransactions() testcontainers.CustomizeRequestOption
Types ¶
type Container ¶
type Container struct {
testcontainers.Container
LogConsumers []testcontainers.LogConsumer // Deprecated. Use the ContainerRequest instead. Needs to be exported to control the stop from the caller
}
func Run ¶ added in v0.32.0
func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustomizer) (*Container, error)
Run creates an instance of the Pulsar container type, being possible to pass a custom request and options The created container will use the following defaults: - image: apachepulsar/pulsar:2.10.2 - exposed ports: 6650/tcp, 8080/tcp - waiting strategy: wait for all the following strategies:
- the Pulsar admin API ("/admin/v2/clusters") to be ready on port 8080/tcp and return the response `["standalone"]`
- the log message "Successfully updated the policies on namespace public/default"
- command: "/bin/bash -c /pulsar/bin/apply-config-from-env.py /pulsar/conf/standalone.conf && bin/pulsar standalone --no-functions-worker -nss"
Example ¶
// runPulsarContainer {
ctx := context.Background()
pulsarContainer, err := pulsar.Run(ctx, "apachepulsar/pulsar:2.10.2")
defer func() {
if err := testcontainers.TerminateContainer(pulsarContainer); err != nil {
log.Printf("failed to terminate container: %s", err)
}
}()
if err != nil {
log.Printf("failed to start container: %s", err)
return
}
// }
state, err := pulsarContainer.State(ctx)
if err != nil {
log.Printf("failed to get container state: %s", err)
return
}
fmt.Println(state.Running)
Output: true
func RunContainer
deprecated
added in
v0.20.0
func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*Container, error)
Deprecated: use Run instead RunContainer creates an instance of the Pulsar container type
func (*Container) HTTPServiceURL ¶
func (*Container) WithLogConsumers
deprecated
added in
v0.20.0
func (c *Container) WithLogConsumers(ctx context.Context, _ ...testcontainers.LogConsumer)
Deprecated: use the testcontainers.WithLogConsumers functional option instead WithLogConsumers allows to add log consumers to the container. They will be automatically started and they will follow the container logs, but it's a responsibility of the caller to stop them calling StopLogProducer