testing

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package testing contains volume unit tests

Index

Constants

View Source
const IQN1 = "iqn.1986-03.com.nttcom:iscsihost.0"
View Source
const IQN2 = "iqn.1986-03.com.nttcom:iscsihost.1"

Variables

View Source
var CreateRequestBlock = fmt.Sprintf(`
{
	"volume": {
		"virtual_storage_id": "%s",
		"name" : "%s",
		"description": "%s",
		"size": 100,
		"iops_per_gb": "2",
		"initiator_iqns": [
			"%s"
		],
		"availability_zone": "zone1_groupa"
	}
}`, idVirtualStorage,
	nameVolume1,
	descriptionVolume1,
	IQN1,
)

CreateRequestBlock is mocked request for volumes.Create

View Source
var CreateRequestFile = fmt.Sprintf(`
{
	"volume": {
		"virtual_storage_id": "%s",
		"name" : "%s",
		"description": "%s",
		"size": 256,
		"throughput": "50",
		"availability_zone": "zone1_groupa"
	}
}`, idVirtualStorage,
	nameVolume1,
	descriptionVolume1,
)

CreateRequestFile is mocked request for volumes.Create

View Source
var CreateResponseBlock = fmt.Sprintf(`
{
	"volume": {
		"id" : "%s",
		"virtual_storage_id": "%s",
		"name" : "%s",
		"description": "%s",
		"size": 100,
		"iops_per_gb": "2",
		"initiator_iqns": [
			"%s"
		],
		"snapshot_ids": [],
		"availability_zone": "zone1_groupa",
		"created_at": "null",
		"links": [
			{
				"href": "http://storage.sdp.url:port/v1.0/0c2eba2c5af04d3f9e9d0d410b371fde/volumes/13fea5a0-a36f-43e8-92ef-1cf472725dbe",
				"rel": "self"
			}
		],
		"metadata": {"lun_id": "1"},
		"error_message": "",
		"status": "creating"
	}
}`, idVolume1,
	idVirtualStorage,
	nameVolume1,
	descriptionVolume1,
	IQN1,
)

CreateResponseBlock is mocked response of volumes.Create

View Source
var CreateResponseFile = fmt.Sprintf(`
{
	"volume": {
		"id" : "%s",
		"virtual_storage_id": "%s",
		"name" : "%s",
		"description": "%s",
		"size": 256,
		"throughput": "50",
		"snapshot_ids": [],
		"availability_zone": "zone1_groupa",
		"created_at": "null",
		"links": [
			{
				"href": "http://storage.sdp.url:port/v1.0/0c2eba2c5af04d3f9e9d0d410b371fde/volumes/13fea5a0-a36f-43e8-92ef-1cf472725dbe",
				"rel": "self"
			}
		],
		"metadata": {"lun_id": "1"},
		"error_message": "",
		"status": "creating"
	}
}`, idVolume1,
	idVirtualStorage,
	nameVolume1,
	descriptionVolume1,
)

CreateResponseFile is mocked response of volumes.Create

View Source
var GetResponse = fmt.Sprintf(`
{
    "volume": {
		"id" : "%s",
		"virtual_storage_id": "%s",
		"name" : "%s",
		"description": "%s",
		"size": 100,
		"iops_per_gb": "2",
		"initiator_iqns": [
			"%s"
		],
		"snapshot_ids": [],
		"availability_zone": "zone1_groupa",
		"created_at": "%s",
		"updated_at": "%s",
		"links": [
			{
				"href": "http://storage.sdp.url:port/v1.0/0c2eba2c5af04d3f9e9d0d410b371fde/volumes/13fea5a0-a36f-43e8-92ef-1cf472725dbe",
				"rel": "self"
			}
		],
		"metadata": {"lun_id": "1"},
		"error_message": "",
		"status": "available"
	}
}`, idVolume1,
	idVirtualStorage,
	nameVolume1,
	descriptionVolume1,
	IQN1,
	storageTime,
	storageTime,
)

GetResponse is mocked format of volumes.Get

View Source
var ListResponse = fmt.Sprintf(`
{
    "volumes": [
        {
			"id" : "%s",
			"virtual_storage_id": "%s",
			"name" : "%s",
			"description": "%s",
			"size": 100,
			"iops_per_gb": "2",
			"initiator_iqns": [
				"%s"
			],
			"snapshot_ids": [],
			"availability_zone": "zone1_groupa",
			"created_at": "%s",
			"updated_at": "%s",
			"links": [
				{
					"href": "http://storage.sdp.url:port/v1.0/0c2eba2c5af04d3f9e9d0d410b371fde/volumes/13fea5a0-a36f-43e8-92ef-1cf472725dbe",
					"rel": "self"
				}
			],
			"metadata": {"lun_id": "1"},
			"error_message": "",
			"status": "available"
		},
        {
			"id" : "%s",
			"virtual_storage_id": "%s",
			"name" : "virtual_storage_name_2",
			"description": "virtual_storage_description_2",
			"size": 100,
			"iops_per_gb": "2",
			"initiator_iqns": [
				"%s"
			],
			"snapshot_ids": [],
			"availability_zone": "zone1_groupa",
			"created_at": "%s",
			"updated_at": "%s",
			"links": [
				{
					"href": "http://storage.sdp.url:port/v1.0/0c2eba2c5af04d3f9e9d0d410b371fde/volumes/13fea5a0-a36f-43e8-92ef-1cf472725dbe",
					"rel": "self"
				}
			],
			"metadata": {"lun_id": "1"},
			"error_message": "",
			"status": "available"
		}
    ]
}`,

	idVolume1,
	idVirtualStorage,
	nameVolume1,
	descriptionVolume1,
	IQN1,
	storageTime,
	storageTime,

	idVolume2,
	idVirtualStorage,
	IQN1,
	storageTime,
	storageTime,
)

ListResponse is mocked response of volumes.List

View Source
var UpdateRequest = fmt.Sprintf(`
{
	"volume": {
		"name": "%s",
		"description": "%s",
		"initiator_iqns": [
			"%s",
			"%s"
		]
	}
}`, nameVolume1Update,
	descriptionVolume1Update,
	IQN1,
	IQN2,
)

UpdateRequest is mocked request of volumes.Update

View Source
var UpdateResponse = fmt.Sprintf(`
{
    "volume": {
		"id" : "%s",
		"virtual_storage_id": "%s",
		"name" : "%s",
		"description": "%s",
		"size": 100,
		"iops_per_gb": "2",
		"initiator_iqns": [
			"%s",
			"%s"
		],
		"snapshot_ids": [],
		"availability_zone": "zone1_groupa",
		"created_at": "%s",
		"updated_at": "%s",
		"links": [
			{
				"href": "http://storage.sdp.url:port/v1.0/0c2eba2c5af04d3f9e9d0d410b371fde/volumes/13fea5a0-a36f-43e8-92ef-1cf472725dbe",
				"rel": "self"
			}
		],
		"metadata": {"lun_id": "1"},
		"error_message": "",
		"status": "updating"
    }
}`, idVolume1,
	idVirtualStorage,
	nameVolume1Update,
	descriptionVolume1Update,
	IQN1,
	IQN2,
	storageTime,
	storageTime,
)

UpdateResponse is mocked response of volumes.Update

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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