From 6dcb711dc40bbb36806f29c1ef081a3f0b384283 Mon Sep 17 00:00:00 2001 From: Duda Dornelles Date: Mon, 24 Nov 2014 10:19:34 -0200 Subject: adding perf tests for GET /tags --- service/test/perf/mails/run | 1 + service/test/perf/tags/Tags.conf | 33 ++++++++++++++++++++++++ service/test/perf/tags/__init__.py | 15 +++++++++++ service/test/perf/tags/run | 26 +++++++++++++++++++ service/test/perf/tags/test_Tags.py | 51 +++++++++++++++++++++++++++++++++++++ 5 files changed, 126 insertions(+) create mode 100644 service/test/perf/tags/Tags.conf create mode 100644 service/test/perf/tags/__init__.py create mode 100755 service/test/perf/tags/run create mode 100644 service/test/perf/tags/test_Tags.py (limited to 'service') diff --git a/service/test/perf/mails/run b/service/test/perf/mails/run index 99448d09..dabde4ad 100755 --- a/service/test/perf/mails/run +++ b/service/test/perf/mails/run @@ -23,3 +23,4 @@ fi mkdir -p results fl-run-bench test_Mails.py Mails.test_mails +LC_ALL=en_US.ascii fl-build-report --html results/mails-bench.xml diff --git a/service/test/perf/tags/Tags.conf b/service/test/perf/tags/Tags.conf new file mode 100644 index 00000000..e5733134 --- /dev/null +++ b/service/test/perf/tags/Tags.conf @@ -0,0 +1,33 @@ +# +# Copyright (c) 2014 ThoughtWorks, Inc. +# +# Pixelated is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Pixelated is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Pixelated. If not, see . + +[main] +title=Tags +description=Testing fetching tags +url=http://localhost:4567/tags +nb_time=20 + +[bench] +cycles = 1:3:6 +duration = 10 +startup_delay = 0.01 +sleep_time = 0.01 +cycle_time = 1 +log_to = +log_path = results/tags-bench.log +result_path = results/tags-bench.xml +sleep_time_min = 0 +sleep_time_max = 0.5 \ No newline at end of file diff --git a/service/test/perf/tags/__init__.py b/service/test/perf/tags/__init__.py new file mode 100644 index 00000000..2756a319 --- /dev/null +++ b/service/test/perf/tags/__init__.py @@ -0,0 +1,15 @@ +# +# Copyright (c) 2014 ThoughtWorks, Inc. +# +# Pixelated is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Pixelated is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Pixelated. If not, see . diff --git a/service/test/perf/tags/run b/service/test/perf/tags/run new file mode 100755 index 00000000..fe9743ef --- /dev/null +++ b/service/test/perf/tags/run @@ -0,0 +1,26 @@ +#!/bin/bash +# +# Copyright (c) 2014 ThoughtWorks, Inc. +# +# Pixelated is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Pixelated is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Pixelated. If not, see . + +if ! which gnuplot +then + echo "You must install gnuplot to run perf tests" + exit 1 +fi + +mkdir -p results +fl-run-bench test_Tags.py Tags.test_mails +LC_ALL=en_US.ascii fl-build-report --html results/tags-bench.xml diff --git a/service/test/perf/tags/test_Tags.py b/service/test/perf/tags/test_Tags.py new file mode 100644 index 00000000..7892398b --- /dev/null +++ b/service/test/perf/tags/test_Tags.py @@ -0,0 +1,51 @@ +# +# Copyright (c) 2014 ThoughtWorks, Inc. +# +# Pixelated is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Pixelated is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Pixelated. If not, see . +import unittest + +from funkload.FunkLoadTestCase import FunkLoadTestCase + +from test.support.integration import AppTestClient + + +class Tags(FunkLoadTestCase): + + def setUpBench(self): + client = AppTestClient() + + # setup data + client.add_multiple_to_mailbox(10, 'INBOX', tags=['tag1']) + client.add_multiple_to_mailbox(10, 'INBOX', tags=['tag2']) + client.add_multiple_to_mailbox(10, 'INBOX', tags=['tag3']) + client.add_multiple_to_mailbox(10, 'INBOX', tags=['tag4']) + + self.call_to_terminate = client.run_on_a_thread(logfile='results/app.log') + + def tearDownBench(self): + self.call_to_terminate() + + def setUp(self): + """Setting up test.""" + self.server_url = self.conf_get('main', 'url') + + def test_mails(self): + server_url = self.server_url + nb_time = self.conf_getInt('main', 'nb_time') + + for i in range(nb_time): + self.get(server_url, description='Get Tags') + +if __name__ in ('main', '__main__'): + unittest.main() -- cgit v1.2.3