testing

package
v1.1.35 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

nodes unit tests

Index

Constants

View Source
const NodeBIOSSettingsBody = `` /* 223-byte string literal not displayed */
View Source
const NodeBootDeviceBody = `
{
  "boot_device":"pxe",
  "persistent":false
}
`
View Source
const NodeCreateSubscriptionVendorPassthruAllParametersBody = `` /* 223-byte string literal not displayed */
View Source
const NodeCreateSubscriptionVendorPassthruRequiredParametersBody = `` /* 167-byte string literal not displayed */
View Source
const NodeDetailBIOSSettingsBody = `` /* 2289-byte string literal not displayed */
View Source
const NodeGetAllSubscriptionsVnedorPassthruBody = `` /* 485-byte string literal not displayed */
View Source
const NodeGetSubscriptionVendorPassthruBody = `` /* 185-byte string literal not displayed */
View Source
const NodeListBody = `` /* 1414-byte string literal not displayed */

NodeListBody contains the canned body of a nodes.List response, without detail.

View Source
const NodeListDetailBody = `` /* 9641-byte string literal not displayed */

NodeListDetailBody contains the canned body of a nodes.ListDetail response.

View Source
const NodeProvisionStateActiveBody = `
{
    "target": "active",
    "configdrive": "http://127.0.0.1/images/test-node-config-drive.iso.gz"
}
`
View Source
const NodeProvisionStateActiveBodyWithSteps = `` /* 177-byte string literal not displayed */
View Source
const NodeProvisionStateCleanBody = `` /* 218-byte string literal not displayed */
View Source
const NodeProvisionStateConfigDriveBody = `` /* 224-byte string literal not displayed */
View Source
const NodeSetMaintenanceBody = `
{
  "reason": "I'm tired"
}
`
View Source
const NodeSingleBIOSSettingBody = `
{
  "Setting": {
      "name": "ProcVirtualization",
      "value": "Enabled"
   }
}
`
View Source
const NodeSupportedBootDeviceBody = `
{
  "supported_boot_devices": [
    "pxe",
    "disk"
  ]
}
`
View Source
const NodeValidationBody = `` /* 1414-byte string literal not displayed */
View Source
const NodeVendorPassthruMethodsBody = `` /* 695-byte string literal not displayed */
View Source
const SingleNodeBody = `` /* 3008-byte string literal not displayed */

SingleNodeBody is the canned body of a Get request on an existing node.

Variables

View Source
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",
	}

	NodeBar = nodes.Node{
		UUID:                 "08c84581-58f5-4ea2-a0c6-dd2e5d2b3662",
		Name:                 "bar",
		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:            createdAtBar,
		UpdatedAt:            updatedAt,
	}

	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

func HandleChangePowerStateSuccessfully(t *testing.T)

HandleChangePowerStateSuccessfully sets up the test server to respond to a change power state request for a node

func HandleChangePowerStateWithConflict

func HandleChangePowerStateWithConflict(t *testing.T)

HandleChangePowerStateWithConflict sets up the test server to respond to a change power state request for a node with a 409 error

func HandleCreateSubscriptionVendorPassthruAllParametersSuccessfully

func HandleCreateSubscriptionVendorPassthruAllParametersSuccessfully(t *testing.T)

func HandleCreateSubscriptionVendorPassthruRequiredParametersSuccessfully

func HandleCreateSubscriptionVendorPassthruRequiredParametersSuccessfully(t *testing.T)

func HandleDeleteSubscriptionVendorPassthruSuccessfully

func HandleDeleteSubscriptionVendorPassthruSuccessfully(t *testing.T)

func HandleGetAllSubscriptionsVendorPassthruSuccessfully

func HandleGetAllSubscriptionsVendorPassthruSuccessfully(t *testing.T)

func HandleGetBIOSSettingSuccessfully

func HandleGetBIOSSettingSuccessfully(t *testing.T)

func HandleGetBootDeviceSuccessfully

func HandleGetBootDeviceSuccessfully(t *testing.T)

HandleGetBootDeviceSuccessfully sets up the test server to respond to a get boot device request for a node

func HandleGetSubscriptionVendorPassthruSuccessfully

func HandleGetSubscriptionVendorPassthruSuccessfully(t *testing.T)

func HandleGetSupportedBootDeviceSuccessfully

func HandleGetSupportedBootDeviceSuccessfully(t *testing.T)

HandleGetBootDeviceSuccessfully sets up the test server to respond to a get boot device request for a node

func HandleGetVendorPassthruMethodsSuccessfully

func HandleGetVendorPassthruMethodsSuccessfully(t *testing.T)

func HandleInjectNMISuccessfully

func HandleInjectNMISuccessfully(t *testing.T)

HandleInjectNMISuccessfully sets up the test server to respond to a node InjectNMI request

func HandleListBIOSSettingsSuccessfully

func HandleListBIOSSettingsSuccessfully(t *testing.T)

func HandleListDetailBIOSSettingsSuccessfully

func HandleListDetailBIOSSettingsSuccessfully(t *testing.T)

func HandleNodeChangeProvisionStateActive

func HandleNodeChangeProvisionStateActive(t *testing.T)

func HandleNodeChangeProvisionStateActiveWithSteps

func HandleNodeChangeProvisionStateActiveWithSteps(t *testing.T)

func HandleNodeChangeProvisionStateClean

func HandleNodeChangeProvisionStateClean(t *testing.T)

func HandleNodeChangeProvisionStateCleanWithConflict

func HandleNodeChangeProvisionStateCleanWithConflict(t *testing.T)

func HandleNodeChangeProvisionStateConfigDrive

func HandleNodeChangeProvisionStateConfigDrive(t *testing.T)

func HandleNodeCreationSuccessfully

func HandleNodeCreationSuccessfully(t *testing.T, response string)

HandleServerCreationSuccessfully sets up the test server to respond to a server creation request with a given response.

func HandleNodeDeletionSuccessfully

func HandleNodeDeletionSuccessfully(t *testing.T)

HandleNodeDeletionSuccessfully sets up the test server to respond to a server deletion request.

func HandleNodeGetSuccessfully

func HandleNodeGetSuccessfully(t *testing.T)

func HandleNodeListDetailSuccessfully

func HandleNodeListDetailSuccessfully(t *testing.T)

HandleNodeListSuccessfully sets up the test server to respond to a server List request.

func HandleNodeListSuccessfully

func HandleNodeListSuccessfully(t *testing.T)

HandleNodeListSuccessfully sets up the test server to respond to a server List request.

func HandleNodeUpdateSuccessfully

func HandleNodeUpdateSuccessfully(t *testing.T, response string)

func HandleNodeValidateSuccessfully

func HandleNodeValidateSuccessfully(t *testing.T)

func HandleSetBootDeviceSuccessfully

func HandleSetBootDeviceSuccessfully(t *testing.T)

HandleSetBootDeviceSuccessfully sets up the test server to respond to a set boot device request for a node

func HandleSetNodeMaintenanceSuccessfully

func HandleSetNodeMaintenanceSuccessfully(t *testing.T)

func HandleSetRAIDConfig

func HandleSetRAIDConfig(t *testing.T)

func HandleSetRAIDConfigMaxSize

func HandleSetRAIDConfigMaxSize(t *testing.T)

func HandleUnsetNodeMaintenanceSuccessfully

func HandleUnsetNodeMaintenanceSuccessfully(t *testing.T)

Types

This section is empty.

Jump to

Keyboard shortcuts

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