Files
es-demo/operations/cluster/cluster_test.go

41 lines
917 B
Go

package cluster
import (
"context"
"testing"
"time"
"es-demo/client"
)
func TestGetInfo(t *testing.T) {
// This is a unit test that doesn't require real connection
// Integration tests should be run separately
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
cfg := &client.Config{
Endpoint: "https://example.com",
Region: "us-east-1",
AccessKey: "test-key",
SecretKey: "test-secret",
}
c, err := client.NewClient(cfg)
if err != nil {
t.Fatalf("failed to create client: %v", err)
}
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
// This will fail without a real cluster, which is expected in unit tests
_, err = GetInfo(ctx, c)
// We just verify the method signature is correct
// Real integration tests would check actual responses
if err == nil {
t.Log("GetInfo succeeded (unexpected in unit test)")
}
}