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 ¶
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 RunContainer ¶
func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*Container, error)
RunContainer 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: docker.io/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.RunContainer(ctx, testcontainers.WithImage("docker.io/apachepulsar/pulsar:2.10.2"), ) if err != nil { log.Fatalf("failed to start container: %s", err) } // Clean up the container defer func() { if err := pulsarContainer.Terminate(ctx); err != nil { log.Fatalf("failed to terminate container: %s", err) } }() // } state, err := pulsarContainer.State(ctx) if err != nil { log.Fatalf("failed to get container state: %s", err) // nolint:gocritic } fmt.Println(state.Running)
Output: true
func (*Container) HTTPServiceURL ¶
func (*Container) WithLogConsumers
deprecated
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