Documentation ¶
Overview ¶
nodes unit tests
Index ¶
- Constants
- Variables
- func HandleChangePowerStateSuccessfully(t *testing.T)
- func HandleChangePowerStateWithConflict(t *testing.T)
- func HandleCreateSubscriptionVendorPassthruAllParametersSuccessfully(t *testing.T)
- func HandleCreateSubscriptionVendorPassthruRequiredParametersSuccessfully(t *testing.T)
- func HandleDeleteSubscriptionVendorPassthruSuccessfully(t *testing.T)
- func HandleGetAllSubscriptionsVendorPassthruSuccessfully(t *testing.T)
- func HandleGetBIOSSettingSuccessfully(t *testing.T)
- func HandleGetBootDeviceSuccessfully(t *testing.T)
- func HandleGetSubscriptionVendorPassthruSuccessfully(t *testing.T)
- func HandleGetSupportedBootDeviceSuccessfully(t *testing.T)
- func HandleGetVendorPassthruMethodsSuccessfully(t *testing.T)
- func HandleInjectNMISuccessfully(t *testing.T)
- func HandleListBIOSSettingsSuccessfully(t *testing.T)
- func HandleListDetailBIOSSettingsSuccessfully(t *testing.T)
- func HandleNodeChangeProvisionStateActive(t *testing.T)
- func HandleNodeChangeProvisionStateActiveWithSteps(t *testing.T)
- func HandleNodeChangeProvisionStateClean(t *testing.T)
- func HandleNodeChangeProvisionStateCleanWithConflict(t *testing.T)
- func HandleNodeChangeProvisionStateConfigDrive(t *testing.T)
- func HandleNodeCreationSuccessfully(t *testing.T, response string)
- func HandleNodeDeletionSuccessfully(t *testing.T)
- func HandleNodeGetSuccessfully(t *testing.T)
- func HandleNodeListDetailSuccessfully(t *testing.T)
- func HandleNodeListSuccessfully(t *testing.T)
- func HandleNodeUpdateSuccessfully(t *testing.T, response string)
- func HandleNodeValidateSuccessfully(t *testing.T)
- func HandleSetBootDeviceSuccessfully(t *testing.T)
- func HandleSetNodeMaintenanceSuccessfully(t *testing.T)
- func HandleSetRAIDConfig(t *testing.T)
- func HandleSetRAIDConfigMaxSize(t *testing.T)
- func HandleUnsetNodeMaintenanceSuccessfully(t *testing.T)
Constants ¶
const NodeBIOSSettingsBody = `` /* 223-byte string literal not displayed */
const NodeBootDeviceBody = `
{
"boot_device":"pxe",
"persistent":false
}
`
const NodeCreateSubscriptionVendorPassthruAllParametersBody = `` /* 223-byte string literal not displayed */
const NodeCreateSubscriptionVendorPassthruRequiredParametersBody = `` /* 167-byte string literal not displayed */
const NodeDetailBIOSSettingsBody = `` /* 2289-byte string literal not displayed */
const NodeGetAllSubscriptionsVnedorPassthruBody = `` /* 485-byte string literal not displayed */
const NodeGetSubscriptionVendorPassthruBody = `` /* 185-byte string literal not displayed */
const NodeListBody = `` /* 1414-byte string literal not displayed */
NodeListBody contains the canned body of a nodes.List response, without detail.
const NodeListDetailBody = `` /* 9694-byte string literal not displayed */
NodeListDetailBody contains the canned body of a nodes.ListDetail response.
const NodeProvisionStateActiveBody = `
{
"target": "active",
"configdrive": "http://127.0.0.1/images/test-node-config-drive.iso.gz"
}
`
const NodeProvisionStateActiveBodyWithSteps = `` /* 177-byte string literal not displayed */
const NodeProvisionStateCleanBody = `` /* 218-byte string literal not displayed */
const NodeProvisionStateConfigDriveBody = `` /* 224-byte string literal not displayed */
const NodeSetMaintenanceBody = `
{
"reason": "I'm tired"
}
`
const NodeSingleBIOSSettingBody = `
{
"Setting": {
"name": "ProcVirtualization",
"value": "Enabled"
}
}
`
const NodeSupportedBootDeviceBody = `
{
"supported_boot_devices": [
"pxe",
"disk"
]
}
`
const NodeValidationBody = `` /* 1414-byte string literal not displayed */
const NodeVendorPassthruMethodsBody = `` /* 695-byte string literal not displayed */
const SingleNodeBody = `` /* 3008-byte string literal not displayed */
SingleNodeBody is the canned body of a Get request on an existing node.
Variables ¶
var ( NodeFoo = nodes.Node{ UUID: "d2630783-6ec8-4836-b556-ab427c4b581e", Name: "foo", PowerState: "", TargetPowerState: "", ProvisionState: "enroll", TargetProvisionState: "", Maintenance: false, MaintenanceReason: "", Fault: "", LastError: "", Reservation: "", Driver: "ipmi", DriverInfo: map[string]interface{}{ "ipmi_port": "6230", "ipmi_username": "admin", "deploy_kernel": "http://172.22.0.1/images/tinyipa-stable-rocky.vmlinuz", "ipmi_address": "192.168.122.1", "deploy_ramdisk": "http://172.22.0.1/images/tinyipa-stable-rocky.gz", "ipmi_password": "admin", }, DriverInternalInfo: map[string]interface{}{}, Properties: map[string]interface{}{}, InstanceInfo: map[string]interface{}{}, InstanceUUID: "", ChassisUUID: "", Extra: map[string]interface{}{}, ConsoleEnabled: false, RAIDConfig: map[string]interface{}{}, TargetRAIDConfig: map[string]interface{}{}, CleanStep: map[string]interface{}{}, DeployStep: map[string]interface{}{}, ResourceClass: "", BIOSInterface: "no-bios", BootInterface: "pxe", ConsoleInterface: "no-console", DeployInterface: "iscsi", InspectInterface: "no-inspect", ManagementInterface: "ipmitool", NetworkInterface: "flat", PowerInterface: "ipmitool", RAIDInterface: "no-raid", RescueInterface: "no-rescue", StorageInterface: "noop", Traits: []string{}, VendorInterface: "ipmitool", ConductorGroup: "", Protected: false, ProtectedReason: "", CreatedAt: createdAtFoo, UpdatedAt: updatedAt, ProvisionUpdatedAt: provisonUpdatedAt, } NodeFooValidation = nodes.NodeValidation{ BIOS: nodes.DriverValidation{ Result: false, Reason: "Driver ipmi does not support bios (disabled or not implemented).", }, Boot: nodes.DriverValidation{ Result: false, Reason: "Cannot validate image information for node a62b8495-52e2-407b-b3cb-62775d04c2b8 because one or more parameters are missing from its instance_info and insufficent information is present to boot from a remote volume. Missing are: ['ramdisk', 'kernel', 'image_source']", }, Console: nodes.DriverValidation{ Result: false, Reason: "Driver ipmi does not support console (disabled or not implemented).", }, Deploy: nodes.DriverValidation{ Result: false, Reason: "Cannot validate image information for node a62b8495-52e2-407b-b3cb-62775d04c2b8 because one or more parameters are missing from its instance_info and insufficent information is present to boot from a remote volume. Missing are: ['ramdisk', 'kernel', 'image_source']", }, Inspect: nodes.DriverValidation{ Result: false, Reason: "Driver ipmi does not support inspect (disabled or not implemented).", }, Management: nodes.DriverValidation{ Result: true, }, Network: nodes.DriverValidation{ Result: true, }, Power: nodes.DriverValidation{ Result: true, }, RAID: nodes.DriverValidation{ Result: false, Reason: "Driver ipmi does not support raid (disabled or not implemented).", }, Rescue: nodes.DriverValidation{ Result: false, Reason: "Driver ipmi does not support rescue (disabled or not implemented).", }, Storage: nodes.DriverValidation{ Result: true, }, } NodeBootDevice = nodes.BootDeviceOpts{ BootDevice: "pxe", Persistent: false, } NodeSupportedBootDevice = []string{ "pxe", "disk", } InspectionStartedAt = time.Date(2023, time.February, 2, 14, 35, 59, 682403000, time.UTC) InspectionFinishedAt = time.Date(2023, time.February, 2, 14, 45, 59, 705249000, time.UTC) NodeBar = nodes.Node{ UUID: "08c84581-58f5-4ea2-a0c6-dd2e5d2b3662", Name: "bar", PowerState: "", TargetPowerState: "", ProvisionState: "available", TargetProvisionState: "", Maintenance: false, MaintenanceReason: "", Fault: "", LastError: "", Reservation: "", Driver: "ipmi", DriverInfo: map[string]interface{}{}, DriverInternalInfo: map[string]interface{}{}, Properties: map[string]interface{}{}, InstanceInfo: map[string]interface{}{}, InstanceUUID: "", ChassisUUID: "", Extra: map[string]interface{}{}, ConsoleEnabled: false, RAIDConfig: map[string]interface{}{}, TargetRAIDConfig: map[string]interface{}{}, CleanStep: map[string]interface{}{}, DeployStep: map[string]interface{}{}, ResourceClass: "", BIOSInterface: "no-bios", BootInterface: "pxe", ConsoleInterface: "no-console", DeployInterface: "iscsi", InspectInterface: "no-inspect", ManagementInterface: "ipmitool", NetworkInterface: "flat", PowerInterface: "ipmitool", RAIDInterface: "no-raid", RescueInterface: "no-rescue", StorageInterface: "noop", Traits: []string{}, VendorInterface: "ipmitool", ConductorGroup: "", Protected: false, ProtectedReason: "", CreatedAt: createdAtBar, UpdatedAt: updatedAt, InspectionStartedAt: &InspectionStartedAt, InspectionFinishedAt: &InspectionFinishedAt, } NodeBaz = nodes.Node{ UUID: "c9afd385-5d89-4ecb-9e1c-68194da6b474", Name: "baz", PowerState: "", TargetPowerState: "", ProvisionState: "enroll", TargetProvisionState: "", Maintenance: false, MaintenanceReason: "", Fault: "", LastError: "", Reservation: "", Driver: "ipmi", DriverInfo: map[string]interface{}{}, DriverInternalInfo: map[string]interface{}{}, Properties: map[string]interface{}{}, InstanceInfo: map[string]interface{}{}, InstanceUUID: "", ChassisUUID: "", Extra: map[string]interface{}{}, ConsoleEnabled: false, RAIDConfig: map[string]interface{}{}, TargetRAIDConfig: map[string]interface{}{}, CleanStep: map[string]interface{}{}, DeployStep: map[string]interface{}{}, ResourceClass: "", BIOSInterface: "no-bios", BootInterface: "pxe", ConsoleInterface: "no-console", DeployInterface: "iscsi", InspectInterface: "no-inspect", ManagementInterface: "ipmitool", NetworkInterface: "flat", PowerInterface: "ipmitool", RAIDInterface: "no-raid", RescueInterface: "no-rescue", StorageInterface: "noop", Traits: []string{}, VendorInterface: "ipmitool", ConductorGroup: "", Protected: false, ProtectedReason: "", CreatedAt: createdAtBaz, UpdatedAt: updatedAt, } ConfigDriveMap = nodes.ConfigDrive{ UserData: map[string]interface{}{ "ignition": map[string]string{ "version": "2.2.0", }, "systemd": map[string]interface{}{ "units": []map[string]interface{}{{ "name": "example.service", "enabled": true, }, }, }, }, } NodeBIOSSettings = []nodes.BIOSSetting{ { Name: "Proc1L2Cache", Value: "10x256 KB", }, { Name: "Proc1NumCores", Value: "10", }, { Name: "ProcVirtualization", Value: "Enabled", }, } NodeDetailBIOSSettings = []nodes.BIOSSetting{ { Name: "Proc1L2Cache", Value: "10x256 KB", AttributeType: "String", AllowableValues: []string{}, LowerBound: nil, UpperBound: nil, MinLength: &minLength, MaxLength: &maxLength, ReadOnly: &iTrue, ResetRequired: nil, Unique: nil, }, { Name: "Proc1NumCores", Value: "10", AttributeType: "Integer", AllowableValues: []string{}, LowerBound: &lowerBound, UpperBound: &upperBound, MinLength: nil, MaxLength: nil, ReadOnly: &iTrue, ResetRequired: nil, Unique: nil, }, { Name: "ProcVirtualization", Value: "Enabled", AttributeType: "Enumeration", AllowableValues: []string{"Enabled", "Disabled"}, LowerBound: nil, UpperBound: nil, MinLength: nil, MaxLength: nil, ReadOnly: &iFalse, ResetRequired: nil, Unique: nil, }, } NodeSingleBIOSSetting = nodes.BIOSSetting{ Name: "ProcVirtualization", Value: "Enabled", } NodeVendorPassthruMethods = nodes.VendorPassthruMethods{ CreateSubscription: nodes.CreateSubscriptionMethod{ HTTPMethods: []string{"POST"}, Async: false, Description: "", Attach: false, RequireExclusiveLock: true, }, DeleteSubscription: nodes.DeleteSubscriptionMethod{ HTTPMethods: []string{"DELETE"}, Async: false, Description: "", Attach: false, RequireExclusiveLock: true, }, GetSubscription: nodes.GetSubscriptionMethod{ HTTPMethods: []string{"GET"}, Async: false, Description: "", Attach: false, RequireExclusiveLock: true, }, GetAllSubscriptions: nodes.GetAllSubscriptionsMethod{ HTTPMethods: []string{"GET"}, Async: false, Description: "", Attach: false, RequireExclusiveLock: true, }, } NodeGetAllSubscriptions = nodes.GetAllSubscriptionsVendorPassthru{ Context: "/redfish/v1/$metadata#EventDestinationCollection.EventDestinationCollection", Etag: "", Id: "/redfish/v1/EventService/Subscriptions", Type: "#EventDestinationCollection.EventDestinationCollection", Description: "List of Event subscriptions", Name: "Event Subscriptions Collection", Members: []map[string]string{{"@odata.id": "/redfish/v1/EventService/Subscriptions/62dbd1b6-f637-11eb-b551-4cd98f20754c"}}, MembersCount: 1, } NodeGetSubscription = nodes.SubscriptionVendorPassthru{ Id: "62dbd1b6-f637-11eb-b551-4cd98f20754c", Context: "Ironic", Destination: "https://192.168.0.1/EventReceiver.php", EventTypes: []string{"Alert"}, Protocol: "Redfish", } NodeCreateSubscriptionRequiredParameters = nodes.SubscriptionVendorPassthru{ Id: "344a3e2-978a-444e-990a-cbf47c62ef88", Context: "", Destination: "https://somedestinationurl", EventTypes: []string{"Alert"}, Protocol: "Redfish", } NodeCreateSubscriptionAllParameters = nodes.SubscriptionVendorPassthru{ Id: "eaa43e2-018a-424e-990a-cbf47c62ef80", Context: "gophercloud", Destination: "https://someurl", EventTypes: []string{"Alert"}, Protocol: "Redfish", } )
Functions ¶
func HandleChangePowerStateSuccessfully ¶
HandleChangePowerStateSuccessfully sets up the test server to respond to a change power state request for a node
func HandleChangePowerStateWithConflict ¶
HandleChangePowerStateWithConflict sets up the test server to respond to a change power state request for a node with a 409 error
func HandleCreateSubscriptionVendorPassthruAllParametersSuccessfully ¶ added in v0.20.0
func HandleCreateSubscriptionVendorPassthruRequiredParametersSuccessfully ¶ added in v0.20.0
func HandleDeleteSubscriptionVendorPassthruSuccessfully ¶ added in v0.20.0
func HandleGetAllSubscriptionsVendorPassthruSuccessfully ¶ added in v0.20.0
func HandleGetBIOSSettingSuccessfully ¶ added in v0.18.0
func HandleGetBootDeviceSuccessfully ¶
HandleGetBootDeviceSuccessfully sets up the test server to respond to a get boot device request for a node
func HandleGetSubscriptionVendorPassthruSuccessfully ¶ added in v0.20.0
func HandleGetSupportedBootDeviceSuccessfully ¶
HandleGetBootDeviceSuccessfully sets up the test server to respond to a get boot device request for a node
func HandleGetVendorPassthruMethodsSuccessfully ¶ added in v0.20.0
func HandleInjectNMISuccessfully ¶
HandleInjectNMISuccessfully sets up the test server to respond to a node InjectNMI request
func HandleListBIOSSettingsSuccessfully ¶ added in v0.18.0
func HandleListDetailBIOSSettingsSuccessfully ¶ added in v0.18.0
func HandleNodeChangeProvisionStateActiveWithSteps ¶ added in v0.16.0
func HandleNodeCreationSuccessfully ¶
HandleServerCreationSuccessfully sets up the test server to respond to a server creation request with a given response.
func HandleNodeDeletionSuccessfully ¶
HandleNodeDeletionSuccessfully sets up the test server to respond to a server deletion request.
func HandleNodeListDetailSuccessfully ¶
HandleNodeListSuccessfully sets up the test server to respond to a server List request.
func HandleNodeListSuccessfully ¶
HandleNodeListSuccessfully sets up the test server to respond to a server List request.
func HandleSetBootDeviceSuccessfully ¶
HandleSetBootDeviceSuccessfully sets up the test server to respond to a set boot device request for a node
func HandleSetNodeMaintenanceSuccessfully ¶ added in v0.25.0
func HandleSetRAIDConfig ¶
func HandleUnsetNodeMaintenanceSuccessfully ¶ added in v0.25.0
Types ¶
This section is empty.