Documentation
¶
Index ¶
- func CreateInstanceWithCleanup(client *APIClient, ctx context.Context, config *TestConfig, ...) (openapi.InstanceRead, string)
- func CreateSSHCertificateAuthorityWithCleanup(regionClient *RegionAPIClient, ctx context.Context, config *TestConfig, ...) string
- func CreateSSHOpenSecurityGroupWithCleanup(regionClient *RegionAPIClient, ctx context.Context, config *TestConfig) string
- func RunSSHCommand(address, user string, authMethods []ssh.AuthMethod, timeout time.Duration, ...) (string, error)
- func SignSSHUserCertificate(caSigner, userSigner ssh.Signer, principal string, validFor time.Duration) (ssh.AuthMethod, error)
- func WaitForImageReady(regionClient *RegionAPIClient, ctx context.Context, config *TestConfig, ...)
- func WaitForInstanceActive(client *APIClient, ctx context.Context, config *TestConfig, instanceID string)
- func WaitForInstancePublicIP(client *APIClient, ctx context.Context, config *TestConfig, instanceID string) string
- func WaitForSSHReady(publicIP string, timeout time.Duration)
- func WaitForTCPPort(address string, timeout time.Duration)
- type APIClient
- func (c *APIClient) CreateInstance(ctx context.Context, payload openapi.InstanceCreate) (openapi.InstanceRead, error)
- func (c *APIClient) DeleteInstance(ctx context.Context, instanceID string) 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) GetInstanceSSHKey(ctx context.Context, instanceID string) (*regionopenapi.SshKeyResponse, 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) ListRegions(ctx context.Context, orgID string) (regionopenapi.Regions, error)
- func (c *APIClient) RebootInstance(ctx context.Context, instanceID string, hard bool) error
- func (c *APIClient) SnapshotInstance(ctx context.Context, instanceID string, name string) (*regionopenapi.Image, error)
- func (c *APIClient) StartInstance(ctx context.Context, instanceID string) error
- func (c *APIClient) StopInstance(ctx context.Context, instanceID string) error
- type Endpoints
- func (e *Endpoints) CreateInstance() string
- func (e *Endpoints) DeleteInstance(instanceID string) string
- func (e *Endpoints) GetInstance(instanceID string) string
- func (e *Endpoints) GetInstanceConsoleOutput(instanceID string) string
- func (e *Endpoints) GetInstanceSSHKey(instanceID string) string
- func (e *Endpoints) GetInstanceSnapshot(instanceID string) string
- func (e *Endpoints) HealthCheck() string
- func (e *Endpoints) ListFlavors(orgID, regionID string) string
- func (e *Endpoints) ListImages(orgID, regionID string) string
- func (e *Endpoints) ListRegions(orgID string) string
- func (e *Endpoints) OpenAPISpec() string
- func (e *Endpoints) RebootInstance(instanceID string) string
- func (e *Endpoints) StartInstance(instanceID string) string
- func (e *Endpoints) StopInstance(instanceID string) string
- func (e *Endpoints) Version() string
- type GinkgoLogger
- type ImagePayloadBuilder
- 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
- func (b *InstancePayloadBuilder) WithPublicIP(enabled bool) *InstancePayloadBuilder
- func (b *InstancePayloadBuilder) WithSSHCertificateAuthorityID(id string) *InstancePayloadBuilder
- func (b *InstancePayloadBuilder) WithSecurityGroups(securityGroupIDs ...string) *InstancePayloadBuilder
- type RegionAPIClient
- func (c *RegionAPIClient) CreateImage(ctx context.Context, organizationID, regionID string, ...) (*regionopenapi.Image, error)
- func (c *RegionAPIClient) CreateSSHCertificateAuthority(ctx context.Context, request regionopenapi.SshCertificateAuthorityV2Create) (*regionopenapi.SshCertificateAuthorityV2Response, error)
- func (c *RegionAPIClient) CreateSecurityGroup(ctx context.Context, request regionopenapi.SecurityGroupV2Create) (*regionopenapi.SecurityGroupV2Response, error)
- func (c *RegionAPIClient) DeleteImage(ctx context.Context, organizationID, regionID, imageID string) error
- func (c *RegionAPIClient) DeleteSSHCertificateAuthority(ctx context.Context, sshCertificateAuthorityID string) error
- func (c *RegionAPIClient) DeleteSecurityGroup(ctx context.Context, securityGroupID string) error
- func (c *RegionAPIClient) ListImages(ctx context.Context, organizationID, regionID string) ([]regionopenapi.Image, error)
- type RegionEndpoints
- func (*RegionEndpoints) DeleteImage(organizationID, regionID, imageID string) string
- func (*RegionEndpoints) ListImages(organizationID, regionID string) string
- func (*RegionEndpoints) SSHCertificateAuthoritiesV2() string
- func (*RegionEndpoints) SSHCertificateAuthorityV2(sshCertificateAuthorityID string) string
- func (*RegionEndpoints) SecurityGroupV2(securityGroupID string) string
- func (*RegionEndpoints) SecurityGroupsV2() string
- type SSHKeyPair
- type TestConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 CreateSSHCertificateAuthorityWithCleanup ¶
func CreateSSHCertificateAuthorityWithCleanup(regionClient *RegionAPIClient, ctx context.Context, config *TestConfig, publicKey string) string
CreateSSHCertificateAuthorityWithCleanup creates an SSH CA and schedules cleanup.
func CreateSSHOpenSecurityGroupWithCleanup ¶
func CreateSSHOpenSecurityGroupWithCleanup(regionClient *RegionAPIClient, ctx context.Context, config *TestConfig) string
CreateSSHOpenSecurityGroupWithCleanup creates an ingress TCP/22 security group and schedules cleanup.
func RunSSHCommand ¶
func SignSSHUserCertificate ¶
func WaitForImageReady ¶
func WaitForImageReady(regionClient *RegionAPIClient, ctx context.Context, config *TestConfig, imageID string)
WaitForImageReady polls until a custom image reaches the ready state in the region. Uses a 1-hour timeout to accommodate image download and import times.
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 WaitForInstancePublicIP ¶
func WaitForInstancePublicIP(client *APIClient, ctx context.Context, config *TestConfig, instanceID string) string
WaitForInstancePublicIP waits for an instance to get a public IP address.
func WaitForSSHReady ¶
func WaitForTCPPort ¶
WaitForTCPPort waits for a TCP port to become reachable.
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) 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) DeleteInstance ¶ added in v1.13.0
DeleteInstance deletes an instance.
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) GetInstanceSSHKey ¶
func (c *APIClient) GetInstanceSSHKey(ctx context.Context, instanceID string) (*regionopenapi.SshKeyResponse, error)
GetInstanceSSHKey retrieves the SSH private key for an instance.
func (*APIClient) ListFlavors ¶
func (*APIClient) ListImages ¶
func (*APIClient) ListRegions ¶
func (*APIClient) RebootInstance ¶
RebootInstance reboots an instance. Set hard to true for a hard power cycle.
func (*APIClient) SnapshotInstance ¶ added in v1.14.0
func (*APIClient) StartInstance ¶
StartInstance starts a stopped instance.
type Endpoints ¶
type Endpoints struct{}
Endpoints contains all API endpoint patterns.
func (*Endpoints) CreateInstance ¶ added in v1.13.0
Instance management endpoints (V2 API).
func (*Endpoints) DeleteInstance ¶ added in v1.13.0
func (*Endpoints) GetInstance ¶ added in v1.13.0
func (*Endpoints) GetInstanceConsoleOutput ¶ added in v1.13.0
func (*Endpoints) GetInstanceSSHKey ¶
func (*Endpoints) GetInstanceSnapshot ¶ added in v1.14.0
func (*Endpoints) HealthCheck ¶
Health and metadata endpoints.
func (*Endpoints) ListFlavors ¶
func (*Endpoints) ListImages ¶
func (*Endpoints) ListRegions ¶
Discovery endpoints.
func (*Endpoints) OpenAPISpec ¶
func (*Endpoints) RebootInstance ¶
func (*Endpoints) StartInstance ¶
func (*Endpoints) StopInstance ¶
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 ImagePayloadBuilder ¶
type ImagePayloadBuilder struct {
// contains filtered or unexported fields
}
ImagePayloadBuilder builds ImageCreate payloads for testing.
func NewImagePayload ¶
func NewImagePayload() *ImagePayloadBuilder
NewImagePayload creates a builder with sensible defaults.
func (*ImagePayloadBuilder) Build ¶
func (b *ImagePayloadBuilder) Build() regionopenapi.ImageCreate
Build returns the typed ImageCreate struct.
func (*ImagePayloadBuilder) WithName ¶
func (b *ImagePayloadBuilder) WithName(name string) *ImagePayloadBuilder
WithName overrides the image name.
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.
func (*InstancePayloadBuilder) WithPublicIP ¶
func (b *InstancePayloadBuilder) WithPublicIP(enabled bool) *InstancePayloadBuilder
WithPublicIP enables public IP allocation for the instance.
func (*InstancePayloadBuilder) WithSSHCertificateAuthorityID ¶
func (b *InstancePayloadBuilder) WithSSHCertificateAuthorityID(id string) *InstancePayloadBuilder
WithSSHCertificateAuthorityID sets the SSH CA trust anchor for the instance.
func (*InstancePayloadBuilder) WithSecurityGroups ¶
func (b *InstancePayloadBuilder) WithSecurityGroups(securityGroupIDs ...string) *InstancePayloadBuilder
WithSecurityGroups sets the security group IDs applied to the instance.
type RegionAPIClient ¶ added in v1.14.0
type RegionAPIClient struct {
*coreclient.APIClient
// contains filtered or unexported fields
}
APIClient wraps the core API client with compute-specific methods.
func NewRegionClient ¶ added in v1.14.0
func NewRegionClient(baseURL string) (*RegionAPIClient, error)
func (*RegionAPIClient) CreateImage ¶
func (c *RegionAPIClient) CreateImage(ctx context.Context, organizationID, regionID string, request regionopenapi.ImageCreate) (*regionopenapi.Image, error)
func (*RegionAPIClient) CreateSSHCertificateAuthority ¶
func (c *RegionAPIClient) CreateSSHCertificateAuthority(ctx context.Context, request regionopenapi.SshCertificateAuthorityV2Create) (*regionopenapi.SshCertificateAuthorityV2Response, error)
func (*RegionAPIClient) CreateSecurityGroup ¶
func (c *RegionAPIClient) CreateSecurityGroup(ctx context.Context, request regionopenapi.SecurityGroupV2Create) (*regionopenapi.SecurityGroupV2Response, error)
func (*RegionAPIClient) DeleteImage ¶ added in v1.14.0
func (c *RegionAPIClient) DeleteImage(ctx context.Context, organizationID, regionID, imageID string) error
func (*RegionAPIClient) DeleteSSHCertificateAuthority ¶
func (c *RegionAPIClient) DeleteSSHCertificateAuthority(ctx context.Context, sshCertificateAuthorityID string) error
func (*RegionAPIClient) DeleteSecurityGroup ¶
func (c *RegionAPIClient) DeleteSecurityGroup(ctx context.Context, securityGroupID string) error
func (*RegionAPIClient) ListImages ¶
func (c *RegionAPIClient) ListImages(ctx context.Context, organizationID, regionID string) ([]regionopenapi.Image, error)
type RegionEndpoints ¶ added in v1.14.0
type RegionEndpoints struct{}
RegionEndpoints contains region API endpoint patterns used by integration tests.
func (*RegionEndpoints) DeleteImage ¶ added in v1.14.0
func (*RegionEndpoints) DeleteImage(organizationID, regionID, imageID string) string
func (*RegionEndpoints) ListImages ¶
func (*RegionEndpoints) ListImages(organizationID, regionID string) string
func (*RegionEndpoints) SSHCertificateAuthoritiesV2 ¶
func (*RegionEndpoints) SSHCertificateAuthoritiesV2() string
func (*RegionEndpoints) SSHCertificateAuthorityV2 ¶
func (*RegionEndpoints) SSHCertificateAuthorityV2(sshCertificateAuthorityID string) string
func (*RegionEndpoints) SecurityGroupV2 ¶
func (*RegionEndpoints) SecurityGroupV2(securityGroupID string) string
func (*RegionEndpoints) SecurityGroupsV2 ¶
func (*RegionEndpoints) SecurityGroupsV2() string
type SSHKeyPair ¶
type SSHKeyPair struct {
AuthorizedKey string
PrivateKeyPEM string
PrivateKeySigner ssh.Signer
PublicKeySSH ssh.PublicKey
}
func NewSSHKeyPair ¶
func NewSSHKeyPair() (*SSHKeyPair, error)
type TestConfig ¶
type TestConfig struct {
coreconfig.BaseConfig
RegionBaseURL string
OrgID string
ProjectID string
RegionID string
FlavorID string
ImageID string
NetworkID string
EnableSSHIntegration bool
}
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.