testutils

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GetServerTypePRO2XSRequest = mockutil.Request{
		Method: "GET",
		Path:   "/instance/v1/zones/fr-par-1/products/servers?page=1",
		Status: 200,
		JSON: scwInstance.ListServersTypesResponse{
			Servers: map[string]*scwInstance.ServerType{
				"PRO2-XS": {
					Arch: "x86_64",
					VolumesConstraint: &scwInstance.ServerTypeVolumeConstraintSizes{
						MinSize: 0,
						MaxSize: 0,
					},
					PerVolumeConstraint: &scwInstance.ServerTypeVolumeConstraintsByType{
						LSSD: &scwInstance.ServerTypeVolumeConstraintSizes{
							MinSize: 0,
							MaxSize: 0,
						},
					},
				},
			},
			TotalCount: 1,
		},
	}
	GetServerTypePRO2SRequest = mockutil.Request{
		Method: "GET",
		Path:   "/instance/v1/zones/fr-par-1/products/servers?page=1",
		Status: 200,
		JSON: scwInstance.ListServersTypesResponse{
			Servers: map[string]*scwInstance.ServerType{
				"PRO2-S": {
					Arch: "x86_64",
					VolumesConstraint: &scwInstance.ServerTypeVolumeConstraintSizes{
						MinSize: 0,
						MaxSize: 0,
					},
					PerVolumeConstraint: &scwInstance.ServerTypeVolumeConstraintsByType{
						LSSD: &scwInstance.ServerTypeVolumeConstraintSizes{
							MinSize: 0,
							MaxSize: 0,
						},
					},
				},
			},
			TotalCount: 1,
		},
	}
	GetServerTypeGP1SRequest = mockutil.Request{
		Method: "GET",
		Path:   "/instance/v1/zones/fr-par-1/products/servers?page=1",
		Status: 200,
		JSON: scwInstance.ListServersTypesResponse{
			Servers: map[string]*scwInstance.ServerType{
				"GP1-S": {
					Arch: "x86_64",
					VolumesConstraint: &scwInstance.ServerTypeVolumeConstraintSizes{
						MinSize: 0 * scw.GB,
						MaxSize: 300 * scw.GB,
					},
					PerVolumeConstraint: &scwInstance.ServerTypeVolumeConstraintsByType{
						LSSD: &scwInstance.ServerTypeVolumeConstraintSizes{
							MinSize: 10 * scw.GB,
							MaxSize: 800 * scw.GB,
						},
					},
				},
			},
			TotalCount: 1,
		},
	}
	GetServerTypeDEV1SRequest = mockutil.Request{
		Method: "GET",
		Path:   "/instance/v1/zones/fr-par-1/products/servers?page=1",
		Status: 200,
		JSON: scwInstance.ListServersTypesResponse{
			Servers: map[string]*scwInstance.ServerType{
				"DEV1-S": {
					Arch: "x86_64",
					VolumesConstraint: &scwInstance.ServerTypeVolumeConstraintSizes{
						MinSize: 0 * scw.GB,
						MaxSize: 20 * scw.GB,
					},
					PerVolumeConstraint: &scwInstance.ServerTypeVolumeConstraintsByType{
						LSSD: &scwInstance.ServerTypeVolumeConstraintSizes{
							MinSize: 10 * scw.GB,
							MaxSize: 800 * scw.GB,
						},
					},
				},
			},
			TotalCount: 1,
		},
	}
	GetImageDebian12UUIDLocalRequest = mockutil.Request{
		Method: "GET", Path: "/instance/v1/zones/fr-par-1/images/291b1402-9650-45a9-8928-295634438dff",
		Status: 200,
		JSON: scwInstance.GetImageResponse{
			Image: &scwInstance.Image{
				ID:   "291b1402-9650-45a9-8928-295634438dff",
				Zone: "fr-par-1",
				RootVolume: &scwInstance.VolumeSummary{
					VolumeType: scwInstance.VolumeVolumeTypeLSSD,
				},
			},
		},
	}
	GetImageDebian12UUIDSBSRequest = mockutil.Request{
		Method: "GET", Path: "/instance/v1/zones/fr-par-1/images/8f657237-a413-4087-aa5d-0ce7a6154a41",
		Status: 200,
		JSON: scwInstance.GetImageResponse{
			Image: &scwInstance.Image{
				ID:   "8f657237-a413-4087-aa5d-0ce7a6154a41",
				Zone: "fr-par-1",
				RootVolume: &scwInstance.VolumeSummary{
					VolumeType: scwInstance.VolumeVolumeTypeSbsVolume,
				},
			},
		},
	}
	GetImageDebian12MarketplaceLocalRequest = mockutil.Request{
		Method: "GET", Path: "/marketplace/v2/local-images?image_label=debian_bookworm&order_by=type_asc&page=1&type=instance_local&zone=fr-par-1",
		Status: 200,
		JSON: scwMarketplace.ListLocalImagesResponse{
			LocalImages: []*scwMarketplace.LocalImage{
				{
					ID:                        "291b1402-9650-45a9-8928-295634438dff",
					Zone:                      "fr-par-1",
					Label:                     "debian_bookworm",
					CompatibleCommercialTypes: []string{"GP1-S"},
					Type:                      scwMarketplace.LocalImageTypeInstanceLocal,
				},
			},
		},
	}
	GetImageDebian12MarketplaceSBSRequest = mockutil.Request{
		Method: "GET", Path: "/marketplace/v2/local-images?image_label=debian_bookworm&order_by=type_asc&page=1&type=instance_sbs&zone=fr-par-1",
		Status: 200,
		JSON: scwMarketplace.ListLocalImagesResponse{
			LocalImages: []*scwMarketplace.LocalImage{
				{
					ID:                        "8f657237-a413-4087-aa5d-0ce7a6154a41",
					Zone:                      "fr-par-1",
					Label:                     "debian_bookworm",
					CompatibleCommercialTypes: []string{"PRO2-XS", "PRO2-S"},
					Type:                      scwMarketplace.LocalImageTypeInstanceSbs,
				},
			},
		},
	}
	GetPrivateNetworkSampleRequest = mockutil.Request{
		Method: "GET",
		Path:   "/vpc/v2/regions/fr-par/private-networks/ce3dd6e8-ca68-4147-8619-3c9d5634e260",
		Status: 200,
		JSON: scwVpc.PrivateNetwork{
			Region: "fr-par",
			ID:     "ce3dd6e8-ca68-4147-8619-3c9d5634e260",
		},
	}
	GetServerTypesAvailabilityAllAvailableRequest = mockutil.Request{
		Method: "GET",
		Path:   "/instance/v1/zones/fr-par-1/products/servers/availability?page=1",
		Status: 200,
		JSON: scwInstance.GetServerTypesAvailabilityResponse{
			Servers: map[string]*scwInstance.GetServerTypesAvailabilityResponseAvailability{
				"PRO2-XS": {Availability: scwInstance.ServerTypesAvailabilityAvailable},
				"PRO2-S":  {Availability: scwInstance.ServerTypesAvailabilityAvailable},
				"GP1-S":   {Availability: scwInstance.ServerTypesAvailabilityAvailable},
				"DEV1-S":  {Availability: scwInstance.ServerTypesAvailabilityAvailable},
			},
		},
	}
	GetServerTypesAvailabilityPRO2XSShortageRequest = mockutil.Request{
		Method: "GET",
		Path:   "/instance/v1/zones/fr-par-1/products/servers/availability?page=1",
		Status: 200,
		JSON: scwInstance.GetServerTypesAvailabilityResponse{
			Servers: map[string]*scwInstance.GetServerTypesAvailabilityResponseAvailability{
				"PRO2-XS": {Availability: scwInstance.ServerTypesAvailabilityShortage},
				"PRO2-S":  {Availability: scwInstance.ServerTypesAvailabilityAvailable},
				"GP1-S":   {Availability: scwInstance.ServerTypesAvailabilityAvailable},
				"DEV1-S":  {Availability: scwInstance.ServerTypesAvailabilityAvailable},
			},
		},
	}
	GetServerTypesAvailabilityAllShortageRequest = mockutil.Request{
		Method: "GET",
		Path:   "/instance/v1/zones/fr-par-1/products/servers/availability?page=1",
		Status: 200,
		JSON: scwInstance.GetServerTypesAvailabilityResponse{
			Servers: map[string]*scwInstance.GetServerTypesAvailabilityResponseAvailability{
				"PRO2-XS": {Availability: scwInstance.ServerTypesAvailabilityShortage},
				"PRO2-S":  {Availability: scwInstance.ServerTypesAvailabilityShortage},
				"GP1-S":   {Availability: scwInstance.ServerTypesAvailabilityShortage},
				"DEV1-S":  {Availability: scwInstance.ServerTypesAvailabilityShortage},
			},
		},
	}
)

Functions

func MakeTestClient

func MakeTestClient(endpoint string) *scw.Client

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL