Documentation
¶
Index ¶
- func WaitForImageReady(c *APIClient, ctx context.Context, config *TestConfig, imageID 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) CreateNetwork(ctx context.Context, request regionopenapi.NetworkV2CreateRequest) (*regionopenapi.NetworkV2Read, 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) DeleteNetwork(ctx context.Context, networkID string) 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) GetRegionDetail(ctx context.Context, orgID, regionID string) (*regionopenapi.RegionDetailRead, error)
- func (c *APIClient) ListExternalNetworks(ctx context.Context, orgID, regionID string) (regionopenapi.ExternalNetworks, error)
- 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) 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) UpdateFileStorage(ctx context.Context, filestorageID string, ...) (*regionopenapi.StorageV2Read, error)
- type Endpoints
- func (e *Endpoints) CreateFileStorage() string
- func (e *Endpoints) CreateNetwork() string
- func (e *Endpoints) DeleteFileStorage(filestorageID string) string
- func (e *Endpoints) DeleteImage(orgID, regionID, imageID string) string
- func (e *Endpoints) DeleteNetwork(networkID string) string
- func (e *Endpoints) GetFileStorage(filestorageID string) string
- func (e *Endpoints) GetRegionDetail(orgID, regionID string) string
- func (e *Endpoints) ListExternalNetworks(orgID, regionID 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) ListNetworks(orgID, projectID, regionID string) string
- func (e *Endpoints) ListRegions(orgID string) string
- func (e *Endpoints) UpdateFileStorage(filestorageID string) string
- 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 TestConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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.
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) CreateNetwork ¶ added in v1.15.0
func (c *APIClient) CreateNetwork(ctx context.Context, request regionopenapi.NetworkV2CreateRequest) (*regionopenapi.NetworkV2Read, error)
CreateNetwork creates a new network resource.
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) DeleteNetwork ¶ added in v1.15.0
DeleteNetwork deletes a network resource.
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.
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) GetRegionDetail ¶
func (c *APIClient) GetRegionDetail(ctx context.Context, orgID, regionID string) (*regionopenapi.RegionDetailRead, error)
GetRegionDetail gets detailed information about a specific region.
func (*APIClient) ListExternalNetworks ¶
func (c *APIClient) ListExternalNetworks(ctx context.Context, orgID, regionID string) (regionopenapi.ExternalNetworks, error)
ListExternalNetworks lists all external networks available in a region.
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) 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) 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.
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) CreateNetwork ¶ added in v1.15.0
CreateNetwork returns the endpoint for creating a network.
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) DeleteNetwork ¶ added in v1.15.0
DeleteNetwork returns the endpoint for deleting a specific network resource.
func (*Endpoints) GetFileStorage ¶ added in v1.15.0
GetFileStorage returns the endpoint for getting a specific file storage resource.
func (*Endpoints) GetRegionDetail ¶
GetRegionDetail returns the endpoint for getting detailed region information.
func (*Endpoints) ListExternalNetworks ¶
ListExternalNetworks returns the endpoint for listing external networks in a region.
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) 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) UpdateFileStorage ¶ added in v1.15.0
UpdateFileStorage returns the endpoint for updating a specific file storage resource.
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 TestConfig ¶
type TestConfig struct {
coreconfig.BaseConfig
OrgID string
ProjectID string
RegionBaseURL string
RegionID 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.