Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Container ¶
type Container struct {
testcontainers.Container
}
Container represents the Timeplus container type used in the module.
func Run ¶
func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustomizer) (*Container, error)
Run creates an instance of the Timeplus container type.
Example ¶
package main
import (
"context"
"fmt"
"log"
"github.com/testcontainers/testcontainers-go"
"github.com/testcontainers/testcontainers-go/modules/timeplus"
)
func main() {
// runTimeplusContainer {
ctx := context.Background()
timeplusContainer, err := timeplus.Run(ctx, "timeplus/timeplusd:2.3.37")
defer func() {
if err := testcontainers.TerminateContainer(timeplusContainer); err != nil {
log.Printf("failed to terminate container: %s", err)
}
}()
if err != nil {
log.Printf("failed to start container: %s", err)
return
}
// }
state, err := timeplusContainer.State(ctx)
if err != nil {
log.Printf("failed to get container state: %s", err)
return
}
fmt.Println(state.Running)
}
Output: true
func (*Container) HTTPEndpoint ¶
HTTPEndpoint returns the HTTP endpoint of the Timeplus container for the ClickHouse-compatible HTTP API (port 8123). The returned URL has the form "http://host:port".
Example ¶
package main
import (
"context"
"fmt"
"log"
"github.com/testcontainers/testcontainers-go"
"github.com/testcontainers/testcontainers-go/modules/timeplus"
)
func main() {
ctx := context.Background()
timeplusContainer, err := timeplus.Run(ctx, "timeplus/timeplusd:2.3.37")
defer func() {
if err := testcontainers.TerminateContainer(timeplusContainer); err != nil {
log.Printf("failed to terminate container: %s", err)
}
}()
if err != nil {
log.Printf("failed to start container: %s", err)
return
}
httpEndpoint, err := timeplusContainer.HTTPEndpoint(ctx)
if err != nil {
log.Printf("failed to get HTTP endpoint: %s", err)
return
}
fmt.Println(len(httpEndpoint) > 0)
}
Output: true
Click to show internal directories.
Click to hide internal directories.