Documentation
¶
Index ¶
- Constants
- Variables
- func IsTestResourceName(name string) bool
- func MustCreateServer(c *APIClient, ctx context.Context, createReq regionopenapi.ServerV2Create) (*regionopenapi.ServerV2Read, func())
- func MustDeleteNetwork(c *APIClient, ctx context.Context, networkID string)
- func MustDeleteServer(c *APIClient, ctx context.Context, serverID string)
- func MustProvisionNetwork(c *APIClient, ctx context.Context, createReq regionopenapi.NetworkV2Create) (*regionopenapi.NetworkV2Read, func())
- func SkipUnlessInternalAPIConfigured(c *APIClient)
- func SkipUnlessOpenStackRegion(c *APIClient, ctx context.Context, config *TestConfig)
- func SkipUnlessServerFixtureConfigured(config *TestConfig)
- func SweepStaleTestNetworks(c *APIClient, ctx context.Context, config *TestConfig)
- func UniqueName(prefix string) string
- func WaitForFileStorageGone(c *APIClient, ctx context.Context, filestorageID string)
- func WaitForImageReady(c *APIClient, ctx context.Context, config *TestConfig, imageID string)
- func WaitForLoadBalancerGone(c *APIClient, ctx context.Context, lbID string)
- func WaitForLoadBalancerProvisioned(c *APIClient, ctx context.Context, lbID string)
- func WaitForNetworkGone(c *APIClient, ctx context.Context, networkID string)
- func WaitForNetworkProvisioned(c *APIClient, ctx context.Context, networkID string)
- func WaitForNetworkVisible(c *APIClient, ctx context.Context, networkID string)
- func WaitForServerGone(c *APIClient, ctx context.Context, serverID string)
- type APIClient
- func (c *APIClient) CreateFileStorage(ctx context.Context, request regionopenapi.StorageV2CreateRequest) (*regionopenapi.StorageV2Read, error)
- func (c *APIClient) CreateImage(ctx context.Context, orgID, regionID string, request regionopenapi.ImageCreate) (*regionopenapi.Image, error)
- func (c *APIClient) CreateLoadBalancer(ctx context.Context, request regionopenapi.LoadBalancerV2Create) (*regionopenapi.LoadBalancerV2Read, error)
- func (c *APIClient) CreateNetwork(ctx context.Context, request regionopenapi.NetworkV2Create) (*regionopenapi.NetworkV2Read, error)
- func (c *APIClient) CreateSSHCertificateAuthority(ctx context.Context, request regionopenapi.SshCertificateAuthorityV2Create) (*regionopenapi.SshCertificateAuthorityV2Read, error)
- func (c *APIClient) CreateSecurityGroup(ctx context.Context, request regionopenapi.SecurityGroupV2Create) (*regionopenapi.SecurityGroupV2Read, error)
- func (c *APIClient) CreateServer(ctx context.Context, request regionopenapi.ServerV2Create) (*regionopenapi.ServerV2Read, error)
- func (c *APIClient) CreateServerExpectError(ctx context.Context, request regionopenapi.ServerV2Create, expectedStatus int) (*coreapi.Error, error)
- func (c *APIClient) DeleteFileStorage(ctx context.Context, filestorageID string) error
- func (c *APIClient) DeleteImage(ctx context.Context, orgID, regionID, imageID string) error
- func (c *APIClient) DeleteLoadBalancer(ctx context.Context, loadBalancerID string) error
- func (c *APIClient) DeleteNetwork(ctx context.Context, networkID string) error
- func (c *APIClient) DeleteSSHCertificateAuthority(ctx context.Context, sshCAID string) error
- func (c *APIClient) DeleteSecurityGroup(ctx context.Context, securityGroupID string) error
- func (c *APIClient) DeleteServer(ctx context.Context, serverID string) error
- func (c *APIClient) DoInternalRegionRequest(ctx context.Context, method, path string, body io.Reader, expectedStatus int) (*http.Response, []byte, error)
- func (c *APIClient) DoRegionRequest(ctx context.Context, method, path string, body io.Reader, expectedStatus int) (*http.Response, []byte, error)
- func (c *APIClient) GetEndpoints() *Endpoints
- func (c *APIClient) GetFileStorage(ctx context.Context, filestorageID string) (*regionopenapi.StorageV2Read, error)
- func (c *APIClient) GetListRegionsPath(orgID string) string
- func (c *APIClient) GetLoadBalancer(ctx context.Context, loadBalancerID string) (*regionopenapi.LoadBalancerV2Read, error)
- func (c *APIClient) GetNetwork(ctx context.Context, networkID string) (*regionopenapi.NetworkV2Read, error)
- func (c *APIClient) GetRegionDetail(ctx context.Context, orgID, regionID string) (*regionopenapi.RegionDetailRead, error)
- func (c *APIClient) GetSSHCertificateAuthority(ctx context.Context, sshCAID string) (*regionopenapi.SshCertificateAuthorityV2Read, error)
- func (c *APIClient) GetSecurityGroup(ctx context.Context, securityGroupID string) (*regionopenapi.SecurityGroupV2Read, error)
- func (c *APIClient) GetServer(ctx context.Context, serverID string) (*regionopenapi.ServerV2Read, error)
- func (c *APIClient) GetServerSSHKey(ctx context.Context, serverID string) (*regionopenapi.SshKey, error)
- func (c *APIClient) GetVersion(ctx context.Context) (*coreapi.ServiceVersionRead, error)
- func (c *APIClient) InternalAPIConfigured() bool
- func (c *APIClient) ListFileStorage(ctx context.Context, orgID, projectID, regionID string) (regionopenapi.StorageV2List, error)
- func (c *APIClient) ListFileStorageClasses(ctx context.Context, regionID string) (regionopenapi.StorageClassListV2Read, 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) ListLoadBalancers(ctx context.Context, orgID, projectID, regionID string) (regionopenapi.LoadBalancersV2Read, error)
- func (c *APIClient) ListNetworks(ctx context.Context, orgID, projectID, regionID string) (regionopenapi.NetworksV2Read, error)
- func (c *APIClient) ListRegions(ctx context.Context, orgID string) (regionopenapi.Regions, error)
- func (c *APIClient) ListSSHCertificateAuthorities(ctx context.Context, orgID, projectID string) (regionopenapi.SshCertificateAuthoritiesV2Read, error)
- func (c *APIClient) ListSecurityGroups(ctx context.Context, orgID, projectID, regionID string) (regionopenapi.SecurityGroupsV2Read, error)
- func (c *APIClient) ListServers(ctx context.Context, orgID, projectID, regionID, networkID string) (regionopenapi.ServersV2Read, error)
- func (c *APIClient) UpdateFileStorage(ctx context.Context, filestorageID string, ...) (*regionopenapi.StorageV2Read, error)
- func (c *APIClient) UpdateLoadBalancer(ctx context.Context, loadBalancerID string, ...) (*regionopenapi.LoadBalancerV2Read, error)
- func (c *APIClient) UpdateNetwork(ctx context.Context, networkID string, request regionopenapi.NetworkV2Update) (*regionopenapi.NetworkV2Read, error)
- func (c *APIClient) UpdateSecurityGroup(ctx context.Context, securityGroupID string, ...) (*regionopenapi.SecurityGroupV2Read, error)
- type Endpoints
- func (e *Endpoints) CreateFileStorage() string
- func (e *Endpoints) CreateLoadBalancer() string
- func (e *Endpoints) CreateNetwork() string
- func (e *Endpoints) CreateSSHCertificateAuthority() string
- func (e *Endpoints) CreateSecurityGroup() string
- func (e *Endpoints) CreateServer() string
- func (e *Endpoints) DeleteFileStorage(filestorageID string) string
- func (e *Endpoints) DeleteImage(orgID, regionID, imageID string) string
- func (e *Endpoints) DeleteLoadBalancer(loadBalancerID string) string
- func (e *Endpoints) DeleteNetwork(networkID string) string
- func (e *Endpoints) DeleteSSHCertificateAuthority(sshCAID string) string
- func (e *Endpoints) DeleteSecurityGroup(securityGroupID string) string
- func (e *Endpoints) DeleteServer(serverID string) string
- func (e *Endpoints) GetFileStorage(filestorageID string) string
- func (e *Endpoints) GetLoadBalancer(loadBalancerID string) string
- func (e *Endpoints) GetNetwork(networkID string) string
- func (e *Endpoints) GetRegionDetail(orgID, regionID string) string
- func (e *Endpoints) GetSSHCertificateAuthority(sshCAID string) string
- func (e *Endpoints) GetSecurityGroup(securityGroupID string) string
- func (e *Endpoints) GetServer(serverID string) string
- func (e *Endpoints) GetServerSSHKey(serverID string) string
- func (e *Endpoints) ListFileStorage(orgID, projectID, regionID string) string
- func (e *Endpoints) ListFileStorageClasses(regionID string) string
- func (e *Endpoints) ListFlavors(orgID, regionID string) string
- func (e *Endpoints) ListImages(orgID, regionID string) string
- func (e *Endpoints) ListLoadBalancers(orgID, projectID, regionID string) string
- func (e *Endpoints) ListNetworks(orgID, projectID, regionID string) string
- func (e *Endpoints) ListRegions(orgID string) string
- func (e *Endpoints) ListSSHCertificateAuthorities(orgID, projectID string) string
- func (e *Endpoints) ListSecurityGroups(orgID, projectID, regionID string) string
- func (e *Endpoints) ListServers(orgID, projectID, regionID, networkID string) string
- func (e *Endpoints) UpdateFileStorage(filestorageID string) string
- func (e *Endpoints) UpdateLoadBalancer(loadBalancerID string) string
- func (e *Endpoints) UpdateNetwork(networkID string) string
- func (e *Endpoints) UpdateSecurityGroup(securityGroupID string) string
- func (e *Endpoints) Version() string
- type FileStoragePayloadBuilder
- func (b *FileStoragePayloadBuilder) Build() regionopenapi.StorageV2CreateRequest
- func (b *FileStoragePayloadBuilder) WithSizeGiB(sizeGiB int64) *FileStoragePayloadBuilder
- func (b *FileStoragePayloadBuilder) WithSnapshotPolicies(policies *regionopenapi.StorageSnapshotPolicyListV2Spec) *FileStoragePayloadBuilder
- type GinkgoLogger
- type ImagePayloadBuilder
- func (b *ImagePayloadBuilder) Build() regionopenapi.ImageCreate
- func (b *ImagePayloadBuilder) WithArchitecture(a regionopenapi.Architecture) *ImagePayloadBuilder
- func (b *ImagePayloadBuilder) WithName(name string) *ImagePayloadBuilder
- func (b *ImagePayloadBuilder) WithOSCodename(codename string) *ImagePayloadBuilder
- func (b *ImagePayloadBuilder) WithOSDistro(distro regionopenapi.OsDistro) *ImagePayloadBuilder
- func (b *ImagePayloadBuilder) WithOSFamily(family regionopenapi.OsFamily) *ImagePayloadBuilder
- func (b *ImagePayloadBuilder) WithOSKernel(kernel regionopenapi.OsKernel) *ImagePayloadBuilder
- func (b *ImagePayloadBuilder) WithOSVersion(version string) *ImagePayloadBuilder
- func (b *ImagePayloadBuilder) WithURI(uri string) *ImagePayloadBuilder
- func (b *ImagePayloadBuilder) WithVirtualization(v regionopenapi.ImageVirtualization) *ImagePayloadBuilder
- type LoadBalancerPayloadBuilder
- func (b *LoadBalancerPayloadBuilder) Build() regionopenapi.LoadBalancerV2Create
- func (b *LoadBalancerPayloadBuilder) WithListeners(listeners []regionopenapi.LoadBalancerListenerV2) *LoadBalancerPayloadBuilder
- func (b *LoadBalancerPayloadBuilder) WithName(name string) *LoadBalancerPayloadBuilder
- func (b *LoadBalancerPayloadBuilder) WithPublicIP(publicIP bool) *LoadBalancerPayloadBuilder
- type NetworkPayloadBuilder
- type SSHCertificateAuthorityPayloadBuilder
- func (b *SSHCertificateAuthorityPayloadBuilder) Build() regionopenapi.SshCertificateAuthorityV2Create
- func (b *SSHCertificateAuthorityPayloadBuilder) WithName(name string) *SSHCertificateAuthorityPayloadBuilder
- func (b *SSHCertificateAuthorityPayloadBuilder) WithPublicKey(key string) *SSHCertificateAuthorityPayloadBuilder
- type SecurityGroupPayloadBuilder
- type ServerPayloadBuilder
- func (b *ServerPayloadBuilder) Build() regionopenapi.ServerV2Create
- func (b *ServerPayloadBuilder) WithInfrastructureRef(infrastructureRef string) *ServerPayloadBuilder
- func (b *ServerPayloadBuilder) WithName(name string) *ServerPayloadBuilder
- func (b *ServerPayloadBuilder) WithNetworking(networking *regionopenapi.ServerV2Networking) *ServerPayloadBuilder
- func (b *ServerPayloadBuilder) WithUserData(userData []byte) *ServerPayloadBuilder
- type TestConfig
Constants ¶
const StaleTestNetworkTTL = 6 * time.Hour
StaleTestNetworkTTL is how old a test-prefixed network must be before the pre-suite sweep reclaims it. Suites complete well within an hour, so a 6-hour floor guarantees the sweep never races a concurrent or in-flight run and only ever removes orphans left behind by a previously killed runner.
const TestResourceNamePrefix = "ginkgo-test-"
TestResourceNamePrefix marks every resource name generated by the integration suite. It is the single source of truth shared by UniqueName (which produces names) and IsTestResourceName (which the pre-suite sweep uses to recognise leaked resources): change it here and both ends stay in agreement.
Variables ¶
var ( // ErrInternalAPIConfigMissing is returned when local-only internal credentials are absent. ErrInternalAPIConfigMissing = errors.New("internal API credentials are not configured") )
Functions ¶
func IsTestResourceName ¶ added in v1.18.3
IsTestResourceName reports whether name was generated by UniqueName, i.e. it belongs to the integration suite and is therefore safe to reclaim.
func MustCreateServer ¶ added in v1.18.7
func MustCreateServer(c *APIClient, ctx context.Context, createReq regionopenapi.ServerV2Create) (*regionopenapi.ServerV2Read, func())
MustCreateServer creates a server from createReq and returns it with a cleanup func the caller should register (e.g. DeferCleanup(cleanup)). It does not wait for provisioning, so callers can assert on the freshly-created (pending) state.
func MustDeleteNetwork ¶ added in v1.18.7
MustDeleteNetwork deletes the network and waits for it to disappear. A missing network is treated as already deleted.
func MustDeleteServer ¶ added in v1.18.7
MustDeleteServer deletes the server and waits for it to disappear. A missing server is treated as already deleted.
func MustProvisionNetwork ¶ added in v1.18.7
func MustProvisionNetwork(c *APIClient, ctx context.Context, createReq regionopenapi.NetworkV2Create) (*regionopenapi.NetworkV2Read, func())
MustProvisionNetwork creates a network from createReq and waits for it to become visible and provisioned. It returns the network and a cleanup func the caller should register (e.g. DeferCleanup(cleanup)).
func SkipUnlessInternalAPIConfigured ¶ added in v1.18.7
func SkipUnlessInternalAPIConfigured(c *APIClient)
SkipUnlessInternalAPIConfigured skips the spec unless internal API mTLS credentials are available locally.
func SkipUnlessOpenStackRegion ¶ added in v1.18.7
func SkipUnlessOpenStackRegion(c *APIClient, ctx context.Context, config *TestConfig)
SkipUnlessOpenStackRegion skips the spec unless the configured region is visible and backed by OpenStack.
func SkipUnlessServerFixtureConfigured ¶ added in v1.18.7
func SkipUnlessServerFixtureConfigured(config *TestConfig)
SkipUnlessServerFixtureConfigured skips the spec unless a flavor and image are configured.
func SweepStaleTestNetworks ¶ added in v1.18.3
func SweepStaleTestNetworks(c *APIClient, ctx context.Context, config *TestConfig)
SweepStaleTestNetworks deletes test-prefixed networks in the configured org/project/region that are older than StaleTestNetworkTTL.
A killed CI runner (timeout/OOM/SIGKILL) never runs in-process cleanup, so the networks it created — and their scarce VLANs — leak until reclaimed by hand. Running this before the suite means each run reclaims the previous run's orphans, which is the only mechanism that survives a hard process kill.
It is best-effort: list and delete failures are logged and tolerated so a sweep problem can never fail the suite under test.
func UniqueName ¶ added in v1.18.3
UniqueName builds a collision-resistant resource name carrying TestResourceNamePrefix so leaked resources can be reliably swept.
func WaitForFileStorageGone ¶ added in v1.18.7
WaitForFileStorageGone polls until the file storage has been deleted.
func WaitForImageReady ¶ added in v1.15.0
func WaitForImageReady(c *APIClient, ctx context.Context, config *TestConfig, imageID string)
WaitForImageReady polls until the image appears in the region with state ready. Uses a 1-hour timeout to accommodate image download and import times.
func WaitForLoadBalancerGone ¶ added in v1.16.5
WaitForLoadBalancerGone polls until GET for the load balancer returns the expected not-found error.
func WaitForLoadBalancerProvisioned ¶ added in v1.16.5
WaitForLoadBalancerProvisioned polls until the load balancer reaches Provisioned.
func WaitForNetworkGone ¶ added in v1.18.7
WaitForNetworkGone polls until the network has been deleted.
func WaitForNetworkProvisioned ¶ added in v1.18.7
WaitForNetworkProvisioned polls until the network reaches the provisioned state.
func WaitForNetworkVisible ¶ added in v1.18.1
WaitForNetworkVisible polls until the network is readable at the API. The region API is eventually consistent on reads: writes are synchronous but GETs are served from the controller-runtime cache, so a just-created network can briefly 404. A dependent create that resolves the network reference (e.g. a load balancer) reads through the same cache and would fail with that transient 404, so await visibility before referencing it.
Types ¶
type APIClient ¶
type APIClient struct {
*coreclient.APIClient
// contains filtered or unexported fields
}
APIClient wraps the core API client with region-specific methods. Add methods here as you write tests for specific endpoints.
func NewAPIClient ¶
NewAPIClient creates a new Region API client.
func NewAPIClientWithConfig ¶
func NewAPIClientWithConfig(config *TestConfig) *APIClient
NewAPIClientWithConfig creates a new Region API client with the given config.
func (*APIClient) CreateFileStorage ¶ added in v1.15.0
func (c *APIClient) CreateFileStorage(ctx context.Context, request regionopenapi.StorageV2CreateRequest) (*regionopenapi.StorageV2Read, error)
CreateFileStorage creates a new file storage resource.
func (*APIClient) CreateImage ¶ added in v1.15.0
func (c *APIClient) CreateImage(ctx context.Context, orgID, regionID string, request regionopenapi.ImageCreate) (*regionopenapi.Image, error)
CreateImage creates a custom image in a region.
func (*APIClient) CreateLoadBalancer ¶ added in v1.16.1
func (c *APIClient) CreateLoadBalancer(ctx context.Context, request regionopenapi.LoadBalancerV2Create) (*regionopenapi.LoadBalancerV2Read, error)
CreateLoadBalancer creates a new load balancer.
func (*APIClient) CreateNetwork ¶ added in v1.15.0
func (c *APIClient) CreateNetwork(ctx context.Context, request regionopenapi.NetworkV2Create) (*regionopenapi.NetworkV2Read, error)
CreateNetwork creates a new network resource.
func (*APIClient) CreateSSHCertificateAuthority ¶ added in v1.16.7
func (c *APIClient) CreateSSHCertificateAuthority(ctx context.Context, request regionopenapi.SshCertificateAuthorityV2Create) (*regionopenapi.SshCertificateAuthorityV2Read, error)
CreateSSHCertificateAuthority creates a new SSH certificate authority.
func (*APIClient) CreateSecurityGroup ¶ added in v1.16.7
func (c *APIClient) CreateSecurityGroup(ctx context.Context, request regionopenapi.SecurityGroupV2Create) (*regionopenapi.SecurityGroupV2Read, error)
CreateSecurityGroup creates a new security group.
func (*APIClient) CreateServer ¶ added in v1.17.0
func (c *APIClient) CreateServer(ctx context.Context, request regionopenapi.ServerV2Create) (*regionopenapi.ServerV2Read, error)
CreateServer creates a new server.
func (*APIClient) CreateServerExpectError ¶ added in v1.18.7
func (c *APIClient) CreateServerExpectError(ctx context.Context, request regionopenapi.ServerV2Create, expectedStatus int) (*coreapi.Error, error)
CreateServerExpectError attempts a server create that is expected to be rejected with the given status, returning the decoded standard error body.
func (*APIClient) DeleteFileStorage ¶ added in v1.15.0
DeleteFileStorage deletes a file storage resource.
func (*APIClient) DeleteImage ¶ added in v1.15.0
DeleteImage deletes a specific image from a region. Returns ErrResourceNotFound if the image does not exist.
func (*APIClient) DeleteLoadBalancer ¶ added in v1.16.1
DeleteLoadBalancer deletes a load balancer. Returns ErrResourceNotFound if the load balancer does not exist.
func (*APIClient) DeleteNetwork ¶ added in v1.15.0
DeleteNetwork deletes a network resource. Returns ErrResourceNotFound if the network does not exist.
func (*APIClient) DeleteSSHCertificateAuthority ¶ added in v1.16.7
DeleteSSHCertificateAuthority deletes an SSH certificate authority.
func (*APIClient) DeleteSecurityGroup ¶ added in v1.16.7
DeleteSecurityGroup deletes a security group.
func (*APIClient) DeleteServer ¶ added in v1.17.0
DeleteServer deletes a server.
func (*APIClient) DoInternalRegionRequest ¶ added in v1.17.0
func (c *APIClient) DoInternalRegionRequest(ctx context.Context, method, path string, body io.Reader, expectedStatus int) (*http.Response, []byte, error)
DoInternalRegionRequest performs a local-only internal Region API request over mTLS.
func (*APIClient) DoRegionRequest ¶ added in v1.15.0
func (c *APIClient) DoRegionRequest(ctx context.Context, method, path string, body io.Reader, expectedStatus int) (*http.Response, []byte, error)
DoRegionRequest performs a request using the region base URL client. Use this for direct API calls that need to hit the region API.
func (*APIClient) GetEndpoints ¶ added in v1.15.0
GetEndpoints returns the endpoints instance for direct path access in tests.
func (*APIClient) GetFileStorage ¶ added in v1.15.0
func (c *APIClient) GetFileStorage(ctx context.Context, filestorageID string) (*regionopenapi.StorageV2Read, error)
GetFileStorage gets a specific file storage resource by ID. Returns ErrResourceNotFound if the file storage resource does not exist.
func (*APIClient) GetListRegionsPath ¶
GetListRegionsPath returns the path for listing regions. This is useful for tests that need direct access to the endpoint path.
func (*APIClient) GetLoadBalancer ¶ added in v1.16.1
func (c *APIClient) GetLoadBalancer(ctx context.Context, loadBalancerID string) (*regionopenapi.LoadBalancerV2Read, error)
GetLoadBalancer gets a specific load balancer by ID. Returns ErrResourceNotFound if the load balancer does not exist.
func (*APIClient) GetNetwork ¶ added in v1.16.5
func (c *APIClient) GetNetwork(ctx context.Context, networkID string) (*regionopenapi.NetworkV2Read, error)
GetNetwork gets a specific network by ID. Returns ErrResourceNotFound if the network does not exist.
func (*APIClient) GetRegionDetail ¶
func (c *APIClient) GetRegionDetail(ctx context.Context, orgID, regionID string) (*regionopenapi.RegionDetailRead, error)
GetRegionDetail gets detailed information about a specific region.
func (*APIClient) GetSSHCertificateAuthority ¶ added in v1.16.7
func (c *APIClient) GetSSHCertificateAuthority(ctx context.Context, sshCAID string) (*regionopenapi.SshCertificateAuthorityV2Read, error)
GetSSHCertificateAuthority gets a specific SSH certificate authority by ID. Returns ErrResourceNotFound if the resource does not exist.
func (*APIClient) GetSecurityGroup ¶ added in v1.16.7
func (c *APIClient) GetSecurityGroup(ctx context.Context, securityGroupID string) (*regionopenapi.SecurityGroupV2Read, error)
GetSecurityGroup gets a specific security group by ID. Returns ErrResourceNotFound if the security group does not exist.
func (*APIClient) GetServer ¶ added in v1.17.0
func (c *APIClient) GetServer(ctx context.Context, serverID string) (*regionopenapi.ServerV2Read, error)
GetServer gets a specific server by ID.
func (*APIClient) GetServerSSHKey ¶ added in v1.18.7
func (c *APIClient) GetServerSSHKey(ctx context.Context, serverID string) (*regionopenapi.SshKey, error)
GetServerSSHKey retrieves the generated private key for a server.
func (*APIClient) GetVersion ¶ added in v1.17.1
GetVersion gets the deployed region service version.
func (*APIClient) InternalAPIConfigured ¶ added in v1.17.0
InternalAPIConfigured reports whether local internal API mTLS credentials are present.
func (*APIClient) ListFileStorage ¶ added in v1.15.0
func (c *APIClient) ListFileStorage(ctx context.Context, orgID, projectID, regionID string) (regionopenapi.StorageV2List, error)
ListFileStorage lists all file storage resources for a project in a region.
func (*APIClient) ListFileStorageClasses ¶ added in v1.15.0
func (c *APIClient) ListFileStorageClasses(ctx context.Context, regionID string) (regionopenapi.StorageClassListV2Read, error)
ListFileStorageClasses lists all available file storage classes for a region.
func (*APIClient) ListFlavors ¶
func (c *APIClient) ListFlavors(ctx context.Context, orgID, regionID string) (regionopenapi.Flavors, error)
ListFlavors lists all flavors available in a region.
func (*APIClient) ListImages ¶
func (c *APIClient) ListImages(ctx context.Context, orgID, regionID string) (regionopenapi.Images, error)
ListImages lists all images available in a region.
func (*APIClient) ListLoadBalancers ¶ added in v1.16.1
func (c *APIClient) ListLoadBalancers(ctx context.Context, orgID, projectID, regionID string) (regionopenapi.LoadBalancersV2Read, error)
ListLoadBalancers lists all load balancers for a project in a region.
func (*APIClient) ListNetworks ¶ added in v1.15.0
func (c *APIClient) ListNetworks(ctx context.Context, orgID, projectID, regionID string) (regionopenapi.NetworksV2Read, error)
ListNetworks lists all networks for a project in a region.
func (*APIClient) ListRegions ¶
ListRegions lists all regions for an organization.
func (*APIClient) ListSSHCertificateAuthorities ¶ added in v1.16.7
func (c *APIClient) ListSSHCertificateAuthorities(ctx context.Context, orgID, projectID string) (regionopenapi.SshCertificateAuthoritiesV2Read, error)
ListSSHCertificateAuthorities lists SSH certificate authorities for an org and project.
func (*APIClient) ListSecurityGroups ¶ added in v1.16.7
func (c *APIClient) ListSecurityGroups(ctx context.Context, orgID, projectID, regionID string) (regionopenapi.SecurityGroupsV2Read, error)
ListSecurityGroups lists security groups filtered by org, project and region.
func (*APIClient) ListServers ¶ added in v1.17.0
func (c *APIClient) ListServers(ctx context.Context, orgID, projectID, regionID, networkID string) (regionopenapi.ServersV2Read, error)
ListServers lists all servers for a project in a region.
func (*APIClient) UpdateFileStorage ¶ added in v1.15.0
func (c *APIClient) UpdateFileStorage(ctx context.Context, filestorageID string, request regionopenapi.StorageV2UpdateRequest) (*regionopenapi.StorageV2Read, error)
UpdateFileStorage updates a file storage resource.
func (*APIClient) UpdateLoadBalancer ¶ added in v1.16.1
func (c *APIClient) UpdateLoadBalancer(ctx context.Context, loadBalancerID string, request regionopenapi.LoadBalancerV2Update) (*regionopenapi.LoadBalancerV2Read, error)
UpdateLoadBalancer updates a load balancer.
func (*APIClient) UpdateNetwork ¶ added in v1.16.5
func (c *APIClient) UpdateNetwork(ctx context.Context, networkID string, request regionopenapi.NetworkV2Update) (*regionopenapi.NetworkV2Read, error)
UpdateNetwork updates a network resource.
func (*APIClient) UpdateSecurityGroup ¶ added in v1.16.7
func (c *APIClient) UpdateSecurityGroup(ctx context.Context, securityGroupID string, request regionopenapi.SecurityGroupV2Update) (*regionopenapi.SecurityGroupV2Read, error)
UpdateSecurityGroup updates a security group's rules.
type Endpoints ¶
type Endpoints struct{}
Endpoints contains API endpoint patterns. Add endpoint methods here as you write tests for them.
func (*Endpoints) CreateFileStorage ¶ added in v1.15.0
CreateFileStorage returns the endpoint for creating file storage.
func (*Endpoints) CreateLoadBalancer ¶ added in v1.16.1
CreateLoadBalancer returns the endpoint for creating a load balancer.
func (*Endpoints) CreateNetwork ¶ added in v1.15.0
CreateNetwork returns the endpoint for creating a network.
func (*Endpoints) CreateSSHCertificateAuthority ¶ added in v1.16.7
CreateSSHCertificateAuthority returns the endpoint for creating an SSH certificate authority.
func (*Endpoints) CreateSecurityGroup ¶ added in v1.16.7
CreateSecurityGroup returns the endpoint for creating a security group.
func (*Endpoints) CreateServer ¶ added in v1.17.0
CreateServer returns the endpoint for creating a server.
func (*Endpoints) DeleteFileStorage ¶ added in v1.15.0
DeleteFileStorage returns the endpoint for deleting a specific file storage resource.
func (*Endpoints) DeleteImage ¶ added in v1.15.0
DeleteImage returns the endpoint for deleting a specific image.
func (*Endpoints) DeleteLoadBalancer ¶ added in v1.16.1
DeleteLoadBalancer returns the endpoint for deleting a specific load balancer.
func (*Endpoints) DeleteNetwork ¶ added in v1.15.0
DeleteNetwork returns the endpoint for deleting a specific network resource.
func (*Endpoints) DeleteSSHCertificateAuthority ¶ added in v1.16.7
DeleteSSHCertificateAuthority returns the endpoint for deleting a specific SSH certificate authority.
func (*Endpoints) DeleteSecurityGroup ¶ added in v1.16.7
DeleteSecurityGroup returns the endpoint for deleting a specific security group.
func (*Endpoints) DeleteServer ¶ added in v1.17.0
DeleteServer returns the endpoint for deleting a specific server.
func (*Endpoints) GetFileStorage ¶ added in v1.15.0
GetFileStorage returns the endpoint for getting a specific file storage resource.
func (*Endpoints) GetLoadBalancer ¶ added in v1.16.1
GetLoadBalancer returns the endpoint for getting a specific load balancer.
func (*Endpoints) GetNetwork ¶ added in v1.16.5
GetNetwork returns the endpoint for getting a specific network resource.
func (*Endpoints) GetRegionDetail ¶
GetRegionDetail returns the endpoint for getting detailed region information.
func (*Endpoints) GetSSHCertificateAuthority ¶ added in v1.16.7
GetSSHCertificateAuthority returns the endpoint for getting a specific SSH certificate authority.
func (*Endpoints) GetSecurityGroup ¶ added in v1.16.7
GetSecurityGroup returns the endpoint for getting a specific security group.
func (*Endpoints) GetServer ¶ added in v1.17.0
GetServer returns the endpoint for getting a specific server.
func (*Endpoints) GetServerSSHKey ¶ added in v1.18.7
GetServerSSHKey returns the endpoint for retrieving a server's generated SSH private key.
func (*Endpoints) ListFileStorage ¶ added in v1.15.0
ListFileStorage returns the endpoint for listing file storage in a project.
func (*Endpoints) ListFileStorageClasses ¶ added in v1.15.0
ListFileStorageClasses returns the endpoint for listing available file storage classes.
func (*Endpoints) ListFlavors ¶
ListFlavors returns the endpoint for listing flavors in a region.
func (*Endpoints) ListImages ¶
ListImages returns the endpoint for listing images in a region.
func (*Endpoints) ListLoadBalancers ¶ added in v1.16.1
ListLoadBalancers returns the endpoint for listing load balancers in a project.
func (*Endpoints) ListNetworks ¶ added in v1.15.0
ListNetworks returns the endpoint for listing networks in a project.
func (*Endpoints) ListRegions ¶
ListRegions returns the endpoint for listing all regions in an organization.
func (*Endpoints) ListSSHCertificateAuthorities ¶ added in v1.16.7
ListSSHCertificateAuthorities returns the endpoint for listing SSH certificate authorities.
func (*Endpoints) ListSecurityGroups ¶ added in v1.16.7
ListSecurityGroups returns the endpoint for listing security groups filtered by org, project and region.
func (*Endpoints) ListServers ¶ added in v1.17.0
ListServers returns the endpoint for listing servers in a project.
func (*Endpoints) UpdateFileStorage ¶ added in v1.15.0
UpdateFileStorage returns the endpoint for updating a specific file storage resource.
func (*Endpoints) UpdateLoadBalancer ¶ added in v1.16.1
UpdateLoadBalancer returns the endpoint for updating a specific load balancer.
func (*Endpoints) UpdateNetwork ¶ added in v1.16.5
UpdateNetwork returns the endpoint for updating a specific network resource.
func (*Endpoints) UpdateSecurityGroup ¶ added in v1.16.7
UpdateSecurityGroup returns the endpoint for updating a specific security group.
type FileStoragePayloadBuilder ¶ added in v1.18.7
type FileStoragePayloadBuilder struct {
// contains filtered or unexported fields
}
FileStoragePayloadBuilder builds StorageV2CreateRequest payloads for testing.
func NewFileStoragePayload ¶ added in v1.18.7
func NewFileStoragePayload(orgID, projectID, regionID, storageClassID string, networkIDs ...string) *FileStoragePayloadBuilder
NewFileStoragePayload creates a builder for an NFS file storage attached to the given networks.
func (*FileStoragePayloadBuilder) Build ¶ added in v1.18.7
func (b *FileStoragePayloadBuilder) Build() regionopenapi.StorageV2CreateRequest
Build returns the typed StorageV2CreateRequest struct.
func (*FileStoragePayloadBuilder) WithSizeGiB ¶ added in v1.18.7
func (b *FileStoragePayloadBuilder) WithSizeGiB(sizeGiB int64) *FileStoragePayloadBuilder
WithSizeGiB sets the requested storage size in GiB.
func (*FileStoragePayloadBuilder) WithSnapshotPolicies ¶ added in v1.18.7
func (b *FileStoragePayloadBuilder) WithSnapshotPolicies(policies *regionopenapi.StorageSnapshotPolicyListV2Spec) *FileStoragePayloadBuilder
WithSnapshotPolicies attaches user-managed snapshot policies (nil leaves the storage with none).
type GinkgoLogger ¶
type GinkgoLogger struct{}
GinkgoLogger implements the Logger interface for Ginkgo tests.
func (*GinkgoLogger) Printf ¶
func (g *GinkgoLogger) Printf(format string, args ...interface{})
type ImagePayloadBuilder ¶ added in v1.15.0
type ImagePayloadBuilder struct {
// contains filtered or unexported fields
}
ImagePayloadBuilder builds ImageCreate payloads for testing.
func NewImagePayload ¶ added in v1.15.0
func NewImagePayload() *ImagePayloadBuilder
NewImagePayload creates a builder with sensible defaults.
func (*ImagePayloadBuilder) Build ¶ added in v1.15.0
func (b *ImagePayloadBuilder) Build() regionopenapi.ImageCreate
Build returns the typed ImageCreate struct.
func (*ImagePayloadBuilder) WithArchitecture ¶ added in v1.15.0
func (b *ImagePayloadBuilder) WithArchitecture(a regionopenapi.Architecture) *ImagePayloadBuilder
WithArchitecture overrides the CPU architecture.
func (*ImagePayloadBuilder) WithName ¶ added in v1.15.0
func (b *ImagePayloadBuilder) WithName(name string) *ImagePayloadBuilder
WithName overrides the image name.
func (*ImagePayloadBuilder) WithOSCodename ¶ added in v1.15.0
func (b *ImagePayloadBuilder) WithOSCodename(codename string) *ImagePayloadBuilder
WithOSCodename overrides the OS codename (e.g. "noble").
func (*ImagePayloadBuilder) WithOSDistro ¶ added in v1.15.0
func (b *ImagePayloadBuilder) WithOSDistro(distro regionopenapi.OsDistro) *ImagePayloadBuilder
WithOSDistro overrides the OS distribution.
func (*ImagePayloadBuilder) WithOSFamily ¶ added in v1.15.0
func (b *ImagePayloadBuilder) WithOSFamily(family regionopenapi.OsFamily) *ImagePayloadBuilder
WithOSFamily overrides the OS family.
func (*ImagePayloadBuilder) WithOSKernel ¶ added in v1.15.0
func (b *ImagePayloadBuilder) WithOSKernel(kernel regionopenapi.OsKernel) *ImagePayloadBuilder
WithOSKernel overrides the OS kernel type.
func (*ImagePayloadBuilder) WithOSVersion ¶ added in v1.15.0
func (b *ImagePayloadBuilder) WithOSVersion(version string) *ImagePayloadBuilder
WithOSVersion overrides the OS version string.
func (*ImagePayloadBuilder) WithURI ¶ added in v1.15.0
func (b *ImagePayloadBuilder) WithURI(uri string) *ImagePayloadBuilder
WithURI overrides the image source URI.
func (*ImagePayloadBuilder) WithVirtualization ¶ added in v1.15.0
func (b *ImagePayloadBuilder) WithVirtualization(v regionopenapi.ImageVirtualization) *ImagePayloadBuilder
WithVirtualization overrides the virtualization type.
type LoadBalancerPayloadBuilder ¶ added in v1.16.1
type LoadBalancerPayloadBuilder struct {
// contains filtered or unexported fields
}
LoadBalancerPayloadBuilder builds LoadBalancerV2Create payloads for testing.
func NewLoadBalancerPayload ¶ added in v1.16.1
func NewLoadBalancerPayload(networkID string) *LoadBalancerPayloadBuilder
NewLoadBalancerPayload creates a builder with a single TCP listener and one pool member, wired to the given network. The default member ensures the payload is ready to provision against the OpenStack provider, which yields indefinitely while the pool has no effective members.
func (*LoadBalancerPayloadBuilder) Build ¶ added in v1.16.1
func (b *LoadBalancerPayloadBuilder) Build() regionopenapi.LoadBalancerV2Create
Build returns the typed LoadBalancerV2Create struct.
func (*LoadBalancerPayloadBuilder) WithListeners ¶ added in v1.16.1
func (b *LoadBalancerPayloadBuilder) WithListeners(listeners []regionopenapi.LoadBalancerListenerV2) *LoadBalancerPayloadBuilder
WithListeners overrides the listener list.
func (*LoadBalancerPayloadBuilder) WithName ¶ added in v1.16.1
func (b *LoadBalancerPayloadBuilder) WithName(name string) *LoadBalancerPayloadBuilder
WithName overrides the load balancer name.
func (*LoadBalancerPayloadBuilder) WithPublicIP ¶ added in v1.16.1
func (b *LoadBalancerPayloadBuilder) WithPublicIP(publicIP bool) *LoadBalancerPayloadBuilder
WithPublicIP sets whether a public IP should be allocated.
type NetworkPayloadBuilder ¶ added in v1.16.1
type NetworkPayloadBuilder struct {
// contains filtered or unexported fields
}
NetworkPayloadBuilder builds NetworkV2Create payloads for testing.
func NewNetworkPayload ¶ added in v1.16.1
func NewNetworkPayload(orgID, projectID, regionID string) *NetworkPayloadBuilder
NewNetworkPayload creates a builder with sensible defaults for a project-scoped v2 network.
func (*NetworkPayloadBuilder) Build ¶ added in v1.16.1
func (b *NetworkPayloadBuilder) Build() regionopenapi.NetworkV2Create
Build returns the typed NetworkV2Create struct.
func (*NetworkPayloadBuilder) WithName ¶ added in v1.16.1
func (b *NetworkPayloadBuilder) WithName(name string) *NetworkPayloadBuilder
WithName overrides the network name.
type SSHCertificateAuthorityPayloadBuilder ¶ added in v1.16.7
type SSHCertificateAuthorityPayloadBuilder struct {
// contains filtered or unexported fields
}
SSHCertificateAuthorityPayloadBuilder builds SshCertificateAuthorityV2Create payloads for testing.
func NewSSHCertificateAuthorityPayload ¶ added in v1.16.7
func NewSSHCertificateAuthorityPayload(orgID, projectID string) *SSHCertificateAuthorityPayloadBuilder
NewSSHCertificateAuthorityPayload creates a builder pre-loaded with a random Ed25519 public key.
func (*SSHCertificateAuthorityPayloadBuilder) Build ¶ added in v1.16.7
func (b *SSHCertificateAuthorityPayloadBuilder) Build() regionopenapi.SshCertificateAuthorityV2Create
Build returns the typed SshCertificateAuthorityV2Create struct.
func (*SSHCertificateAuthorityPayloadBuilder) WithName ¶ added in v1.16.7
func (b *SSHCertificateAuthorityPayloadBuilder) WithName(name string) *SSHCertificateAuthorityPayloadBuilder
WithName overrides the SSH CA name.
func (*SSHCertificateAuthorityPayloadBuilder) WithPublicKey ¶ added in v1.16.7
func (b *SSHCertificateAuthorityPayloadBuilder) WithPublicKey(key string) *SSHCertificateAuthorityPayloadBuilder
WithPublicKey overrides the public key.
type SecurityGroupPayloadBuilder ¶ added in v1.16.7
type SecurityGroupPayloadBuilder struct {
// contains filtered or unexported fields
}
SecurityGroupPayloadBuilder builds SecurityGroupV2Create payloads for testing.
func NewSecurityGroupPayload ¶ added in v1.16.7
func NewSecurityGroupPayload(networkID string) *SecurityGroupPayloadBuilder
NewSecurityGroupPayload creates a builder pre-loaded with a single allow-all TCP ingress rule.
func (*SecurityGroupPayloadBuilder) Build ¶ added in v1.16.7
func (b *SecurityGroupPayloadBuilder) Build() regionopenapi.SecurityGroupV2Create
Build returns the typed SecurityGroupV2Create struct.
func (*SecurityGroupPayloadBuilder) WithName ¶ added in v1.16.7
func (b *SecurityGroupPayloadBuilder) WithName(name string) *SecurityGroupPayloadBuilder
WithName overrides the security group name.
func (*SecurityGroupPayloadBuilder) WithRules ¶ added in v1.16.7
func (b *SecurityGroupPayloadBuilder) WithRules(rules regionopenapi.SecurityGroupRuleV2List) *SecurityGroupPayloadBuilder
WithRules overrides the rule list.
type ServerPayloadBuilder ¶ added in v1.17.0
type ServerPayloadBuilder struct {
// contains filtered or unexported fields
}
ServerPayloadBuilder builds ServerV2Create payloads for testing.
func NewServerPayload ¶ added in v1.17.0
func NewServerPayload(networkID, flavorID, imageID string) *ServerPayloadBuilder
NewServerPayload creates a builder for a project-scoped v2 server.
func (*ServerPayloadBuilder) Build ¶ added in v1.17.0
func (b *ServerPayloadBuilder) Build() regionopenapi.ServerV2Create
Build returns the typed ServerV2Create struct.
func (*ServerPayloadBuilder) WithInfrastructureRef ¶ added in v1.17.0
func (b *ServerPayloadBuilder) WithInfrastructureRef(infrastructureRef string) *ServerPayloadBuilder
WithInfrastructureRef pins the server to a provider-specific host.
func (*ServerPayloadBuilder) WithName ¶ added in v1.17.0
func (b *ServerPayloadBuilder) WithName(name string) *ServerPayloadBuilder
WithName overrides the server name.
func (*ServerPayloadBuilder) WithNetworking ¶ added in v1.17.0
func (b *ServerPayloadBuilder) WithNetworking(networking *regionopenapi.ServerV2Networking) *ServerPayloadBuilder
WithNetworking overrides the server networking options.
func (*ServerPayloadBuilder) WithUserData ¶ added in v1.18.7
func (b *ServerPayloadBuilder) WithUserData(userData []byte) *ServerPayloadBuilder
WithUserData sets the cloud-init user data supplied at boot.
type TestConfig ¶
type TestConfig struct {
coreconfig.BaseConfig
OrgID string
ProjectID string
RegionBaseURL string
RegionCACertPath string
RegionID string
PrivateRegionID string
SecondaryOrgID string
SecondaryProjectID string
SecondaryAuthToken string
InternalAPICert string
InternalAPIKey string
InternalAPICN string
InternalAPIActor string
ServerFlavorID string
ServerImageID string
ServerInfrastructureRef string
FileStorageSnapshotDir string
}
TestConfig extends the base config with Region-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.
func (*TestConfig) HasInternalAPIConfig ¶ added in v1.17.0
func (c *TestConfig) HasInternalAPIConfig() bool
HasInternalAPIConfig reports whether local internal API credentials are available.