Merge "Merge user_data functional tests of v2 and v2.1"

This commit is contained in:
Jenkins
2015-05-22 22:50:42 +00:00
committed by Gerrit Code Review
8 changed files with 17 additions and 88 deletions
@@ -1,17 +0,0 @@
{
"server" : {
"name" : "new-server-test",
"imageRef" : "http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b",
"flavorRef" : "http://openstack.example.com/openstack/flavors/1",
"metadata" : {
"My Server Name" : "Apache1"
},
"user_data" : "IyEvYmluL2Jhc2gKL2Jpbi9zdQplY2hvICJJIGFtIGluIHlvdSEiCg==",
"personality" : [
{
"path" : "/etc/banner.txt",
"contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
}
]
}
}
@@ -1,16 +0,0 @@
{
"server": {
"adminPass": "bwQZtcB28c29",
"id": "55116d7b-2cad-4d65-9c7c-964cde61946e",
"links": [
{
"href": "http://openstack.example.com/v2/openstack/servers/55116d7b-2cad-4d65-9c7c-964cde61946e",
"rel": "self"
},
{
"href": "http://openstack.example.com/openstack/servers/55116d7b-2cad-4d65-9c7c-964cde61946e",
"rel": "bookmark"
}
]
}
}
@@ -4,11 +4,11 @@
"id": "976a62bb-0d4a-4e17-9044-1864e888a557",
"links": [
{
"href": "http://openstack.example.com/v3/servers/976a62bb-0d4a-4e17-9044-1864e888a557",
"href": "http://openstack.example.com/v2/openstack/servers/976a62bb-0d4a-4e17-9044-1864e888a557",
"rel": "self"
},
{
"href": "http://openstack.example.com/servers/976a62bb-0d4a-4e17-9044-1864e888a557",
"href": "http://openstack.example.com/openstack/servers/976a62bb-0d4a-4e17-9044-1864e888a557",
"rel": "bookmark"
}
]
@@ -1,17 +0,0 @@
{
"server" : {
"name" : "new-server-test",
"imageRef" : "%(host)s/openstack/images/%(image_id)s",
"flavorRef" : "%(host)s/openstack/flavors/1",
"metadata" : {
"My Server Name" : "Apache1"
},
"user_data" : "%(user_data)s",
"personality" : [
{
"path" : "/etc/banner.txt",
"contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
}
]
}
}
@@ -1,16 +0,0 @@
{
"server": {
"adminPass": "%(password)s",
"id": "%(id)s",
"links": [
{
"href": "%(host)s/v2/openstack/servers/%(uuid)s",
"rel": "self"
},
{
"href": "%(host)s/openstack/servers/%(uuid)s",
"rel": "bookmark"
}
]
}
}
-18
View File
@@ -13,7 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import base64
import datetime
import inspect
import os
@@ -257,23 +256,6 @@ class ServersActionsJsonTest(ServersSampleBase):
{"password": "foo"})
class UserDataJsonTest(ApiSampleTestBaseV2):
extension_name = "nova.api.openstack.compute.contrib.user_data.User_data"
def test_user_data_post(self):
user_data_contents = '#!/bin/bash\n/bin/su\necho "I am in you!"\n'
user_data = base64.b64encode(user_data_contents)
subs = {
'image_id': fake.get_valid_image_id(),
'host': self._get_host(),
'user_data': user_data
}
response = self._do_post('servers', 'userdata-post-req', subs)
subs.update(self._get_regexes())
self._verify_response('userdata-post-resp', subs, response, 202)
class SecurityGroupsSampleJsonTest(ServersSampleBase):
extension_name = "nova.api.openstack.compute.contrib" + \
".security_groups.Security_groups"
@@ -4,11 +4,11 @@
"id": "%(id)s",
"links": [
{
"href": "%(host)s/v3/servers/%(uuid)s",
"href": "%(host)s/v2/openstack/servers/%(uuid)s",
"rel": "self"
},
{
"href": "%(host)s/servers/%(uuid)s",
"href": "%(host)s/openstack/servers/%(uuid)s",
"rel": "bookmark"
}
]
@@ -14,13 +14,26 @@
# under the License.
import base64
from oslo_config import cfg
from nova.tests.functional.v3 import api_sample_base
from nova.tests.unit.image import fake
CONF = cfg.CONF
CONF.import_opt('osapi_compute_extension',
'nova.api.openstack.compute.extensions')
class UserDataJsonTest(api_sample_base.ApiSampleTestBaseV3):
extension_name = "os-user-data"
_api_version = 'v2'
def _get_flags(self):
f = super(UserDataJsonTest, self)._get_flags()
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
f['osapi_compute_extension'].append(
'nova.api.openstack.compute.contrib.user_data.User_data')
return f
def test_user_data_post(self):
user_data_contents = '#!/bin/bash\n/bin/su\necho "I am in you!"\n'