Documentation
¶
Index ¶
- func CreateClusterWithCleanup(client *APIClient, ctx context.Context, config *TestConfig, ...) (openapi.ComputeClusterRead, string)
- func CreateInstanceWithCleanup(client *APIClient, ctx context.Context, config *TestConfig, ...) (openapi.InstanceRead, string)
- func ExtractMachineID(cluster openapi.ComputeClusterRead) string
- func ExtractMachineIDsFromPool(cluster openapi.ComputeClusterRead, poolName string) []string
- func FindPoolByName(pools []openapi.ComputeClusterWorkloadPool, poolName string) *openapi.ComputeClusterWorkloadPool
- func GetMachineStatus(cluster openapi.ComputeClusterRead, machineID string) string
- func VerifyClusterPresence(clusters []openapi.ComputeClusterRead, expectedClusterIDs []string)
- func VerifyDefaultFirewallRule(cluster *openapi.ComputeClusterRead, poolName string)
- func VerifyMachineEvicted(cluster openapi.ComputeClusterRead, poolName, evictedMachineID string, ...) bool
- func VerifyMultiplePoolsReplicas(cluster *openapi.ComputeClusterRead, poolReplicas map[string]int)
- func VerifyPoolFirewallRules(cluster *openapi.ComputeClusterRead, poolName string, expectedRuleCount int)
- func VerifyPoolReplicas(cluster *openapi.ComputeClusterRead, poolName string, expectedReplicas int)
- func VerifyProjectPresence(clusters []openapi.ComputeClusterRead, expectedProjectIDs []string)
- func VerifyWorkloadPoolUpdate(cluster openapi.ComputeClusterRead, expectedMinPools int)
- func WaitForInstanceActive(client *APIClient, ctx context.Context, config *TestConfig, instanceID string)
- func WaitForMachineStatus(client *APIClient, ctx context.Context, config *TestConfig, ...)
- func WaitForMachinesAvailable(client *APIClient, ctx context.Context, config *TestConfig, clusterID string) string
- func WaitForPoolMachinesActive(client *APIClient, ctx context.Context, config *TestConfig, ...)
- func WaitForPoolReplicas(client *APIClient, ctx context.Context, config *TestConfig, ...)
- type APIClient
- func (c *APIClient) CheckClusterQuota(ctx context.Context, orgID string) error
- func (c *APIClient) CreateCluster(ctx context.Context, orgID, projectID string, body openapi.ComputeClusterWrite) (openapi.ComputeClusterRead, error)
- func (c *APIClient) CreateInstance(ctx context.Context, payload openapi.InstanceCreate) (openapi.InstanceRead, error)
- func (c *APIClient) DeleteCluster(ctx context.Context, orgID, projectID, clusterID string) error
- func (c *APIClient) DeleteInstance(ctx context.Context, instanceID string) error
- func (c *APIClient) EvictMachines(ctx context.Context, orgID, projectID, clusterID string, machineIDs []string) error
- func (c *APIClient) GetCluster(ctx context.Context, orgID, projectID, clusterID string) (openapi.ComputeClusterRead, error)
- func (c *APIClient) GetInstance(ctx context.Context, instanceID string) (openapi.InstanceRead, error)
- func (c *APIClient) GetInstanceConsoleOutput(ctx context.Context, instanceID string, length *int) (*regionopenapi.ConsoleOutputResponse, error)
- func (c *APIClient) HardRebootMachine(ctx context.Context, orgID, projectID, clusterID, machineID string) error
- func (c *APIClient) ListClusters(ctx context.Context, orgID, projectID string) ([]openapi.ComputeClusterRead, error)
- func (c *APIClient) ListFlavors(ctx context.Context, orgID, regionID string) (regionopenapi.Flavors, error)
- func (c *APIClient) ListImages(ctx context.Context, orgID, regionID string) (regionopenapi.Images, error)
- func (c *APIClient) ListOrganizationClusters(ctx context.Context, orgID string) ([]openapi.ComputeClusterRead, error)
- func (c *APIClient) ListRegions(ctx context.Context, orgID string) (regionopenapi.Regions, error)
- func (c *APIClient) SoftRebootMachine(ctx context.Context, orgID, projectID, clusterID, machineID string) error
- func (c *APIClient) StartMachine(ctx context.Context, orgID, projectID, clusterID, machineID string) error
- func (c *APIClient) StopMachine(ctx context.Context, orgID, projectID, clusterID, machineID string) error
- func (c *APIClient) UpdateCluster(ctx context.Context, orgID, projectID, clusterID string, ...) error
- type ClusterInfo
- type ClusterPayloadBuilder
- func (b *ClusterPayloadBuilder) Build() map[string]interface{}
- func (b *ClusterPayloadBuilder) BuildTyped() openapi.ComputeClusterWrite
- func (b *ClusterPayloadBuilder) ClearWorkloadPools() *ClusterPayloadBuilder
- func (b *ClusterPayloadBuilder) WithDescription(desc string) *ClusterPayloadBuilder
- func (b *ClusterPayloadBuilder) WithFlavorID(flavorID string) *ClusterPayloadBuilder
- func (b *ClusterPayloadBuilder) WithImageID(imageID string) *ClusterPayloadBuilder
- func (b *ClusterPayloadBuilder) WithName(name string) *ClusterPayloadBuilder
- func (b *ClusterPayloadBuilder) WithProjectID(projectID string) *ClusterPayloadBuilder
- func (b *ClusterPayloadBuilder) WithRegionID(regionID string) *ClusterPayloadBuilder
- func (b *ClusterPayloadBuilder) WithWorkloadPool(name, flavorID, imageID string, replicas int) *ClusterPayloadBuilder
- type ClusterUpdateFixture
- type Endpoints
- func (e *Endpoints) CreateCluster(orgID, projectID string) string
- func (e *Endpoints) CreateInstance() string
- func (e *Endpoints) DeleteCluster(orgID, projectID, clusterID string) string
- func (e *Endpoints) DeleteInstance(instanceID string) string
- func (e *Endpoints) EvictMachines(orgID, projectID, clusterID string) string
- func (e *Endpoints) GetCluster(orgID, projectID, clusterID string) string
- func (e *Endpoints) GetInstance(instanceID string) string
- func (e *Endpoints) GetInstanceConsoleOutput(instanceID string) string
- func (e *Endpoints) HardRebootMachine(orgID, projectID, clusterID, machineID string) string
- func (e *Endpoints) HealthCheck() string
- func (e *Endpoints) ListClusters(orgID, projectID string) string
- func (e *Endpoints) ListFlavors(orgID, regionID string) string
- func (e *Endpoints) ListImages(orgID, regionID string) string
- func (e *Endpoints) ListOrganizationClusters(orgID string) string
- func (e *Endpoints) ListRegions(orgID string) string
- func (e *Endpoints) OpenAPISpec() string
- func (e *Endpoints) SoftRebootMachine(orgID, projectID, clusterID, machineID string) string
- func (e *Endpoints) StartMachine(orgID, projectID, clusterID, machineID string) string
- func (e *Endpoints) StopMachine(orgID, projectID, clusterID, machineID string) string
- func (e *Endpoints) UpdateCluster(orgID, projectID, clusterID string) string
- func (e *Endpoints) Version() string
- type GinkgoLogger
- type InstancePayloadBuilder
- func (b *InstancePayloadBuilder) Build() openapi.InstanceCreate
- func (b *InstancePayloadBuilder) WithFlavorID(flavorID string) *InstancePayloadBuilder
- func (b *InstancePayloadBuilder) WithImageID(imageID string) *InstancePayloadBuilder
- func (b *InstancePayloadBuilder) WithName(name string) *InstancePayloadBuilder
- func (b *InstancePayloadBuilder) WithNetworkID(networkID string) *InstancePayloadBuilder
- type MultiProjectClusterFixture
- type QuotaInfo
- type QuotaResponse
- type TestConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateClusterWithCleanup ¶
func CreateClusterWithCleanup(client *APIClient, ctx context.Context, config *TestConfig, payload openapi.ComputeClusterWrite) (openapi.ComputeClusterRead, string)
CreateClusterWithCleanup creates a cluster, waits for provisioning, and schedules automatic cleanup. Accepts a typed struct for type safety (or use BuildTyped() from the builder).
func CreateInstanceWithCleanup ¶ added in v1.13.0
func CreateInstanceWithCleanup(client *APIClient, ctx context.Context, config *TestConfig, payload openapi.InstanceCreate) (openapi.InstanceRead, string)
CreateInstanceWithCleanup creates an instance, waits for it to be provisioned, and schedules automatic cleanup.
func ExtractMachineID ¶
func ExtractMachineID(cluster openapi.ComputeClusterRead) string
ExtractMachineID extracts the first machine ID from a cluster's first workload pool.
func ExtractMachineIDsFromPool ¶
func ExtractMachineIDsFromPool(cluster openapi.ComputeClusterRead, poolName string) []string
ExtractMachineIDsFromPool extracts machine IDs from a specific workload pool by name.
func FindPoolByName ¶ added in v1.12.0
func FindPoolByName(pools []openapi.ComputeClusterWorkloadPool, poolName string) *openapi.ComputeClusterWorkloadPool
FindPoolByName finds a workload pool by name in the cluster spec.
func GetMachineStatus ¶
func GetMachineStatus(cluster openapi.ComputeClusterRead, machineID string) string
GetMachineStatus retrieves the current status of a machine by ID from a cluster. Searches all workload pools for the machine.
func VerifyClusterPresence ¶
func VerifyClusterPresence(clusters []openapi.ComputeClusterRead, expectedClusterIDs []string)
VerifyClusterPresence verifies that clusters are present in the list.
func VerifyDefaultFirewallRule ¶ added in v1.12.0
func VerifyDefaultFirewallRule(cluster *openapi.ComputeClusterRead, poolName string)
VerifyDefaultFirewallRule verifies a pool has the default SSH firewall rule.
func VerifyMachineEvicted ¶
func VerifyMachineEvicted(cluster openapi.ComputeClusterRead, poolName, evictedMachineID string, expectedReplicas int) bool
VerifyMachineEvicted checks that a machine ID is not present in a specific pool and the pool has the expected replica count.
func VerifyMultiplePoolsReplicas ¶ added in v1.12.0
func VerifyMultiplePoolsReplicas(cluster *openapi.ComputeClusterRead, poolReplicas map[string]int)
VerifyMultiplePoolsReplicas verifies multiple pools have their expected replicas.
func VerifyPoolFirewallRules ¶ added in v1.12.0
func VerifyPoolFirewallRules(cluster *openapi.ComputeClusterRead, poolName string, expectedRuleCount int)
VerifyPoolFirewallRules verifies a pool has the expected firewall configuration.
func VerifyPoolReplicas ¶ added in v1.12.0
func VerifyPoolReplicas(cluster *openapi.ComputeClusterRead, poolName string, expectedReplicas int)
VerifyPoolReplicas verifies a pool has the expected number of replicas in spec.
func VerifyProjectPresence ¶
func VerifyProjectPresence(clusters []openapi.ComputeClusterRead, expectedProjectIDs []string)
VerifyProjectPresence verifies that projects are present in the cluster list.
func VerifyWorkloadPoolUpdate ¶
func VerifyWorkloadPoolUpdate(cluster openapi.ComputeClusterRead, expectedMinPools int)
VerifyWorkloadPoolUpdate verifies that a cluster's workload pools were updated correctly.
func WaitForInstanceActive ¶ added in v1.13.0
func WaitForInstanceActive(client *APIClient, ctx context.Context, config *TestConfig, instanceID string)
WaitForInstanceActive waits for an instance to reach active/running power state.
func WaitForMachineStatus ¶
func WaitForMachineStatus(client *APIClient, ctx context.Context, config *TestConfig, clusterID, machineID, expectedStatus string)
WaitForMachineStatus waits for a specific machine to reach the expected status.
func WaitForMachinesAvailable ¶
func WaitForMachinesAvailable(client *APIClient, ctx context.Context, config *TestConfig, clusterID string) string
WaitForMachinesAvailable waits for machines to be available in the cluster and returns the first machine ID.
func WaitForPoolMachinesActive ¶ added in v1.12.0
func WaitForPoolMachinesActive(client *APIClient, ctx context.Context, config *TestConfig, clusterID, poolName string, expectedCount int)
WaitForPoolMachinesActive waits for all machines in a pool to become active.
func WaitForPoolReplicas ¶ added in v1.12.0
func WaitForPoolReplicas(client *APIClient, ctx context.Context, config *TestConfig, clusterID, poolName string, expectedReplicas int)
WaitForPoolReplicas waits for a workload pool to have the expected number of replicas.
Types ¶
type APIClient ¶
type APIClient struct {
*coreclient.APIClient
// contains filtered or unexported fields
}
APIClient wraps the core API client with compute-specific methods.
func NewAPIClient ¶
NewAPIClient creates a new Compute API client.
func NewAPIClientWithConfig ¶
func NewAPIClientWithConfig(config *TestConfig) *APIClient
NewAPIClientWithConfig creates a new Compute API client with the given config.
func (*APIClient) CheckClusterQuota ¶
CheckClusterQuota checks if there is sufficient cluster quota available.
func (*APIClient) CreateCluster ¶
func (c *APIClient) CreateCluster(ctx context.Context, orgID, projectID string, body openapi.ComputeClusterWrite) (openapi.ComputeClusterRead, error)
CreateCluster creates a new compute cluster. Accepts a typed struct for type safety, then converts to JSON for the request.
func (*APIClient) CreateInstance ¶ added in v1.13.0
func (c *APIClient) CreateInstance(ctx context.Context, payload openapi.InstanceCreate) (openapi.InstanceRead, error)
CreateInstance creates a new instance.
func (*APIClient) DeleteCluster ¶
func (*APIClient) DeleteInstance ¶ added in v1.13.0
DeleteInstance deletes an instance.
func (*APIClient) EvictMachines ¶
func (c *APIClient) EvictMachines(ctx context.Context, orgID, projectID, clusterID string, machineIDs []string) error
EvictMachines evicts specified machines from a cluster. Uses typed struct for type safety, then converts to JSON for the request.
func (*APIClient) GetCluster ¶
func (c *APIClient) GetCluster(ctx context.Context, orgID, projectID, clusterID string) (openapi.ComputeClusterRead, error)
GetCluster retrieves a specific cluster. Im using this to poll with eventually to wait for the cluster to be provisioned.
func (*APIClient) GetInstance ¶ added in v1.13.0
func (c *APIClient) GetInstance(ctx context.Context, instanceID string) (openapi.InstanceRead, error)
GetInstance retrieves a specific instance.
func (*APIClient) GetInstanceConsoleOutput ¶ added in v1.13.0
func (c *APIClient) GetInstanceConsoleOutput(ctx context.Context, instanceID string, length *int) (*regionopenapi.ConsoleOutputResponse, error)
GetInstanceConsoleOutput retrieves console output for an instance.
func (*APIClient) HardRebootMachine ¶
func (c *APIClient) HardRebootMachine(ctx context.Context, orgID, projectID, clusterID, machineID string) error
HardRebootMachine performs a hard reboot of a machine.
func (*APIClient) ListClusters ¶
func (c *APIClient) ListClusters(ctx context.Context, orgID, projectID string) ([]openapi.ComputeClusterRead, error)
ListClusters lists all clusters for a project.
func (*APIClient) ListFlavors ¶
func (*APIClient) ListImages ¶
func (*APIClient) ListOrganizationClusters ¶
func (c *APIClient) ListOrganizationClusters(ctx context.Context, orgID string) ([]openapi.ComputeClusterRead, error)
ListOrganizationClusters lists all clusters for an organization across all projects.
func (*APIClient) ListRegions ¶
func (*APIClient) SoftRebootMachine ¶
func (c *APIClient) SoftRebootMachine(ctx context.Context, orgID, projectID, clusterID, machineID string) error
SoftRebootMachine performs a graceful reboot of a machine.
func (*APIClient) StartMachine ¶
func (c *APIClient) StartMachine(ctx context.Context, orgID, projectID, clusterID, machineID string) error
StartMachine starts a stopped machine.
func (*APIClient) StopMachine ¶
func (c *APIClient) StopMachine(ctx context.Context, orgID, projectID, clusterID, machineID string) error
StopMachine stops a running machine.
func (*APIClient) UpdateCluster ¶
func (c *APIClient) UpdateCluster(ctx context.Context, orgID, projectID, clusterID string, body openapi.ComputeClusterWrite) error
UpdateCluster updates an existing cluster. Accepts a typed struct for type safety, then converts to JSON for the request.
type ClusterInfo ¶
type ClusterInfo struct {
Cluster openapi.ComputeClusterRead
ClusterID string
ProjectID string
}
ClusterInfo holds cluster metadata and project information.
type ClusterPayloadBuilder ¶
type ClusterPayloadBuilder struct {
// contains filtered or unexported fields
}
ClusterPayloadBuilder builds cluster payloads for testing using type-safe OpenAPI structs.
func NewClusterPayload ¶
func NewClusterPayload() *ClusterPayloadBuilder
NewClusterPayload creates a new cluster payload builder with defaults from config.
func (*ClusterPayloadBuilder) Build ¶
func (b *ClusterPayloadBuilder) Build() map[string]interface{}
Build returns the cluster as a map for JSON marshaling (required for API client).
func (*ClusterPayloadBuilder) BuildTyped ¶
func (b *ClusterPayloadBuilder) BuildTyped() openapi.ComputeClusterWrite
BuildTyped returns the typed cluster struct directly.
func (*ClusterPayloadBuilder) ClearWorkloadPools ¶ added in v1.12.0
func (b *ClusterPayloadBuilder) ClearWorkloadPools() *ClusterPayloadBuilder
ClearWorkloadPools removes all default workload pools to start fresh.
func (*ClusterPayloadBuilder) WithDescription ¶
func (b *ClusterPayloadBuilder) WithDescription(desc string) *ClusterPayloadBuilder
WithDescription sets the cluster description.
func (*ClusterPayloadBuilder) WithFlavorID ¶
func (b *ClusterPayloadBuilder) WithFlavorID(flavorID string) *ClusterPayloadBuilder
WithFlavorID sets the flavor ID for all workload pools.
func (*ClusterPayloadBuilder) WithImageID ¶
func (b *ClusterPayloadBuilder) WithImageID(imageID string) *ClusterPayloadBuilder
WithImageID sets the image ID for all workload pools.
func (*ClusterPayloadBuilder) WithName ¶
func (b *ClusterPayloadBuilder) WithName(name string) *ClusterPayloadBuilder
WithName sets the cluster name.
func (*ClusterPayloadBuilder) WithProjectID ¶
func (b *ClusterPayloadBuilder) WithProjectID(projectID string) *ClusterPayloadBuilder
WithProjectID overrides the default project ID for multi-project testing.
func (*ClusterPayloadBuilder) WithRegionID ¶
func (b *ClusterPayloadBuilder) WithRegionID(regionID string) *ClusterPayloadBuilder
WithRegionID sets the region ID.
func (*ClusterPayloadBuilder) WithWorkloadPool ¶
func (b *ClusterPayloadBuilder) WithWorkloadPool(name, flavorID, imageID string, replicas int) *ClusterPayloadBuilder
WithWorkloadPool adds a workload pool configuration.
type ClusterUpdateFixture ¶
type ClusterUpdateFixture struct {
Cluster openapi.ComputeClusterRead
ClusterID string
OriginalReplicas int
}
ClusterUpdateFixture represents a cluster setup for update testing.
func CreateClusterUpdateFixture ¶
func CreateClusterUpdateFixture(client *APIClient, ctx context.Context, config *TestConfig, clusterName string) *ClusterUpdateFixture
CreateClusterUpdateFixture creates a cluster specifically for update testing.
func (*ClusterUpdateFixture) CreateUpdatePayload ¶
func (f *ClusterUpdateFixture) CreateUpdatePayload(config *TestConfig, newReplicas int) openapi.ComputeClusterWrite
CreateUpdatePayload creates a cluster update payload with modified workload pools. Returns typed struct for type safety.
type Endpoints ¶
type Endpoints struct{}
Endpoints contains all API endpoint patterns.
func (*Endpoints) CreateCluster ¶
func (*Endpoints) CreateInstance ¶ added in v1.13.0
Instance management endpoints (V2 API).
func (*Endpoints) DeleteCluster ¶
func (*Endpoints) DeleteInstance ¶ added in v1.13.0
func (*Endpoints) EvictMachines ¶
func (*Endpoints) GetCluster ¶
func (*Endpoints) GetInstance ¶ added in v1.13.0
func (*Endpoints) GetInstanceConsoleOutput ¶ added in v1.13.0
func (*Endpoints) HardRebootMachine ¶
func (*Endpoints) HealthCheck ¶
Health and metadata endpoints.
func (*Endpoints) ListClusters ¶
Cluster management endpoints.
func (*Endpoints) ListFlavors ¶
func (*Endpoints) ListImages ¶
func (*Endpoints) ListOrganizationClusters ¶
func (*Endpoints) ListRegions ¶
Discovery endpoints.
func (*Endpoints) OpenAPISpec ¶
func (*Endpoints) SoftRebootMachine ¶
func (*Endpoints) StartMachine ¶
Machine operation endpoints.
func (*Endpoints) StopMachine ¶
func (*Endpoints) UpdateCluster ¶
type GinkgoLogger ¶ added in v1.13.0
type GinkgoLogger struct{}
GinkgoLogger implements the Logger interface for Ginkgo tests.
func (*GinkgoLogger) Printf ¶ added in v1.13.0
func (g *GinkgoLogger) Printf(format string, args ...interface{})
type InstancePayloadBuilder ¶ added in v1.13.0
type InstancePayloadBuilder struct {
// contains filtered or unexported fields
}
InstancePayloadBuilder builds instance payloads for testing using type-safe OpenAPI structs.
func NewInstancePayload ¶ added in v1.13.0
func NewInstancePayload() *InstancePayloadBuilder
NewInstancePayload creates a new instance payload builder with defaults from config.
func (*InstancePayloadBuilder) Build ¶ added in v1.13.0
func (b *InstancePayloadBuilder) Build() openapi.InstanceCreate
Build returns the typed instance struct.
func (*InstancePayloadBuilder) WithFlavorID ¶ added in v1.13.0
func (b *InstancePayloadBuilder) WithFlavorID(flavorID string) *InstancePayloadBuilder
WithFlavorID sets the flavor ID.
func (*InstancePayloadBuilder) WithImageID ¶ added in v1.13.0
func (b *InstancePayloadBuilder) WithImageID(imageID string) *InstancePayloadBuilder
WithImageID sets the image ID.
func (*InstancePayloadBuilder) WithName ¶ added in v1.13.0
func (b *InstancePayloadBuilder) WithName(name string) *InstancePayloadBuilder
WithName sets the instance name.
func (*InstancePayloadBuilder) WithNetworkID ¶ added in v1.13.0
func (b *InstancePayloadBuilder) WithNetworkID(networkID string) *InstancePayloadBuilder
WithNetworkID sets the network ID.
type MultiProjectClusterFixture ¶
type MultiProjectClusterFixture struct {
Clusters []ClusterInfo
Projects []string
}
MultiProjectClusterFixture represents clusters across multiple projects for testing.
func CreateMultiProjectClusterFixture ¶
func CreateMultiProjectClusterFixture(client *APIClient, ctx context.Context, config *TestConfig, projectIDs []string) *MultiProjectClusterFixture
CreateMultiProjectClusterFixture creates clusters in the specified projects for testing.
type QuotaInfo ¶
type QuotaInfo struct {
Kind string `json:"kind"`
DisplayName string `json:"displayName"`
Description string `json:"description"`
Quantity int `json:"quantity"`
Used int `json:"used"`
Committed int `json:"committed"`
Reserved int `json:"reserved"`
Default int `json:"default"`
Free int `json:"free"`
}
QuotaInfo represents quota information for a resource.
type QuotaResponse ¶
type QuotaResponse struct {
Quotas []QuotaInfo `json:"quotas"`
}
QuotaResponse represents the quota API response structure.
type TestConfig ¶
type TestConfig struct {
coreconfig.BaseConfig
IdentityBaseURL string
OrgID string
ProjectID string
SecondaryProjectID string
RegionID string
SecondaryRegionID string
FlavorID string
ImageID string
NetworkID string
}
TestConfig extends the base config with Compute-specific fields.
func LoadTestConfig ¶
func LoadTestConfig() (*TestConfig, error)
LoadTestConfig loads configuration from environment variables and .env files using viper. Returns an error if required configuration values are missing.