Add boot_runcommand_delete_custom_image scenario
Add scenario that allows to run an application installed in the image created by the `image_command_customizer' context. Change-Id: Icd39788614506f9dad4626277daad19de89ef45c Implements: blueprint vm-workloads-framework
This commit is contained in:
parent
5a0cc7428f
commit
960a8bbe2c
@ -475,3 +475,30 @@
|
||||
tenants: 2
|
||||
users_per_tenant: 2
|
||||
network: {}
|
||||
|
||||
VMTasks.boot_runcommand_delete_custom_image:
|
||||
-
|
||||
args:
|
||||
command:
|
||||
remote_path: "./dd_test.sh"
|
||||
flavor:
|
||||
name: "m1.tiny"
|
||||
username: "cirros"
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 1
|
||||
concurrency: 1
|
||||
context:
|
||||
image_command_customizer:
|
||||
command:
|
||||
local_path: "/home/jenkins/.rally/extra/script_benchmark.sh"
|
||||
remote_path: "./script_benchmark.sh"
|
||||
flavor:
|
||||
name: "m1.tiny"
|
||||
image:
|
||||
name: {{image_name}}
|
||||
username: "cirros"
|
||||
users:
|
||||
tenants: 1
|
||||
users_per_tenant: 1
|
||||
network: {}
|
||||
|
@ -179,3 +179,23 @@ class VMTasks(vm_utils.VMScenario):
|
||||
force_delete=force_delete)
|
||||
|
||||
return {"data": data, "errors": err}
|
||||
|
||||
@types.set(image=types.ImageResourceType,
|
||||
flavor=types.FlavorResourceType)
|
||||
@validation.number("port", minval=1, maxval=65535, nullable=True,
|
||||
integer_only=True)
|
||||
@validation.valid_command("command")
|
||||
@validation.external_network_exists("floating_network")
|
||||
@validation.required_services(consts.Service.NOVA, consts.Service.CINDER)
|
||||
@validation.required_openstack(users=True)
|
||||
@validation.required_contexts("image_command_customizer")
|
||||
@scenario.configure(context={"cleanup": ["nova", "cinder"],
|
||||
"keypair": {}, "allow_ssh": {}})
|
||||
def boot_runcommand_delete_custom_image(self, **kwargs):
|
||||
"""Boot a server from a custom image, run a command that outputs JSON.
|
||||
|
||||
Example Script in rally-jobs/extra/script_benchmark.sh
|
||||
"""
|
||||
|
||||
return self.boot_runcommand_delete(
|
||||
image=self.context["tenant"]["custom_image"]["id"], **kwargs)
|
||||
|
@ -116,3 +116,31 @@ class VMTasksTestCase(test.TestCase):
|
||||
"foo_script", "foo_username")
|
||||
self.scenario._delete_server_with_fip.assert_called_once_with(
|
||||
"foo_server", self.ip, force_delete=False)
|
||||
|
||||
def test_boot_runcommand_delete_custom_image(self):
|
||||
context = {
|
||||
"user": {
|
||||
"tenant_id": "tenant_id",
|
||||
"endpoint": mock.Mock()
|
||||
},
|
||||
"tenant": {
|
||||
"custom_image": {"id": "image_id"}
|
||||
}
|
||||
}
|
||||
scenario = vmtasks.VMTasks(context)
|
||||
|
||||
scenario.boot_runcommand_delete = mock.Mock()
|
||||
|
||||
scenario.boot_runcommand_delete_custom_image(
|
||||
flavor="flavor_id",
|
||||
command={
|
||||
"script_file": "foo_script",
|
||||
"interpreter": "bar_interpreter"},
|
||||
username="username")
|
||||
|
||||
scenario.boot_runcommand_delete.assert_called_once_with(
|
||||
image="image_id", flavor="flavor_id", username="username",
|
||||
command={
|
||||
"script_file": "foo_script",
|
||||
"interpreter": "bar_interpreter"}
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user