Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type YTsaurusContainer ¶ added in v0.1.2
type YTsaurusContainer struct {
testcontainers.Container
}
YTsaurusContainer represents the YTsaurus container type used in the module.
func RunContainer ¶ added in v0.1.2
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 ¶ added in v0.1.2
func (y *YTsaurusContainer) ConnectionHost(ctx context.Context) (string, error)
ConnectionHost returns the host and dynamic port for accessing the YTsaurus container.
func (*YTsaurusContainer) NewClient ¶ added in v0.1.2
NewClient creates a new YT client connected to the YTsaurus container.
func (*YTsaurusContainer) Token ¶ added in v0.1.2
func (y *YTsaurusContainer) Token() string
Token returns the token for the YTsaurus container.
Click to show internal directories.
Click to hide internal directories.