Documentation
¶
Index ¶
Examples ¶
Constants ¶
View Source
const ( DefaultUser = "admin" DefaultPassword = "password" DefaultToken = "password" )
Variables ¶
This section is empty.
Functions ¶
func WithAuth ¶ added in v0.1.6
func WithAuth() testcontainers.CustomizeRequestOption
WithAuth enables authentication on http proxies and creates `admin` user with password and token `password`.
Types ¶
type YTsaurusContainer ¶
type YTsaurusContainer struct {
testcontainers.Container
}
YTsaurusContainer represents the YTsaurus container type used in the module.
func RunContainer ¶
func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*YTsaurusContainer, error)
RunContainer creates and starts an instance of the YTsaurus container.
Example ¶
ctx := context.Background()
// Start a YTsaurus container
container, err := ytsaurus.RunContainer(ctx, testcontainers.WithImage("ytsaurus/local:stable"))
if err != nil {
fmt.Printf("Error starting container: %s\n", err)
return
}
// Clean up the container after the example is complete
defer func() {
if err := container.Terminate(ctx); err != nil {
fmt.Printf("Error terminating container: %s\n", err)
}
}()
// Create a YT client
ytClient, err := container.NewClient(ctx)
if err != nil {
fmt.Printf("Error creating YT client: %s\n", err)
return
}
// List root
var owner string
err = ytClient.GetNode(ctx, ypath.Path("//home").Attr("owner"), &owner, nil)
if err != nil {
fmt.Printf("Get attr: %+v", err)
return
}
fmt.Printf("Owner: %v\n", owner)
Output: Owner: root
func (*YTsaurusContainer) ConnectionHost ¶
func (y *YTsaurusContainer) ConnectionHost(ctx context.Context) (string, error)
ConnectionHost returns the host and dynamic port for accessing the YTsaurus container.
func (*YTsaurusContainer) GetProxy ¶ added in v0.1.5
func (y *YTsaurusContainer) GetProxy(ctx context.Context) (string, error)
GetProxy is an alias for ConnectionHost since `proxy` is more familiar term for in YTsaurus.
func (*YTsaurusContainer) NewClient ¶
NewClient creates a new YT client connected to the YTsaurus container.
func (*YTsaurusContainer) Token ¶
func (y *YTsaurusContainer) Token() string
Token returns the token for the YTsaurus container.
Click to show internal directories.
Click to hide internal directories.