From 2348fd1b4affcaa2caf602712a00e1767c3903a8 Mon Sep 17 00:00:00 2001 From: Anastasia Kuznetsova Date: Mon, 29 Dec 2014 19:10:31 +0400 Subject: [PATCH] Add Mistral benchmark - added Mistral client initialization - added Mistral scenarios - added unit tests Change-Id: Ie60a36504a970e6acb369adc570a556e549c20e1 --- rally-jobs/extra/mistral_wb.yaml | 13 ++++++ rally-jobs/rally-mistral.yaml | 46 +++++++++++++++++++ rally/consts.py | 5 +- .../mistral/create-delete-workbook.json | 21 +++++++++ .../mistral/create-delete-workbook.yaml | 15 ++++++ .../scenarios/mistral/create-workbook.json | 20 ++++++++ .../scenarios/mistral/create-workbook.yaml | 14 ++++++ .../scenarios/mistral/list-workbooks.json | 17 +++++++ .../scenarios/mistral/list-workbooks.yaml | 11 +++++ tests/unit/fakes.py | 27 +++++++++++ 10 files changed, 188 insertions(+), 1 deletion(-) create mode 100644 rally-jobs/extra/mistral_wb.yaml create mode 100644 rally-jobs/rally-mistral.yaml create mode 100644 samples/tasks/scenarios/mistral/create-delete-workbook.json create mode 100644 samples/tasks/scenarios/mistral/create-delete-workbook.yaml create mode 100644 samples/tasks/scenarios/mistral/create-workbook.json create mode 100644 samples/tasks/scenarios/mistral/create-workbook.yaml create mode 100644 samples/tasks/scenarios/mistral/list-workbooks.json create mode 100644 samples/tasks/scenarios/mistral/list-workbooks.yaml diff --git a/rally-jobs/extra/mistral_wb.yaml b/rally-jobs/extra/mistral_wb.yaml new file mode 100644 index 00000000..ab20f7f1 --- /dev/null +++ b/rally-jobs/extra/mistral_wb.yaml @@ -0,0 +1,13 @@ +--- +version: "2.0" + +name: wb + +workflows: + wf1: + type: direct + tasks: + hello: + action: std.echo output="Hello" + publish: + result: $ diff --git a/rally-jobs/rally-mistral.yaml b/rally-jobs/rally-mistral.yaml new file mode 100644 index 00000000..13b3bde0 --- /dev/null +++ b/rally-jobs/rally-mistral.yaml @@ -0,0 +1,46 @@ +--- + MistralWorkbooks.list_workbooks: + - + runner: + type: "constant" + times: 50 + concurrency: 10 + context: + users: + tenants: 1 + users_per_tenant: 1 + sla: + failure_rate: + max: 0 + + MistralWorkbooks.create_workbook: + - + args: + definition: "/home/jenkins/.rally/extra/mistral_wb.yaml" + runner: + type: "constant" + times: 50 + concurrency: 10 + context: + users: + tenants: 1 + users_per_tenant: 1 + sla: + failure_rate: + max: 0 + + - + args: + definition: "/home/jenkins/.rally/extra/mistral_wb.yaml" + do_delete: true + runner: + type: "constant" + times: 50 + concurrency: 10 + context: + users: + tenants: 1 + users_per_tenant: 1 + sla: + failure_rate: + max: 0 diff --git a/rally/consts.py b/rally/consts.py index 7cd5a355..c816b40c 100644 --- a/rally/consts.py +++ b/rally/consts.py @@ -108,6 +108,7 @@ class _Service(utils.ImmutableMixin, utils.EnumMixin): TROVE = "trove" SAHARA = "sahara" SWIFT = "swift" + MISTRAL = "mistral" class _ServiceType(utils.ImmutableMixin, utils.EnumMixin): @@ -130,6 +131,7 @@ class _ServiceType(utils.ImmutableMixin, utils.EnumMixin): DATABASE = "database" DATA_PROCESSING = "data_processing" OBJECT_STORE = "object-store" + WORKFLOW_EXECUTION = "workflowv2" def __init__(self): self.__names = { @@ -149,7 +151,8 @@ class _ServiceType(utils.ImmutableMixin, utils.EnumMixin): self.S3: _Service.S3, self.DATABASE: _Service.TROVE, self.DATA_PROCESSING: _Service.SAHARA, - self.OBJECT_STORE: _Service.SWIFT + self.OBJECT_STORE: _Service.SWIFT, + self.WORKFLOW_EXECUTION: _Service.MISTRAL, } def __getitem__(self, service_type): diff --git a/samples/tasks/scenarios/mistral/create-delete-workbook.json b/samples/tasks/scenarios/mistral/create-delete-workbook.json new file mode 100644 index 00000000..1d2013cc --- /dev/null +++ b/samples/tasks/scenarios/mistral/create-delete-workbook.json @@ -0,0 +1,21 @@ +{ + "MistralWorkbooks.create_workbook": [ + { + "args": { + "definition": "rally-jobs/extra/mistral_wb.yaml", + "do_delete": true + }, + "runner": { + "type": "constant", + "times": 50, + "concurrency": 10 + }, + "context": { + "users": { + "tenants": 1, + "users_per_tenant": 1 + } + } + } + ] +} diff --git a/samples/tasks/scenarios/mistral/create-delete-workbook.yaml b/samples/tasks/scenarios/mistral/create-delete-workbook.yaml new file mode 100644 index 00000000..7dc4f1fb --- /dev/null +++ b/samples/tasks/scenarios/mistral/create-delete-workbook.yaml @@ -0,0 +1,15 @@ +--- + MistralWorkbooks.create_workbook: + - + args: + definition: rally-jobs/extra/mistral_wb.yaml + do_delete: true + runner: + type: "constant" + times: 50 + concurrency: 10 + context: + users: + tenants: 1 + users_per_tenant: 1 + diff --git a/samples/tasks/scenarios/mistral/create-workbook.json b/samples/tasks/scenarios/mistral/create-workbook.json new file mode 100644 index 00000000..c9c2edad --- /dev/null +++ b/samples/tasks/scenarios/mistral/create-workbook.json @@ -0,0 +1,20 @@ +{ + "MistralWorkbooks.create_workbook": [ + { + "args": { + "definition": "rally-jobs/extra/mistral_wb.yaml" + }, + "runner": { + "type": "constant", + "times": 50, + "concurrency": 10 + }, + "context": { + "users": { + "tenants": 1, + "users_per_tenant": 1 + } + } + } + ] +} diff --git a/samples/tasks/scenarios/mistral/create-workbook.yaml b/samples/tasks/scenarios/mistral/create-workbook.yaml new file mode 100644 index 00000000..243356ee --- /dev/null +++ b/samples/tasks/scenarios/mistral/create-workbook.yaml @@ -0,0 +1,14 @@ +--- + MistralWorkbooks.create_workbook: + - + args: + definition: rally-jobs/extra/mistral_wb.yaml + runner: + type: "constant" + times: 50 + concurrency: 10 + context: + users: + tenants: 1 + users_per_tenant: 1 + diff --git a/samples/tasks/scenarios/mistral/list-workbooks.json b/samples/tasks/scenarios/mistral/list-workbooks.json new file mode 100644 index 00000000..04c68d14 --- /dev/null +++ b/samples/tasks/scenarios/mistral/list-workbooks.json @@ -0,0 +1,17 @@ +{ + "MistralWorkbooks.list_workbooks": [ + { + "runner": { + "type": "constant", + "times": 50, + "concurrency": 10 + }, + "context": { + "users": { + "tenants": 1, + "users_per_tenant": 1 + } + } + } + ] +} diff --git a/samples/tasks/scenarios/mistral/list-workbooks.yaml b/samples/tasks/scenarios/mistral/list-workbooks.yaml new file mode 100644 index 00000000..ab28301d --- /dev/null +++ b/samples/tasks/scenarios/mistral/list-workbooks.yaml @@ -0,0 +1,11 @@ +--- + MistralWorkbooks.list_workbooks: + - + runner: + type: "constant" + times: 50 + concurrency: 10 + context: + users: + tenants: 1 + users_per_tenant: 1 diff --git a/tests/unit/fakes.py b/tests/unit/fakes.py index 7a62fa4d..88c56c7a 100644 --- a/tests/unit/fakes.py +++ b/tests/unit/fakes.py @@ -279,6 +279,12 @@ class FakeAvailabilityZone(FakeResource): self.hosts = mock.MagicMock() +class FakeWorkbook(FakeResource): + def __init__(self, manager=None): + super(FakeWorkbook, self).__init__(manager) + self.workbook = mock.MagicMock() + + class FakeManager(object): def __init__(self): @@ -806,6 +812,15 @@ class FakeAvailabilityZonesManager(FakeManager): return [self.zones] +class FakeWorkbookManager(FakeManager): + def __init__(self): + super(FakeWorkbookManager, self).__init__() + self.workbook = FakeWorkbook() + + def list(self): + return [self.workbook] + + class FakeServiceCatalog(object): def get_endpoints(self): return {"image": [{"publicURL": "http://fake.to"}], @@ -1188,6 +1203,12 @@ class FakeTroveClient(object): self.instances = FakeDbInstanceManager() +class FakeMistralClient(object): + + def __init__(self): + self.workbook = FakeWorkbookManager() + + class FakeClients(object): def __init__(self, endpoint_=None): @@ -1202,6 +1223,7 @@ class FakeClients(object): self._ceilometer = None self._zaqar = None self._trove = None + self._mistral = None self._endpoint = endpoint_ or objects.Endpoint( "http://fake.example.org:5000/v2.0/", "fake_username", @@ -1266,6 +1288,11 @@ class FakeClients(object): self._trove = FakeTroveClient() return self._trove + def mistral(self): + if not self._mistral: + self._mistral = FakeMistralClient() + return self._mistral + class FakeRunner(object):