Help us shape the future of Go! Take the 2026 Go Developer Survey

testing

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

nodes unit tests

Index

Constants

View Source
const NodeBootDeviceBody = `
{
  "boot_device":"pxe",
  "persistent":false
}
`
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 = `` /* 9456-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 NodeProvisionStateCleanBody = `` /* 218-byte string literal not displayed */
View Source
const NodeProvisionStateConfigDriveBody = `` /* 224-byte string literal not displayed */
View Source
const NodeSupportedBootDeviceBody = `
{
  "supported_boot_devices": [
    "pxe",
    "disk"
  ]
}
`
View Source
const NodeValidationBody = `` /* 1414-byte string literal not displayed */
View Source
const SingleNodeBody = `` /* 2935-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:       "",
		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:     "",
	}

	NodeFooValidation = nodes.NodeValidation{
		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:        "",
		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:      "",
	}

	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:        "",
		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:      "",
	}

	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,
				},
				},
			},
		},
	}
)

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 HandleGetBootDeviceSuccessfully

func HandleGetBootDeviceSuccessfully(t *testing.T)

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

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 HandleInjectNMISuccessfully

func HandleInjectNMISuccessfully(t *testing.T)

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

func HandleNodeChangeProvisionStateActive

func HandleNodeChangeProvisionStateActive(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 HandleSetRAIDConfig

func HandleSetRAIDConfig(t *testing.T)

func HandleSetRAIDConfigMaxSize

func HandleSetRAIDConfigMaxSize(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