@@ -267,6 +267,7 @@ const SingleServerBody = `
267267 "OS-EXT-STS:task_state": null,
268268 "OS-EXT-STS:vm_state": "active",
269269 "OS-EXT-SRV-ATTR:instance_name": "instance-0000001d",
270+ "OS-EXT-SRV-ATTR:hostname": "derp.local",
270271 "OS-SRV-USG:launched_at": "2014-09-25T13:04:49.000000",
271272 "OS-EXT-SRV-ATTR:hypervisor_hostname": "devstack",
272273 "flavor": {
@@ -849,6 +850,25 @@ func HandleServerCreationWithCustomFieldSuccessfully(t *testing.T, response stri
849850 })
850851}
851852
853+ func HandleServerCreationWithHostname (t * testing.T , response string ) {
854+ th .Mux .HandleFunc ("/servers" , func (w http.ResponseWriter , r * http.Request ) {
855+ th .TestMethod (t , r , "POST" )
856+ th .TestHeader (t , r , "X-Auth-Token" , client .TokenID )
857+ th .TestJSONRequest (t , r , `{
858+ "server": {
859+ "name": "derp",
860+ "hostname": "derp.local",
861+ "imageRef": "f90f6034-2570-4974-8351-6b49732ef2eb",
862+ "flavorRef": "1"
863+ }
864+ }` )
865+
866+ w .WriteHeader (http .StatusAccepted )
867+ w .Header ().Add ("Content-Type" , "application/json" )
868+ fmt .Fprintf (w , response )
869+ })
870+ }
871+
852872// HandleServerCreationWithUserdata sets up the test server to respond to a server creation request
853873// with a given response.
854874func HandleServerCreationWithUserdata (t * testing.T , response string ) {
0 commit comments