summaryrefslogtreecommitdiff
path: root/service/test/perf/mails
diff options
context:
space:
mode:
authorDuda Dornelles <ddornell@thoughtworks.com>2014-11-21 14:46:10 -0200
committerDuda Dornelles <ddornell@thoughtworks.com>2014-11-21 15:18:51 -0200
commit5f39512edef09f1a6c88e73c170880761b096ba6 (patch)
tree9dd83972bdfe87d005006b1eb678c2a76663af8e /service/test/perf/mails
parenteedb963cf7df614b4f811da4a661e982d89e63bd (diff)
Adding performance benchmark for GET /mails
Diffstat (limited to 'service/test/perf/mails')
-rw-r--r--service/test/perf/mails/Mails.conf33
-rw-r--r--service/test/perf/mails/__init__.py15
-rwxr-xr-xservice/test/perf/mails/run25
-rw-r--r--service/test/perf/mails/test_Mails.py45
4 files changed, 118 insertions, 0 deletions
diff --git a/service/test/perf/mails/Mails.conf b/service/test/perf/mails/Mails.conf
new file mode 100644
index 00000000..803ac1b9
--- /dev/null
+++ b/service/test/perf/mails/Mails.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 <http://www.gnu.org/licenses/>.
+
+[main]
+title=Mails
+description=Testing fetching mails
+url=http://localhost:4567/mails?q=tag:inbox&p=1&w=100
+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/mails-bench.log
+result_path = results/mails-bench.xml
+sleep_time_min = 0
+sleep_time_max = 0.5 \ No newline at end of file
diff --git a/service/test/perf/mails/__init__.py b/service/test/perf/mails/__init__.py
new file mode 100644
index 00000000..2756a319
--- /dev/null
+++ b/service/test/perf/mails/__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 <http://www.gnu.org/licenses/>.
diff --git a/service/test/perf/mails/run b/service/test/perf/mails/run
new file mode 100755
index 00000000..99448d09
--- /dev/null
+++ b/service/test/perf/mails/run
@@ -0,0 +1,25 @@
+#!/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 <http://www.gnu.org/licenses/>.
+
+if ! which gnuplot
+then
+ echo "You must install gnuplot to run perf tests"
+ exit 1
+fi
+
+mkdir -p results
+fl-run-bench test_Mails.py Mails.test_mails
diff --git a/service/test/perf/mails/test_Mails.py b/service/test/perf/mails/test_Mails.py
new file mode 100644
index 00000000..b24ca5f4
--- /dev/null
+++ b/service/test/perf/mails/test_Mails.py
@@ -0,0 +1,45 @@
+#
+# 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 <http://www.gnu.org/licenses/>.
+import unittest
+
+from funkload.FunkLoadTestCase import FunkLoadTestCase
+
+from test.support.integration import AppTestClient
+
+
+class Mails(FunkLoadTestCase):
+
+ def setUpBench(self):
+ client = AppTestClient()
+ client.add_multiple_to_mailbox(100, 'INBOX')
+ 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 Mails')
+
+if __name__ in ('main', '__main__'):
+ unittest.main()