Documentation ¶
Overview ¶
servers unit tests
Index ¶
- Constants
- Variables
- func HandleAddressListSuccessfully(t *testing.T)
- func HandleAdminPasswordChangeSuccessfully(t *testing.T)
- func HandleCreateServerImageSuccessfully(t *testing.T)
- func HandleMetadataGetSuccessfully(t *testing.T)
- func HandleMetadataResetSuccessfully(t *testing.T)
- func HandleMetadataUpdateSuccessfully(t *testing.T)
- func HandleMetadatumCreateSuccessfully(t *testing.T)
- func HandleMetadatumDeleteSuccessfully(t *testing.T)
- func HandleMetadatumGetSuccessfully(t *testing.T)
- func HandleNetworkAddressListSuccessfully(t *testing.T)
- func HandlePasswordGetSuccessfully(t *testing.T)
- func HandleRebootSuccessfully(t *testing.T)
- func HandleRebuildSuccessfully(t *testing.T, response string)
- func HandleServerCreationSuccessfully(t *testing.T, response string)
- func HandleServerCreationWithCustomFieldSuccessfully(t *testing.T, response string)
- func HandleServerCreationWithMetadata(t *testing.T, response string)
- func HandleServerCreationWithUserdata(t *testing.T, response string)
- func HandleServerDeletionSuccessfully(t *testing.T)
- func HandleServerForceDeletionSuccessfully(t *testing.T)
- func HandleServerGetFaultSuccessfully(t *testing.T)
- func HandleServerGetSuccessfully(t *testing.T)
- func HandleServerListSuccessfully(t *testing.T)
- func HandleServerNoNetworkCreationSuccessfully(t *testing.T, response string)
- func HandleServerUpdateSuccessfully(t *testing.T)
- func HandleServerWithTagsCreationSuccessfully(t *testing.T)
- func HandleServersCreationSuccessfully(t *testing.T, response string)
- func HandleShowConsoleOutputSuccessfully(t *testing.T, response string)
- type CreateOptsWithCustomField
Constants ¶
const ConsoleOutputBody = `{
"output": "abc"
}`
const FaultyServerBody = `` /* 2179-byte string literal not displayed */
FaultyServerBody is the body of a Get request on an existing server which has a fault/error.
const ServerListBody = `` /* 5707-byte string literal not displayed */
ServerListBody contains the canned body of a servers.List response.
const ServerPasswordBody = `` /* 368-byte string literal not displayed */
const ServerWithTagsCreateRequest = `` /* 147-byte string literal not displayed */
const SingleServerBody = `` /* 1916-byte string literal not displayed */
SingleServerBody is the canned body of a Get request on an existing server.
const SingleServerWithTagsBody = `` /* 1942-byte string literal not displayed */
SingleServerWithTagsBody is the canned body of a Get request on an existing server with tags.
Variables ¶
var ( // ServerHerp is a Server struct that should correspond to the first result in ServerListBody. ServerHerp = servers.Server{ Status: "ACTIVE", Updated: herpTimeUpdated, HostID: "29d3c8c896a45aa4c34e52247875d7fefc3d94bbcc9f622b5d204362", Addresses: map[string]interface{}{ "private": []interface{}{ map[string]interface{}{ "OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:7c:1b:2b", "version": float64(4), "addr": "10.0.0.32", "OS-EXT-IPS:type": "fixed", }, }, }, Links: []interface{}{ map[string]interface{}{ "href": "http://104.130.131.164:8774/v2/fcad67a6189847c4aecfa3c81a05783b/servers/ef079b0c-e610-4dfb-b1aa-b49f07ac48e5", "rel": "self", }, map[string]interface{}{ "href": "http://104.130.131.164:8774/fcad67a6189847c4aecfa3c81a05783b/servers/ef079b0c-e610-4dfb-b1aa-b49f07ac48e5", "rel": "bookmark", }, }, Image: map[string]interface{}{ "id": "f90f6034-2570-4974-8351-6b49732ef2eb", "links": []interface{}{ map[string]interface{}{ "href": "http://104.130.131.164:8774/fcad67a6189847c4aecfa3c81a05783b/images/f90f6034-2570-4974-8351-6b49732ef2eb", "rel": "bookmark", }, }, }, Flavor: map[string]interface{}{ "id": "1", "links": []interface{}{ map[string]interface{}{ "href": "http://104.130.131.164:8774/fcad67a6189847c4aecfa3c81a05783b/flavors/1", "rel": "bookmark", }, }, }, ID: "ef079b0c-e610-4dfb-b1aa-b49f07ac48e5", UserID: "9349aff8be7545ac9d2f1d00999a23cd", Name: "herp", Created: herpTimeCreated, TenantID: "fcad67a6189847c4aecfa3c81a05783b", Metadata: map[string]string{}, AttachedVolumes: []servers.AttachedVolume{ { ID: "2bdbc40f-a277-45d4-94ac-d9881c777d33", }, }, SecurityGroups: []map[string]interface{}{ { "name": "default", }, }, } // ServerDerp is a Server struct that should correspond to the second server in ServerListBody. ServerDerp = servers.Server{ Status: "ACTIVE", Updated: derpTimeUpdated, HostID: "29d3c8c896a45aa4c34e52247875d7fefc3d94bbcc9f622b5d204362", Addresses: map[string]interface{}{ "private": []interface{}{ map[string]interface{}{ "OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:9e:89:be", "version": float64(4), "addr": "10.0.0.31", "OS-EXT-IPS:type": "fixed", }, }, }, Links: []interface{}{ map[string]interface{}{ "href": "http://104.130.131.164:8774/v2/fcad67a6189847c4aecfa3c81a05783b/servers/9e5476bd-a4ec-4653-93d6-72c93aa682ba", "rel": "self", }, map[string]interface{}{ "href": "http://104.130.131.164:8774/fcad67a6189847c4aecfa3c81a05783b/servers/9e5476bd-a4ec-4653-93d6-72c93aa682ba", "rel": "bookmark", }, }, Image: map[string]interface{}{ "id": "f90f6034-2570-4974-8351-6b49732ef2eb", "links": []interface{}{ map[string]interface{}{ "href": "http://104.130.131.164:8774/fcad67a6189847c4aecfa3c81a05783b/images/f90f6034-2570-4974-8351-6b49732ef2eb", "rel": "bookmark", }, }, }, Flavor: map[string]interface{}{ "id": "1", "links": []interface{}{ map[string]interface{}{ "href": "http://104.130.131.164:8774/fcad67a6189847c4aecfa3c81a05783b/flavors/1", "rel": "bookmark", }, }, }, ID: "9e5476bd-a4ec-4653-93d6-72c93aa682ba", UserID: "9349aff8be7545ac9d2f1d00999a23cd", Name: "derp", Created: derpTimeCreated, TenantID: "fcad67a6189847c4aecfa3c81a05783b", Metadata: map[string]string{}, AttachedVolumes: []servers.AttachedVolume{}, SecurityGroups: []map[string]interface{}{ { "name": "default", }, }, } ConsoleOutput = "abc" // ServerMerp is a Server struct that should correspond to the second server in ServerListBody. ServerMerp = servers.Server{ Status: "ACTIVE", Updated: merpTimeUpdated, HostID: "29d3c8c896a45aa4c34e52247875d7fefc3d94bbcc9f622b5d204362", Addresses: map[string]interface{}{ "private": []interface{}{ map[string]interface{}{ "OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:9e:89:be", "version": float64(4), "addr": "10.0.0.31", "OS-EXT-IPS:type": "fixed", }, }, }, Links: []interface{}{ map[string]interface{}{ "href": "http://104.130.131.164:8774/v2/fcad67a6189847c4aecfa3c81a05783b/servers/9e5476bd-a4ec-4653-93d6-72c93aa682ba", "rel": "self", }, map[string]interface{}{ "href": "http://104.130.131.164:8774/fcad67a6189847c4aecfa3c81a05783b/servers/9e5476bd-a4ec-4653-93d6-72c93aa682ba", "rel": "bookmark", }, }, Image: nil, Flavor: map[string]interface{}{ "id": "1", "links": []interface{}{ map[string]interface{}{ "href": "http://104.130.131.164:8774/fcad67a6189847c4aecfa3c81a05783b/flavors/1", "rel": "bookmark", }, }, }, ID: "9e5476bd-a4ec-4653-93d6-72c93aa682bb", UserID: "9349aff8be7545ac9d2f1d00999a23cd", Name: "merp", Created: merpTimeCreated, TenantID: "fcad67a6189847c4aecfa3c81a05783b", Metadata: map[string]string{}, AttachedVolumes: []servers.AttachedVolume{}, SecurityGroups: []map[string]interface{}{ { "name": "default", }, }, } DerpFault = servers.Fault{ Code: 500, Created: faultTimeCreated, Details: "Stock details for test", Message: "Conflict updating instance c2ce4dea-b73f-4d01-8633-2c6032869281. " + "Expected: {'task_state': [u'spawning']}. Actual: {'task_state': None}", } )
var ListAddressesExpected = map[string][]servers.Address{
"public": {
{
Version: 4,
Address: "50.56.176.35",
},
{
Version: 6,
Address: "2001:4800:790e:510:be76:4eff:fe04:84a8",
},
},
"private": {
{
Version: 4,
Address: "10.180.3.155",
},
},
}
ListAddressesExpected represents an expected repsonse from a ListAddresses request.
var ListNetworkAddressesExpected = []servers.Address{
{
Version: 4,
Address: "50.56.176.35",
},
{
Version: 6,
Address: "2001:4800:790e:510:be76:4eff:fe04:84a8",
},
}
ListNetworkAddressesExpected represents an expected repsonse from a ListAddressesByNetwork request.
Functions ¶
func HandleAddressListSuccessfully ¶
HandleAddressListSuccessfully sets up the test server to respond to a ListAddresses request.
func HandleAdminPasswordChangeSuccessfully ¶
HandleAdminPasswordChangeSuccessfully sets up the test server to respond to a server password change request.
func HandleCreateServerImageSuccessfully ¶
HandleCreateServerImageSuccessfully sets up the test server to respond to a TestCreateServerImage request.
func HandleMetadataGetSuccessfully ¶
HandleMetadataGetSuccessfully sets up the test server to respond to a metadata Get request.
func HandleMetadataResetSuccessfully ¶
HandleMetadataResetSuccessfully sets up the test server to respond to a metadata Create request.
func HandleMetadataUpdateSuccessfully ¶
HandleMetadataUpdateSuccessfully sets up the test server to respond to a metadata Update request.
func HandleMetadatumCreateSuccessfully ¶
HandleMetadatumCreateSuccessfully sets up the test server to respond to a metadatum Create request.
func HandleMetadatumDeleteSuccessfully ¶
HandleMetadatumDeleteSuccessfully sets up the test server to respond to a metadatum Delete request.
func HandleMetadatumGetSuccessfully ¶
HandleMetadatumGetSuccessfully sets up the test server to respond to a metadatum Get request.
func HandleNetworkAddressListSuccessfully ¶
HandleNetworkAddressListSuccessfully sets up the test server to respond to a ListAddressesByNetwork request.
func HandlePasswordGetSuccessfully ¶
HandlePasswordGetSuccessfully sets up the test server to respond to a password Get request.
func HandleRebootSuccessfully ¶
HandleRebootSuccessfully sets up the test server to respond to a reboot request with success.
func HandleRebuildSuccessfully ¶
HandleRebuildSuccessfully sets up the test server to respond to a rebuild request with success.
func HandleServerCreationSuccessfully ¶
HandleServerCreationSuccessfully sets up the test server to respond to a server creation request with a given response.
func HandleServerCreationWithCustomFieldSuccessfully ¶
HandleServerCreationWithCustomFieldSuccessfully sets up the test server to respond to a server creation request with a given response.
func HandleServerCreationWithMetadata ¶
HandleServerCreationWithMetadata sets up the test server to respond to a server creation request with a given response.
func HandleServerCreationWithUserdata ¶
HandleServerCreationWithUserdata sets up the test server to respond to a server creation request with a given response.
func HandleServerDeletionSuccessfully ¶
HandleServerDeletionSuccessfully sets up the test server to respond to a server deletion request.
func HandleServerForceDeletionSuccessfully ¶
HandleServerForceDeletionSuccessfully sets up the test server to respond to a server force deletion request.
func HandleServerGetFaultSuccessfully ¶
HandleServerGetFaultSuccessfully sets up the test server to respond to a server Get request which contains a fault.
func HandleServerGetSuccessfully ¶
HandleServerGetSuccessfully sets up the test server to respond to a server Get request.
func HandleServerListSuccessfully ¶
HandleServerListSuccessfully sets up the test server to respond to a server List request.
func HandleServerNoNetworkCreationSuccessfully ¶
HandleServerNoNetworkCreationSuccessfully sets up the test server with no network to respond to a server creation request with a given response.
func HandleServerUpdateSuccessfully ¶
HandleServerUpdateSuccessfully sets up the test server to respond to a server Update request.
func HandleServerWithTagsCreationSuccessfully ¶
HandleServerWithTagsCreationSuccessfully sets up the test server to respond to a server creation request with a given response.
func HandleServersCreationSuccessfully ¶
HandleServerCreationWithCustomFieldSuccessfully sets up the test server to respond to a server creation request with a given response.
func HandleShowConsoleOutputSuccessfully ¶
HandleShowConsoleOutputSuccessfully sets up the test server to respond to a os-getConsoleOutput request with success.
Types ¶
type CreateOptsWithCustomField ¶
type CreateOptsWithCustomField struct { servers.CreateOpts Foo string `json:"foo,omitempty"` }
func (CreateOptsWithCustomField) ToServerCreateMap ¶
func (opts CreateOptsWithCustomField) ToServerCreateMap() (map[string]interface{}, error)