summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/__init__.py11
-rw-r--r--tests/carbon_tests/__init__.py8
-rw-r--r--tests/carbon_tests/emitter_test.py72
-rw-r--r--tests/carbon_tests/json_to_carbon_test.py116
-rw-r--r--tests/db_tests/__init__.py8
-rw-r--r--tests/db_tests/configuration_db_test.py63
-rw-r--r--tests/db_tests/graphite_db_test.py112
-rw-r--r--tests/db_tests/job_db_test.py193
-rw-r--r--tests/fio_tests/__init__.py11
-rw-r--r--tests/fio_tests/fio_invoker_test.py88
-rw-r--r--tests/storperf_master_test.py75
-rw-r--r--tests/utilities_tests/__init__.py11
-rw-r--r--tests/utilities_tests/data_handler_test.py297
-rw-r--r--tests/utilities_tests/data_treatment_test.py81
-rw-r--r--tests/utilities_tests/dictionary_test.py42
-rw-r--r--tests/utilities_tests/math_average_test.py52
-rw-r--r--tests/utilities_tests/math_range_test.py120
-rw-r--r--tests/utilities_tests/math_slope_test.py72
-rw-r--r--tests/utilities_tests/steady_state_test.py65
-rw-r--r--tests/utilities_tests/thread_gate_test.py57
-rw-r--r--tests/workload_tests/__init__.py8
-rw-r--r--tests/workload_tests/workload_subclass_test.py54
22 files changed, 0 insertions, 1616 deletions
diff --git a/tests/__init__.py b/tests/__init__.py
deleted file mode 100644
index 230494c..0000000
--- a/tests/__init__.py
+++ /dev/null
@@ -1,11 +0,0 @@
-##############################################################################
-# Copyright (c) 2015 EMC and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-import logging
-
-logging.basicConfig(level=logging.DEBUG)
diff --git a/tests/carbon_tests/__init__.py b/tests/carbon_tests/__init__.py
deleted file mode 100644
index 73334c7..0000000
--- a/tests/carbon_tests/__init__.py
+++ /dev/null
@@ -1,8 +0,0 @@
-##############################################################################
-# Copyright (c) 2015 EMC and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
diff --git a/tests/carbon_tests/emitter_test.py b/tests/carbon_tests/emitter_test.py
deleted file mode 100644
index 7f61049..0000000
--- a/tests/carbon_tests/emitter_test.py
+++ /dev/null
@@ -1,72 +0,0 @@
-##############################################################################
-# Copyright (c) 2015 EMC and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-import SocketServer
-import json
-from storperf.carbon import converter
-from storperf.carbon.emitter import CarbonMetricTransmitter
-import threading
-from time import sleep, strptime
-import unittest
-
-import mock
-
-
-class MetricsHandler(SocketServer.BaseRequestHandler):
-
- def handle(self):
- # Echo the back to the client
- CarbonMetricTransmitterTest.response = self.request.recv(1024)
- return
-
-
-class MetricsServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer):
- pass
-
-
-class CarbonMetricTransmitterTest(unittest.TestCase):
- listen_port = 0
- response = None
-
- def setUp(self):
-
- address = ('localhost', 0)
- server = MetricsServer(address, MetricsHandler)
- ip, self.listen_port = server.server_address
-
- t = threading.Thread(target=server.serve_forever)
- t.setDaemon(True)
- t.start()
-
- @mock.patch("time.gmtime")
- def test_transmit_metrics(self, mock_time):
-
- mock_time.return_value = strptime("30 Nov 00", "%d %b %y")
-
- testconv = converter.Converter()
- json_object = json.loads(
- """{"timestamp" : "975542400", "key":"value" }""")
- result = testconv.convert_json_to_flat(json_object, "host.run-name")
-
- emitter = CarbonMetricTransmitter()
- emitter.carbon_port = self.listen_port
- emitter.transmit_metrics(result)
-
- count = 0
-
- while (CarbonMetricTransmitterTest.response is None and count < 10):
- count += 1
- sleep(0.1)
-
- self.assertEqual("host.run-name.key value 975542400\n",
- CarbonMetricTransmitterTest.response,
- CarbonMetricTransmitterTest.response)
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/tests/carbon_tests/json_to_carbon_test.py b/tests/carbon_tests/json_to_carbon_test.py
deleted file mode 100644
index 523ff77..0000000
--- a/tests/carbon_tests/json_to_carbon_test.py
+++ /dev/null
@@ -1,116 +0,0 @@
-##############################################################################
-# Copyright (c) 2015 EMC and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-from storperf.carbon.converter import Converter
-import json
-import unittest
-
-
-class JSONToCarbonTest(unittest.TestCase):
-
- single_json_text_element = """{ "key" : "value" }"""
- single_json_numeric_element = """{ "key" : 123 }"""
- single_json_key_with_spaces = """{ "key with spaces" : "value" }"""
- single_json_value_with_spaces = """{ "key" : "value with spaces" }"""
- json_map_name_with_spaces = \
- """{ "map with spaces" : { "key" : "value" } }"""
- json_list_name_with_spaces = \
- """{ "list with spaces" : [{ "key" : "value" }] }"""
-
- simple_fio_json = """
-{
- "fio version" : "fio-2.2.10",
- "timestamp" : 1444144664,
- "time" : "Tue Oct 6 11:17:44 2015",
- "jobs" : [
- {
- "jobname" : "random-read",
- "groupid" : 0,
- "error" : 0,
- "eta" : 0,
- "elapsed" : 26,
- "read" : {
- "io_bytes" : 7116,
- "bw" : 275,
- "iops" : 68.99,
- "runtime" : 25788,
- "total_ios" : 1779,
- "short_ios" : 0,
- "drop_ios" : 0,
- "slat" : {
- "min" : 0,
- "max" : 0,
- "mean" : 0.00,
- "stddev" : 0.00
- }
- }
- }]
-}
-"""
-
- def setUp(self):
- pass
-
- def test_to_string(self):
- testconv = Converter()
- json_object = json.loads(self.simple_fio_json)
- result = testconv.convert_json_to_flat(json_object, "host.run-name")
- self.assertEqual("7116", result[
- "host.run-name.jobs.1.read.io_bytes"],
- result["host.run-name.jobs.1.read.io_bytes"])
-
- def test_single_text_element_no_prefix(self):
- testconv = Converter()
- result = testconv.convert_json_to_flat(
- json.loads(self.single_json_text_element))
-
- self.assertEqual("value", result["key"], result["key"])
-
- def test_single_numeric_element_no_prefix(self):
- testconv = Converter()
- result = testconv.convert_json_to_flat(
- json.loads(self.single_json_numeric_element))
-
- self.assertEqual("123", result["key"], result["key"])
-
- def test_single_text_key_space_element_no_prefix(self):
- testconv = Converter()
- result = testconv.convert_json_to_flat(
- json.loads(self.single_json_key_with_spaces))
-
- self.assertEqual(
- "value", result["key_with_spaces"], result["key_with_spaces"])
-
- def test_single_text_value_space_element_no_prefix(self):
- testconv = Converter()
- result = testconv.convert_json_to_flat(
- json.loads(self.single_json_value_with_spaces))
-
- self.assertEqual("value_with_spaces", result["key"], result["key"])
-
- def test_map_name_with_space_no_prefix(self):
- testconv = Converter()
- result = testconv.convert_json_to_flat(
- json.loads(self.json_map_name_with_spaces))
-
- self.assertEqual(
- "value", result["map_with_spaces.key"],
- result["map_with_spaces.key"])
-
- def test_list_name_with_space_no_prefix(self):
- testconv = Converter()
- result = testconv.convert_json_to_flat(
- json.loads(self.json_list_name_with_spaces))
-
- self.assertEqual(
- "value", result["list_with_spaces.1.key"],
- result["list_with_spaces.1.key"])
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/tests/db_tests/__init__.py b/tests/db_tests/__init__.py
deleted file mode 100644
index 73334c7..0000000
--- a/tests/db_tests/__init__.py
+++ /dev/null
@@ -1,8 +0,0 @@
-##############################################################################
-# Copyright (c) 2015 EMC and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
diff --git a/tests/db_tests/configuration_db_test.py b/tests/db_tests/configuration_db_test.py
deleted file mode 100644
index dda616b..0000000
--- a/tests/db_tests/configuration_db_test.py
+++ /dev/null
@@ -1,63 +0,0 @@
-##############################################################################
-# Copyright (c) 2015 EMC and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-from storperf.db.configuration_db import ConfigurationDB
-import os
-import unittest
-import sqlite3
-
-
-class ConfigurationDBTest(unittest.TestCase):
-
- def setUp(self):
- ConfigurationDB.db_name = "file::memory:?cache=shared"
- db = sqlite3.connect(ConfigurationDB.db_name)
- self.config_db = ConfigurationDB()
-
- def test_create_key(self):
- expected = "ABCDE-12345"
-
- self.config_db.set_configuration_value(
- "test", "key", expected)
-
- actual = self.config_db.get_configuration_value(
- "test", "key")
-
- self.assertEqual(
- expected, actual, "Did not expect: " + str(actual))
-
- def test_update_key(self):
- expected = "ABCDE-12345"
-
- self.config_db.set_configuration_value(
- "test", "key", "initial_value")
-
- self.config_db.set_configuration_value(
- "test", "key", expected)
-
- actual = self.config_db.get_configuration_value(
- "test", "key")
-
- self.assertEqual(
- expected, actual, "Did not expect: " + str(actual))
-
- def test_deleted_key(self):
- expected = None
-
- self.config_db.set_configuration_value(
- "test", "key", "initial_value")
-
- self.config_db.delete_configuration_value(
- "test", "key")
-
- actual = self.config_db.get_configuration_value(
- "test", "key")
-
- self.assertEqual(
- expected, actual, "Did not expect: " + str(actual))
diff --git a/tests/db_tests/graphite_db_test.py b/tests/db_tests/graphite_db_test.py
deleted file mode 100644
index d4c6fb6..0000000
--- a/tests/db_tests/graphite_db_test.py
+++ /dev/null
@@ -1,112 +0,0 @@
-##############################################################################
-# Copyright (c) 2016 EMC and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-import unittest
-
-import mock
-
-from storperf.db.graphite_db import GraphiteDB
-
-
-class MockResponse():
-
- def __init__(self):
- self.content = ""
- self.status_code = 200
-
-
-class GraphiteDBTest(unittest.TestCase):
-
- def setUp(self):
- self.graphdb = GraphiteDB()
- self.graphdb._job_db = self
-
- def test_wildcard_pattern(self):
- workload = "job_id"
- expected = "job_id.*.*.*.*.*.*"
- actual = self.graphdb.make_fullname_pattern(workload)
- self.assertEqual(expected, actual, actual)
-
- def test_no_wildcard_pattern(self):
- workload = "job_id.workload.host.queue-depth.1.block-size.16"
- actual = self.graphdb.make_fullname_pattern(workload)
- self.assertEqual(workload, actual, actual)
-
- def test_fetch_averages(self):
- # self.graphdb.fetch_averages(u'32d31724-fac1-44f3-9033-ca8e00066a36')
- pass
-
- @mock.patch("requests.get")
- def test_fetch_series(self, mock_requests):
-
- response = MockResponse()
- response.content = """
-[
- {
- "datapoints": [
- [null,1480455880],
- [null,1480455890],
- [null,1480455900],
- [205.345,1480455910],
- [201.59,1480455920],
- [205.76,1480455930],
- [null,1480455940],
- [null,1480455950],
- [null,1480455960],
- [215.655,1480455970],
- [214.16,1480455980],
- [213.57,1480455990],
- [null,1480456000],
- [null,1480456010],
- [null,1480456020],
- [219.37,1480456030],
- [219.28,1480456040],
- [217.75,1480456050],
- [null,1480456060]
- ],
- "target":"averageSeries(.8192.*.jobs.1.write.iops)"
- }
-]"""
- expected = [[1480455910, 205.345],
- [1480455920, 201.59],
- [1480455930, 205.76],
- [1480455970, 215.655],
- [1480455980, 214.16],
- [1480455990, 213.57],
- [1480456030, 219.37],
- [1480456040, 219.28],
- [1480456050, 217.75]]
-
- mock_requests.side_effect = (response, )
-
- actual = self.graphdb.fetch_series("workload", "iops",
- "write", 0, 600)
- self.assertEqual(expected, actual)
-
- def fetch_workloads(self, workload):
- workloads = [[u'32d31724-fac1-44f3-9033-ca8e00066a36.'
- u'_warm_up.queue-depth.32.block-size.8192.10-9-15-151',
- u'1462379653', u'1462379893'],
- [u'32d31724-fac1-44f3-9033-ca8e00066a36.'
- u'_warm_up.queue-depth.32.block-size.8192.10-9-15-150',
- u'1462379653', u'1462379898'],
- [u'32d31724-fac1-44f3-9033-ca8e00066a36'
- u'.rw.queue-depth.128.block-size.8192.10-9-15-151',
- u'1462379898', u'1462380028'],
- [u'32d31724-fac1-44f3-9033-ca8e00066a36'
- u'.rw.queue-depth.128.block-size.8192.10-9-15-150',
- u'1462379898', u'1462380032'],
- [u'32d31724-fac1-44f3-9033-ca8e00066a36'
- u'.rw.queue-depth.16.block-size.8192.10-9-15-151',
- u'1462380032', u'1462380312'],
- [u'32d31724-fac1-44f3-9033-ca8e00066a36'
- u'.rw.queue-depth.16.block-size.8192.10-9-15-150',
- u'1462380032', u'1462380329'],
- ]
- return workloads
diff --git a/tests/db_tests/job_db_test.py b/tests/db_tests/job_db_test.py
deleted file mode 100644
index 9b09a80..0000000
--- a/tests/db_tests/job_db_test.py
+++ /dev/null
@@ -1,193 +0,0 @@
-##############################################################################
-# Copyright (c) 2016 EMC and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-import os
-import sqlite3
-import unittest
-
-import mock
-
-from storperf.db.job_db import JobDB
-from storperf.workloads.rr import rr
-
-
-class JobDBTest(unittest.TestCase):
-
- def setUp(self):
-
- JobDB.db_name = __name__ + '.db'
- try:
- os.remove(JobDB.db_name)
- except OSError:
- pass
- self.job = JobDB()
-
- @mock.patch("uuid.uuid4")
- def test_create_job(self, mock_uuid):
- expected = "ABCDE-12345"
- mock_uuid.side_effect = (expected,)
-
- self.job.create_job_id()
-
- actual = self.job.job_id
-
- self.assertEqual(
- expected, actual, "Did not expect: " + str(actual))
-
- @mock.patch("uuid.uuid4")
- def test_duplicate_job_generated(self, mock_uuid):
- duplicate = "EDCBA-12345"
- expected = "EDCBA-54321"
-
- mock_uuid.side_effect = (duplicate, duplicate, expected,)
-
- self.job.create_job_id()
- self.job.create_job_id()
-
- actual = self.job.job_id
-
- self.assertEqual(
- expected, actual, "Did not expect: " + str(actual))
-
- @mock.patch("uuid.uuid4")
- @mock.patch("calendar.timegm")
- def test_start_job(self, mock_calendar, mock_uuid):
- job_id = "ABCDE-12345"
- start_time = "12345"
- mock_calendar.side_effect = (start_time,)
- mock_uuid.side_effect = (job_id,)
- workload = rr()
-
- db = sqlite3.connect(JobDB.db_name)
- cursor = db.cursor()
-
- row = cursor.execute(
- """select * from jobs
- where job_id = ?
- and workload = ?""",
- (job_id, workload.fullname,))
-
- self.assertEqual(None,
- row.fetchone(),
- "Should not have been a row in the db")
-
- self.job.start_workload(workload)
-
- cursor.execute(
- """select job_id, workload, start from jobs
- where job_id = ?
- and workload = ?""",
- (job_id, workload.fullname,))
-
- row = cursor.fetchone()
-
- self.assertNotEqual(None, row, "Should be a row in the db")
- self.assertEqual(job_id, row[0], "Did not expect " + str(row[0]))
- self.assertEqual(
- workload.fullname, row[1], "Did not expect " + str(row[1]))
- self.assertEqual(start_time, row[2], "Did not expect " + str(row[2]))
-
- @mock.patch("uuid.uuid4")
- @mock.patch("calendar.timegm")
- def test_end_job(self, mock_calendar, mock_uuid):
- job_id = "ABCDE-12345"
- start_time = "12345"
- end_time = "54321"
- mock_calendar.side_effect = (start_time, end_time,)
- mock_uuid.side_effect = (job_id,)
- workload = rr()
-
- self.job.start_workload(workload)
- self.job.end_workload(workload)
-
- db = sqlite3.connect(JobDB.db_name)
- cursor = db.cursor()
- cursor.execute(
- """select job_id, workload, start, end from jobs
- where job_id = ?
- and workload = ?""",
- (job_id, workload.fullname,))
-
- row = cursor.fetchone()
-
- self.assertNotEqual(None, row, "Should be a row in the db")
- self.assertEqual(job_id, row[0], "Did not expect " + str(row[0]))
- self.assertEqual(
- workload.fullname, row[1], "Did not expect " + str(row[1]))
- self.assertEqual(start_time, row[2], "Did not expect " + str(row[2]))
- self.assertEqual(end_time, row[3], "Did not expect " + str(row[3]))
-
- @mock.patch("uuid.uuid4")
- @mock.patch("calendar.timegm")
- def test_duplicate_start_job(self, mock_calendar, mock_uuid):
- job_id = "ABCDE-12345"
- start_time_1 = "12345"
- start_time_2 = "12346"
-
- mock_calendar.side_effect = (start_time_1, start_time_2)
- mock_uuid.side_effect = (job_id,)
- workload = rr()
-
- db = sqlite3.connect(JobDB.db_name)
- cursor = db.cursor()
-
- self.job.start_workload(workload)
- self.job.start_workload(workload)
-
- cursor.execute(
- """select job_id, workload, start from jobs
- where job_id = ?
- and workload = ?""",
- (job_id, workload.fullname,))
-
- row = cursor.fetchone()
-
- self.assertNotEqual(None, row, "Should be a row in the db")
- self.assertEqual(job_id, row[0], "Did not expect " + str(row[0]))
- self.assertEqual(
- workload.fullname, row[1], "Did not expect " + str(row[1]))
- self.assertEqual(start_time_2, row[2], "Did not expect " + str(row[2]))
-
- @mock.patch("uuid.uuid4")
- @mock.patch("calendar.timegm")
- def test_end_job_without_start(self, mock_calendar, mock_uuid):
- job_id = "ABCDE-12345"
- start_time = "12345"
- end_time = "54321"
- mock_calendar.side_effect = (start_time, end_time,)
- mock_uuid.side_effect = (job_id,)
- workload = rr()
-
- self.job.end_workload(workload)
-
- db = sqlite3.connect(JobDB.db_name)
- cursor = db.cursor()
- cursor.execute(
- """select job_id, workload, start, end from jobs
- where job_id = ?
- and workload = ?""",
- (job_id, workload.fullname,))
-
- row = cursor.fetchone()
-
- self.assertNotEqual(None, row, "Should be a row in the db")
- self.assertEqual(job_id, row[0], "Did not expect " + str(row[0]))
- self.assertEqual(
- workload.fullname, row[1], "Did not expect " + str(row[1]))
- # The start time is set to the same time as end if it was never set
- # before
- self.assertEqual(start_time, row[2], "Did not expect " + str(row[2]))
- self.assertEqual(start_time, row[3], "Did not expect " + str(row[3]))
-
- def test_job_params(self):
- expected = {u"a": 1, u"b": 2}
- self.job.job_id = "ABCD"
- self.job.record_workload_params(expected)
- actual = self.job.fetch_workload_params(self.job.job_id)
- self.assertEqual(expected, actual)
diff --git a/tests/fio_tests/__init__.py b/tests/fio_tests/__init__.py
deleted file mode 100644
index df29e18..0000000
--- a/tests/fio_tests/__init__.py
+++ /dev/null
@@ -1,11 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 Dell EMC and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-import logging
-
-logging.basicConfig(level=logging.DEBUG)
diff --git a/tests/fio_tests/fio_invoker_test.py b/tests/fio_tests/fio_invoker_test.py
deleted file mode 100644
index 4672651..0000000
--- a/tests/fio_tests/fio_invoker_test.py
+++ /dev/null
@@ -1,88 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 Dell EMC and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-from StringIO import StringIO
-import json
-import unittest
-
-from storperf.fio.fio_invoker import FIOInvoker
-
-
-class Test(unittest.TestCase):
-
- simple_dictionary = {'Key': 'Value'}
-
- def exceptional_event(self, callback_id, metric):
- self.exception_called = True
- raise Exception
-
- def event(self, callback_id, metric):
- self.metric = metric
-
- def setUp(self):
- self.exception_called = False
- self.metric = None
- self.fio_invoker = FIOInvoker()
-
- def testStdoutValidJSON(self):
- self.fio_invoker.register(self.event)
- string = json.dumps(self.simple_dictionary, indent=4, sort_keys=True)
-
- output = StringIO(string + "\n")
- self.fio_invoker.stdout_handler(output)
-
- self.assertEqual(self.simple_dictionary, self.metric)
-
- def testStdoutValidJSONWithFIOOutput(self):
- self.fio_invoker.register(self.event)
- string = json.dumps(self.simple_dictionary, indent=4, sort_keys=True)
- terminating = "fio: terminating on signal 2\n"
- output = StringIO(terminating + string + "\n")
- self.fio_invoker.stdout_handler(output)
-
- self.assertEqual(self.simple_dictionary, self.metric)
-
- def testStdoutNoJSON(self):
- self.fio_invoker.register(self.event)
- string = "{'key': 'value'}"
-
- output = StringIO(string + "\n")
- self.fio_invoker.stdout_handler(output)
-
- self.assertEqual(None, self.metric)
-
- def testStdoutInvalidJSON(self):
- self.fio_invoker.register(self.event)
- string = "{'key':\n}"
-
- output = StringIO(string + "\n")
- self.fio_invoker.stdout_handler(output)
-
- self.assertEqual(None, self.metric)
-
- def testStdoutAfterTerminated(self):
- self.fio_invoker.register(self.event)
- string = json.dumps(self.simple_dictionary, indent=4, sort_keys=True)
-
- self.fio_invoker.terminated = True
- output = StringIO(string + "\n")
- self.fio_invoker.stdout_handler(output)
-
- self.assertEqual(None, self.metric)
-
- def testStdoutCallbackException(self):
- self.fio_invoker.register(self.exceptional_event)
- self.fio_invoker.register(self.event)
- string = json.dumps(self.simple_dictionary, indent=4, sort_keys=True)
-
- output = StringIO(string + "\n")
- self.fio_invoker.stdout_handler(output)
-
- self.assertEqual(self.simple_dictionary, self.metric)
- self.assertEqual(self.exception_called, True)
diff --git a/tests/storperf_master_test.py b/tests/storperf_master_test.py
deleted file mode 100644
index c67e3c4..0000000
--- a/tests/storperf_master_test.py
+++ /dev/null
@@ -1,75 +0,0 @@
-##############################################################################
-# Copyright (c) 2015 EMC and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-from storperf.db.configuration_db import ConfigurationDB
-from storperf.storperf_master import StorPerfMaster
-import unittest
-import sqlite3
-
-
-class StorPerfMasterTest(unittest.TestCase):
-
- def setUp(self):
- ConfigurationDB.db_name = "file::memory:?cache=shared"
- db = sqlite3.connect(ConfigurationDB.db_name)
- self.storperf = StorPerfMaster()
-
- def test_agent_count(self):
- expected = 10
-
- self.storperf.agent_count = expected
- actual = self.storperf.agent_count
-
- self.assertEqual(
- expected, actual, "Did not expect: " + str(actual))
-
- def test_queue_depths(self):
- expected = "1,2,3"
-
- self.storperf.queue_depths = expected
- actual = self.storperf.queue_depths
-
- self.assertEqual(
- expected, actual, "Did not expect: " + str(actual))
-
- def test_block_sizes(self):
- expected = "8,2,1,0"
-
- self.storperf.block_sizes = expected
- actual = self.storperf.block_sizes
-
- self.assertEqual(
- expected, actual, "Did not expect: " + str(actual))
-
- def test_volume_size(self):
- expected = 20
-
- self.storperf.volume_size = expected
- actual = self.storperf.volume_size
-
- self.assertEqual(
- expected, actual, "Did not expect: " + str(actual))
-
- def test_agent_network(self):
- expected = "ABCDEF"
-
- self.storperf.public_network = expected
- actual = self.storperf.public_network
-
- self.assertEqual(
- expected, actual, "Did not expect: " + str(actual))
-
- def test_agent_flavor(self):
- expected = "m1.small"
-
- self.storperf.agent_flavor = expected
- actual = self.storperf.agent_flavor
-
- self.assertEqual(
- expected, actual, "Did not expect: " + str(actual))
diff --git a/tests/utilities_tests/__init__.py b/tests/utilities_tests/__init__.py
deleted file mode 100644
index 6218fe3..0000000
--- a/tests/utilities_tests/__init__.py
+++ /dev/null
@@ -1,11 +0,0 @@
-##############################################################################
-# Copyright (c) 2016 EMC and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-import logging
-
-logging.basicConfig(level=logging.DEBUG)
diff --git a/tests/utilities_tests/data_handler_test.py b/tests/utilities_tests/data_handler_test.py
deleted file mode 100644
index 6d57b0d..0000000
--- a/tests/utilities_tests/data_handler_test.py
+++ /dev/null
@@ -1,297 +0,0 @@
-##############################################################################
-# Copyright (c) 2016 EMC and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-import os
-from storperf.utilities.data_handler import DataHandler
-import unittest
-
-import mock
-
-
-class MockGraphiteDB(object):
-
- def __init__(self):
- self.series = []
-
- def fetch_series(self, job_id, timeframe):
- return self.series
-
-
-class DataHandlerTest(unittest.TestCase):
-
- def setUp(self):
- self.event_listeners = set()
- self.data_handler = DataHandler()
- self._terminated = False
- self.args = None
- self.start_time = 0
- self.steady_state_samples = 10
- self.end_time = 1
- self.metadata = {}
- self.block_sizes = "1"
- self.queue_depths = "1"
- mock.job_id = "1"
- self.job_db = mock
- self.pushed = False
- self.current_workload = None
- self.db_results = None
- pass
-
- @property
- def terminated(self):
- return self._terminated
-
- def push_results_to_db(self, *args):
- self.pushed = True
- self.db_results = args
- results = {"href": "http://localhost/api/result/uuid-that-is-long"}
- return results
-
- def terminate(self):
- self._terminated = True
-
- def terminate_current_run(self):
- self._terminated = True
-
- @mock.patch("time.time")
- @mock.patch.dict(os.environ, {'TEST_DB_URL': 'mock'})
- @mock.patch("storperf.db.graphite_db.GraphiteDB.fetch_series")
- def test_lookup_prior_data(self, mock_graphite_db, mock_time):
- self._terminated = False
- expected = [[1480455910, 205.345],
- [1480455920, 201.59],
- [1480455930, 205.76],
- [1480455970, 215.655],
- [1480455980, 214.16],
- [1480455990, 213.57],
- [1480456030, 219.37],
- [1480456040, 219.28],
- [1480456050, 217.75]]
- mock_graphite_db.return_value = expected
- mock_time.return_value = expected[-1][0] + 10
-
- self.current_workload = ("%s.%s.queue-depth.%s.block-size.%s" %
- ("job_id",
- "rw",
- 8,
- 8192))
-
- actual = self.data_handler._lookup_prior_data(self, 'read', 'iops')
- self.assertEqual(expected, actual)
-
- def test_short_sample(self):
- series = [[1480455910, 205.345],
- [1480455920, 201.59],
- [1480455930, 205.76],
- [1480455970, 215.655],
- [1480455980, 214.16],
- [1480455990, 213.57],
- [1480456030, 219.37],
- [1480456040, 219.28],
- [1480456050, 217.75]]
-
- actual = self.data_handler._evaluate_prior_data(
- series, self.steady_state_samples)
- self.assertEqual(False, actual)
-
- def test_long_not_steady_sample(self):
- series = [[4804559100, 205345],
- [4804559200, 20159],
- [4804559300, 20576],
- [4804560300, 21937],
- [4804560400, 21928],
- [4804560500, 21775]]
- actual = self.data_handler._evaluate_prior_data(
- series, self.steady_state_samples)
- self.assertEqual(False, actual)
-
- def test_long_steady_sample(self):
- series = [[4804559100, 205.345],
- [4804559200, 201.59],
- [4804559300, 205.76],
- [4804559400, 205.76],
- [4804559500, 205.76],
- [4804559600, 205.76],
- [4804559700, 205.76],
- [4804560300, 219.37],
- [4804560400, 219.28],
- [4804560500, 217.75]]
- actual = self.data_handler._evaluate_prior_data(
- series, self.steady_state_samples)
- self.assertEqual(True, actual)
-
- @mock.patch.dict(os.environ, {'TEST_DB_URL': 'mock'})
- @mock.patch("storperf.db.test_results_db.push_results_to_db")
- @mock.patch("storperf.utilities.data_handler.GraphiteDB")
- def test_terminated_report(self, mock_graphite_db, mock_results_db):
- self._terminated = True
- mock_results_db.side_effect = self.push_results_to_db
- mock_graphite_db.side_effect = MockGraphiteDB
- self.metadata = {
- "steady_state": {
- "rr.queue-depth.8.block-size.16384": True,
- "rr.queue-depth.8.block-size.2048": False,
- "rr.queue-depth.8.block-size.8192": True,
- },
- }
-
- self.data_handler.data_event(self)
- self.assertEqual(True, self.pushed)
-
- @mock.patch.dict(os.environ, {'TEST_DB_URL': 'mock'})
- @mock.patch("time.time")
- @mock.patch("storperf.db.test_results_db.push_results_to_db")
- @mock.patch("storperf.db.graphite_db.GraphiteDB.fetch_series")
- @mock.patch("storperf.db.graphite_db.JobDB.fetch_workloads")
- def test_non_terminated_report(self, mock_job_db, mock_graphite_db,
- mock_results_db, mock_time):
- self._terminated = False
- mock_results_db.side_effect = self.push_results_to_db
- series = \
- [[1480455910, 205.345],
- [1480455920, 201.59],
- [1480455930, 205.76],
- [1480455970, 215.655],
- [1480455980, 214.16],
- [1480455990, 213.57],
- [1480456030, 219.37],
- [1480456040, 219.28],
- [1480456050, 217.75]]
- mock_graphite_db.return_value = series
- mock_time.return_value = series[-1][0] + 10
- expected_slope = 12.292030334472656
- expected_range = 17.78
- expected_average = 212.49777777777774
-
- self.current_workload = ("%s.%s.queue-depth.%s.block-size.%s" %
- ("job_id",
- "rw",
- 8,
- 8192))
-
- mock_job_db.return_value = [[self.current_workload, 4804559000, None]]
-
- self.data_handler.data_event(self)
- self.assertEqual(False, self.pushed)
- self.assertEqual(False, self._terminated)
-
- self.assertEqual(expected_slope, self.metadata['report_data']
- ['rw.queue-depth.8.block-size.8192']
- ['lat.mean']
- ['read']
- ['slope'])
- self.assertEqual(expected_range, self.metadata['report_data']
- ['rw.queue-depth.8.block-size.8192']
- ['lat.mean']
- ['read']
- ['range'])
- self.assertEqual(expected_average, self.metadata['report_data']
- ['rw.queue-depth.8.block-size.8192']
- ['lat.mean']
- ['read']
- ['average'])
-
- @mock.patch.dict(os.environ, {'TEST_DB_URL': 'mock'})
- @mock.patch("time.time")
- @mock.patch("storperf.db.test_results_db.push_results_to_db")
- @mock.patch("storperf.db.graphite_db.GraphiteDB.fetch_series")
- @mock.patch("storperf.db.graphite_db.JobDB.fetch_workloads")
- def test_report_that_causes_termination(self,
- mock_job_db,
- mock_graphite_db,
- mock_results_db,
- mock_time):
- self._terminated = False
- mock_results_db.side_effect = self.push_results_to_db
- series = [[4804559100, 205.345],
- [4804559200, 201.59],
- [4804559300, 205.76],
- [4804559400, 205.76],
- [4804559500, 205.76],
- [4804559600, 205.76],
- [4804559700, 205.76],
- [4804560300, 219.37],
- [4804560400, 219.28],
- [4804560500, 217.75]]
- report_data = [[2, 205.345],
- [3, 201.59],
- [5, 205.76],
- [7, 205.76],
- [8, 205.76],
- [10, 205.76],
- [12, 205.76],
- [22, 219.37],
- [23, 219.28],
- [25, 217.75]]
- mock_graphite_db.return_value = series
- mock_time.return_value = 4804560500 + 10
-
- expected_slope = 0.7419522662249607
- expected_range = 17.78
- expected_average = 209.2135
-
- self.current_workload = ("%s.%s.queue-depth.%s.block-size.%s" %
- ("job_id",
- "rw",
- 8,
- 8192))
-
- mock_job_db.return_value = [[self.current_workload, 4804559000, None]]
-
- self.data_handler.data_event(self)
-
- self.assertEqual(expected_slope, self.metadata['report_data']
- ['rw.queue-depth.8.block-size.8192']
- ['lat.mean']
- ['read']
- ['slope'])
- self.assertEqual(expected_range, self.metadata['report_data']
- ['rw.queue-depth.8.block-size.8192']
- ['lat.mean']
- ['read']
- ['range'])
- self.assertEqual(expected_average, self.metadata['report_data']
- ['rw.queue-depth.8.block-size.8192']
- ['lat.mean']
- ['read']
- ['average'])
- self.assertEqual(report_data, self.metadata['report_data']
- ['rw.queue-depth.8.block-size.8192']
- ['lat.mean']
- ['read']
- ['series'])
- self.assertEqual(True, self._terminated)
-
- self.assertEqual(False, self.pushed)
-
- @mock.patch.dict(os.environ, {'TEST_DB_URL': 'mock'})
- @mock.patch("storperf.db.test_results_db.push_results_to_db")
- def test_playload_report(self,
- mock_results_db):
- mock_results_db.side_effect = self.push_results_to_db
- self.start_time = 1504559100
- self.end_time = 1504560000
- self.metadata = {
- "scenario_name": "ceph_ws,wr,rs,rr,rw",
- "status": "OK",
- "steady_state": {
- "rr.queue-depth.8.block-size.16384": True,
- "rr.queue-depth.8.block-size.2048": False,
- "rr.queue-depth.8.block-size.8192": True,
- },
- "storage_node_count": 5,
- "volume_size": 10
- }
- self.data_handler._push_to_db(self)
- self.assertEqual('FAIL', self.db_results[9],
- 'Expected FAIL in criteria')
- self.assertEqual('2017-09-04 21:05:00', self.db_results[3],
- 'Start time')
- self.assertEqual('2017-09-04 21:20:00', self.db_results[4],
- 'End time')
diff --git a/tests/utilities_tests/data_treatment_test.py b/tests/utilities_tests/data_treatment_test.py
deleted file mode 100644
index 4450f92..0000000
--- a/tests/utilities_tests/data_treatment_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-##############################################################################
-# Copyright (c) 2016 CENGN and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-import unittest
-from storperf.utilities import data_treatment as DataTreatment
-
-
-class DataTreatmentTest(unittest.TestCase):
-
- def setUp(self):
- unittest.TestCase.setUp(self)
-
- def test_empty_series(self):
- expected = {
- 'slope_data': [],
- 'range_data': [],
- 'average_data': []
- }
- data_series = []
- actual = DataTreatment.data_treatment(data_series)
- self.assertEqual(expected, actual)
-
- def test_integer_series(self):
- expected = {
- 'slope_data': [[1, 5], [66, 2], [12, 98], [74, 669], [33, 66]],
- 'range_data': [5, 2, 98, 669, 66],
- 'average_data': [5, 2, 98, 669, 66]
- }
- data_series = [[1, 5], [66, 2], [12, 98], [74, 669], [33, 66]]
- actual = DataTreatment.data_treatment(data_series)
- self.assertEqual(expected, actual)
-
- def test_float_series(self):
- expected = {
- 'slope_data': [[5.6, 12.7], [96.66, 78.212],
- [639.568, 5.3], [4.65, 6.667]],
- 'range_data': [12.7, 78.212, 5.3, 6.667],
- 'average_data': [12.7, 78.212, 5.3, 6.667]
- }
- data_series = [
- [5.6, 12.7], [96.66, 78.212], [639.568, 5.3], [4.65, 6.667]]
- actual = DataTreatment.data_treatment(data_series)
- self.assertEqual(expected, actual)
-
- def test_float_int_mix(self):
- expected = {
- 'slope_data': [[5, 12.7], [96.66, 7], [639.568, 5.3], [4, 6]],
- 'range_data': [12.7, 7, 5.3, 6],
- 'average_data': [12.7, 7, 5.3, 6]
- }
- data_series = [[5, 12.7], [96.66, 7], [639.568, 5.3], [4, 6]]
- actual = DataTreatment.data_treatment(data_series)
- self.assertEqual(expected, actual)
-
- def test_negative_values(self):
- expected = {
- 'slope_data': [[-15, 5.56], [41.3, -278], [41.3, -98],
- [78.336, -0.12], [33.667, 66]],
- 'range_data': [5.56, -278, -98, -0.12, 66],
- 'average_data': [5.56, -278, -98, -0.12, 66]
- }
- data_series = [
- [-15, 5.56], [41.3, -278], [41.3, -98],
- [78.336, -0.12], [33.667, 66]]
- actual = DataTreatment.data_treatment(data_series)
- self.assertEqual(expected, actual)
-
- def test_single_value(self):
- expected = {
- 'slope_data': [[86.8, 65.36]],
- 'range_data': [65.36],
- 'average_data': [65.36]
- }
- data_series = [[86.8, 65.36]]
- actual = DataTreatment.data_treatment(data_series)
- self.assertEqual(expected, actual)
diff --git a/tests/utilities_tests/dictionary_test.py b/tests/utilities_tests/dictionary_test.py
deleted file mode 100644
index 0819cef..0000000
--- a/tests/utilities_tests/dictionary_test.py
+++ /dev/null
@@ -1,42 +0,0 @@
-##############################################################################
-# Copyright (c) 2016 EMC and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-import unittest
-from storperf.utilities import dictionary
-
-
-class DictionaryTest(unittest.TestCase):
-
- def setUp(self):
- self.dictionary = {}
- self.dictionary['key'] = 'value'
- pass
-
- def test_get_no_default(self):
- expected = None
- actual = dictionary.get_key_from_dict(self.dictionary, 'no-key')
- self.assertEqual(expected, actual)
-
- def test_get_with_default(self):
- expected = 'value 2'
- actual = dictionary.get_key_from_dict(
- self.dictionary, 'no-key', expected)
- self.assertEqual(expected, actual)
-
- def test_get_with_value(self):
- expected = 'value'
- actual = dictionary.get_key_from_dict(
- self.dictionary, 'key')
- self.assertEqual(expected, actual)
-
- def test_get_with_value_and_default(self):
- expected = 'value'
- actual = dictionary.get_key_from_dict(
- self.dictionary, 'key', 'value 2')
- self.assertEqual(expected, actual)
diff --git a/tests/utilities_tests/math_average_test.py b/tests/utilities_tests/math_average_test.py
deleted file mode 100644
index 3095f56..0000000
--- a/tests/utilities_tests/math_average_test.py
+++ /dev/null
@@ -1,52 +0,0 @@
-##############################################################################
-# Copyright (c) 2016 CENGN and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-import unittest
-from storperf.utilities import math as math
-
-
-class MathAverageTest(unittest.TestCase):
-
- def setUp(self):
- unittest.TestCase.setUp(self)
-
- def test_empty_series(self):
- expected = None
- data_series = []
- actual = math.average(data_series)
- self.assertEqual(expected, actual)
-
- def test_integer_series(self):
- expected = 19.75
- data_series = [5, 12, 7, 55]
- actual = math.average(data_series)
- self.assertEqual(expected, actual)
-
- def test_float_series(self):
- expected = 63.475899999999996
- data_series = [78.6, 45.187, 33.334, 96.7826]
- actual = math.average(data_series)
- self.assertEqual(expected, actual)
-
- def test_float_int_mix(self):
- expected = 472.104
- data_series = [10, 557.33, 862, 56.99, 874.2]
- actual = math.average(data_series)
- self.assertEqual(expected, actual)
-
- def test_negative_values(self):
- expected = -17.314
- data_series = [-15.654, 59.5, 16.25, -150, 3.334]
- actual = math.average(data_series)
- self.assertEqual(expected, actual)
-
- def test_single_value(self):
- expected = -66.6667
- data_series = [-66.6667]
- actual = math.average(data_series)
- self.assertEqual(expected, actual)
diff --git a/tests/utilities_tests/math_range_test.py b/tests/utilities_tests/math_range_test.py
deleted file mode 100644
index 90519e7..0000000
--- a/tests/utilities_tests/math_range_test.py
+++ /dev/null
@@ -1,120 +0,0 @@
-##############################################################################
-# Copyright (c) 2016 CENGN and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-from random import uniform, randrange
-import unittest
-
-from storperf.utilities import math as Range
-
-
-class MathRangeTest(unittest.TestCase):
-
- def setUp(self):
- unittest.TestCase.setUp(self)
-
- def test_empty_series(self):
- expected = None
- data_series = []
- actual = Range.range_value(data_series)
- self.assertEqual(expected, actual)
-
- def test_integer_series(self):
- expected = 11946
- data_series = [5, 351, 847, 2, 1985, 18,
- 96, 389, 687, 1, 11947, 758, 155]
- actual = Range.range_value(data_series)
- self.assertEqual(expected, actual)
-
- def test_float_series_1_decimal(self):
- expected = 778595.5
- data_series = [736.4, 9856.4, 684.2, 0.3, 0.9, 778595.8]
- actual = Range.range_value(data_series)
- self.assertEqual(expected, actual)
-
- def test_float_series_2_decimals(self):
- expected = 5693.47
- data_series = [51.36, 78.40, 1158.24, 5.50, 0.98, 5694.45]
- actual = Range.range_value(data_series)
- self.assertEqual(expected, actual)
-
- def test_float_series_3_decimals(self):
- expected = 992.181
- data_series = [4.562, 12.582, 689.452,
- 135.162, 996.743, 65.549, 36.785]
- actual = Range.range_value(data_series)
- self.assertEqual(expected, actual)
-
- def test_float_series_4_decimals(self):
- expected = 122985.3241
- data_series = [39.4785, 896.7845, 11956.3654,
- 44.2398, 6589.7134, 0.3671, 122985.6912]
- actual = Range.range_value(data_series)
- self.assertEqual(expected, actual)
-
- def test_float_series_5_decimals(self):
- expected = 8956208.84494
- data_series = [12.78496, 55.91275, 668.94378,
- 550396.5671, 512374.9999, 8956221.6299]
- actual = Range.range_value(data_series)
- self.assertEqual(expected, actual)
-
- def test_float_series_10_decimals(self):
- expected = 5984.507397972699
- data_series = [1.1253914785, 5985.6327894512,
- 256.1875693287, 995.8497623415]
- actual = Range.range_value(data_series)
- self.assertEqual(expected, actual)
-
- def test_float_mix(self):
- expected = 60781.6245372199
- data_series = [60785.9962, 899.4, 78.66, 69.58, 4.93795,
- 587.195486, 96.7694536, 5.13755964,
- 33.333333334, 60786.5624872199]
- actual = Range.range_value(data_series)
- self.assertEqual(expected, actual)
-
- def test_float_integer_mix(self):
- expected = 460781.05825
- data_series = [460785.9962, 845.634, 24.1, 69.58, 89, 4.93795]
- actual = Range.range_value(data_series)
- self.assertEqual(expected, actual)
-
- def test_negative_values(self):
- expected = 596.78163
- data_series = [-4.655, -33.3334, -596.78422, -0.00259, -66.785]
- actual = Range.range_value(data_series)
- self.assertEqual(expected, actual)
-
- def test_negative_positive_mix(self):
- expected = 58.859500000000004
- data_series = [6.85698, -2.8945, 0, -0.15, 55.965]
- actual = Range.range_value(data_series)
- self.assertEqual(expected, actual)
-
- def test_single_element(self):
- expected = 0
- data_series = [2.265]
- actual = Range.range_value(data_series)
- self.assertEqual(expected, actual)
-
- def test_10000_values_processing(self):
- expected = 28001.068
- data_series = [uniform(-10000, 10000) for _ in range(10000)]
- data_series.insert(randrange(len(data_series)), 15000.569)
- data_series.insert(randrange(len(data_series)), -13000.499)
- actual = Range.range_value(data_series)
- self.assertEqual(expected, actual)
-
- def test_processing_100_values_100_times(self):
- expected = 35911.3134
- for _ in range(1, 100):
- data_series = [uniform(-10000, 10000) for _ in range(100)]
- data_series.insert(randrange(len(data_series)), 16956.3334)
- data_series.insert(randrange(len(data_series)), -18954.98)
- actual = Range.range_value(data_series)
- self.assertEqual(expected, actual)
diff --git a/tests/utilities_tests/math_slope_test.py b/tests/utilities_tests/math_slope_test.py
deleted file mode 100644
index 24d5cd7..0000000
--- a/tests/utilities_tests/math_slope_test.py
+++ /dev/null
@@ -1,72 +0,0 @@
-##############################################################################
-# Copyright (c) 2016 CENGN and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-import unittest
-from storperf.utilities import math as Slope
-
-
-class MathSlopeTest(unittest.TestCase):
-
- def setUp(self):
- unittest.TestCase.setUp(self)
- pass
-
- def test_slope_empty_series(self):
- expected = None
- actual = Slope.slope([])
- self.assertEqual(expected, actual)
-
- def test_slope_integer_series(self):
- expected = 1.4
- actual = Slope.slope([[1, 6], [2, 5], [3, 7], [4, 10]])
- self.assertEqual(expected, actual)
-
- def test_slope_decimal_series(self):
- expected = 1.4
- actual = Slope.slope([[1.0, 6.0], [2.0, 5.0], [3.0, 7.0], [4.0, 10.0]])
- self.assertEqual(expected, actual)
-
- def test_slope_decimal_integer_mix(self):
- expected = 1.4
- actual = Slope.slope([[1.0, 6], [2, 5.0], [3, 7], [4.0, 10]])
- self.assertEqual(expected, actual)
-
- def test_slope_negative_y_series(self):
- expected = 2
- actual = Slope.slope([[1.0, -2], [2, 2], [3, 2]])
- self.assertEqual(expected, actual)
-
- def test_slope_negative_x_series(self):
- expected = 1.4
- actual = Slope.slope([[-24, 6.0], [-23, 5], [-22, 7.0], [-21, 10]])
- self.assertEqual(expected, actual)
-
- def test_slope_out_of_order_series(self):
- expected = 1.4
- actual = Slope.slope([[2, 5.0], [4, 10], [3.0, 7], [1, 6]])
- self.assertEqual(expected, actual)
-
- def test_slope_0_in_y(self):
- expected = -0.5
- actual = Slope.slope([[15.5, 1], [16.5, 0], [17.5, 0]])
- self.assertEqual(expected, actual)
-
- def test_slope_0_in_x(self):
- expected = 1.4
- actual = Slope.slope([[0, 6.0], [1, 5], [2, 7], [3, 10]])
- self.assertEqual(expected, actual)
-
- def test_slope_0_in_x_and_y(self):
- expected = 1.5
- actual = Slope.slope([[0.0, 0], [1, 1], [2, 3]])
- self.assertEqual(expected, actual)
-
- def test_infinte_slope(self):
- expected = None
- actual = Slope.slope([[1480623510, 1295.87], [1480623520, 1380.79]])
- self.assertEqual(expected, actual)
diff --git a/tests/utilities_tests/steady_state_test.py b/tests/utilities_tests/steady_state_test.py
deleted file mode 100644
index 564c090..0000000
--- a/tests/utilities_tests/steady_state_test.py
+++ /dev/null
@@ -1,65 +0,0 @@
-##############################################################################
-# Copyright (c) 2016 CENGN and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-import unittest
-from storperf.utilities import steady_state as SteadyState
-
-
-class SteadyStateTest(unittest.TestCase):
-
- def setUp(self):
- unittest.TestCase.setUp(self)
-
- def test_integer_values(self):
- expected = True
- data_series = [[305, 20], [306, 21], [307, 21], [308, 19]]
- actual = SteadyState.steady_state(data_series)
- self.assertEqual(expected, actual)
-
- def test_float_values(self):
- expected = True
- data_series = [
- [55.5, 40.5], [150.2, 42.3], [150.8, 41.8], [151.2, 41.5]]
- actual = SteadyState.steady_state(data_series)
- self.assertEqual(expected, actual)
-
- def test_float_integer_mix_false(self):
- expected = False
- data_series = [[1, 2], [2, 2.2], [3, 1.8], [4, 1.8]]
- actual = SteadyState.steady_state(data_series)
- self.assertEqual(expected, actual)
-
- def test_float_integer_mix_true(self):
- expected = True
- data_series = [[12, 18], [12.5, 18.2], [13, 16.8], [15, 16.8]]
- actual = SteadyState.steady_state(data_series)
- self.assertEqual(expected, actual)
-
- def test_empty_series(self):
- expected = False
- data_series = []
- actual = SteadyState.steady_state(data_series)
- self.assertEqual(expected, actual)
-
- def test_negative_values(self):
- expected = True
- data_series = [[-1, -24.2], [0.5, -23.8], [1.1, -24.0], [3.2, -24.0]]
- actual = SteadyState.steady_state(data_series)
- self.assertEqual(expected, actual)
-
- def test_out_of_order_series(self):
- expected = True
- data_series = [[-15, 0.43], [-16, 0.41], [-3, 0.45], [4, 0.42]]
- actual = SteadyState.steady_state(data_series)
- self.assertEqual(expected, actual)
-
- def test_negative_slope(self):
- expected = False
- data_series = [[1.3, 1], [1.2, 1], [1.1, 1.1], [1.0, 1.1]]
- actual = SteadyState.steady_state(data_series)
- self.assertEqual(expected, actual)
diff --git a/tests/utilities_tests/thread_gate_test.py b/tests/utilities_tests/thread_gate_test.py
deleted file mode 100644
index de8b15a..0000000
--- a/tests/utilities_tests/thread_gate_test.py
+++ /dev/null
@@ -1,57 +0,0 @@
-##############################################################################
-# Copyright (c) 2016 EMC and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-import time
-import unittest
-
-from storperf.utilities.thread_gate import FailureToReportException
-from storperf.utilities.thread_gate import ThreadGate
-
-
-class ThreadGateTest(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def test_one_one_report(self):
- gate = ThreadGate(1)
- self.assertEqual(True, gate.report(1))
-
- def test_two_one_report(self):
- gate = ThreadGate(2)
- self.assertEqual(False, gate.report(1))
-
- def test_two_two_reports(self):
- gate = ThreadGate(2)
- self.assertEqual(False, gate.report(1))
- self.assertEqual(True, gate.report(2))
-
- def test_two_one_duplicate_reports(self):
- gate = ThreadGate(2)
- self.assertEqual(False, gate.report(1))
- self.assertEqual(False, gate.report(1))
- self.assertEqual(True, gate.report(2))
-
- def test_two_old_old_report(self):
- timeout = 5
- gate = ThreadGate(2, timeout)
- report_time = time.time() - (timeout * 2)
- gate._registrants[2] = report_time
- self.assertEqual(False, gate.report(1))
-
- def test_two_never_report(self):
- timeout = 5
- gate = ThreadGate(2, timeout)
- report_time = time.time() - (timeout * 3)
- gate._creation_time = report_time
- try:
- gate.report(1)
- self.fail()
- except FailureToReportException:
- pass
diff --git a/tests/workload_tests/__init__.py b/tests/workload_tests/__init__.py
deleted file mode 100644
index 73334c7..0000000
--- a/tests/workload_tests/__init__.py
+++ /dev/null
@@ -1,8 +0,0 @@
-##############################################################################
-# Copyright (c) 2015 EMC and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
diff --git a/tests/workload_tests/workload_subclass_test.py b/tests/workload_tests/workload_subclass_test.py
deleted file mode 100644
index e9e47f3..0000000
--- a/tests/workload_tests/workload_subclass_test.py
+++ /dev/null
@@ -1,54 +0,0 @@
-##############################################################################
-# Copyright (c) 2015 EMC and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-from storperf.workloads.rr import rr
-from storperf.workloads.rs import rs
-from storperf.workloads.rw import rw
-from storperf.workloads.wr import wr
-from storperf.workloads.ws import ws
-import unittest
-
-
-class WorkloadSubclassTest(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def test_local_name(self):
- workload = rr()
- self.assertEqual(workload.fullname,
- "None.rr.queue-depth.1.block-size.64k.None",
- workload.fullname)
-
- def test_remote_name(self):
- workload = rw()
- workload.remote_host = "192.168.0.1"
- self.assertEqual(workload.fullname,
- "None.rw.queue-depth.1.block-size.64k.192-168-0-1",
- workload.fullname)
-
- def test_blocksize(self):
- workload = rs()
- workload.options["bs"] = "4k"
- self.assertEqual(workload.fullname,
- "None.rs.queue-depth.1.block-size.4k.None",
- workload.fullname)
-
- def test_queue_depth(self):
- workload = wr()
- workload.options["iodepth"] = "8"
- self.assertEqual(workload.fullname,
- "None.wr.queue-depth.8.block-size.64k.None",
- workload.fullname)
-
- def test_id(self):
- workload = ws()
- workload.id = "workloadid"
- self.assertEqual(workload.fullname,
- "workloadid.ws.queue-depth.1.block-size.64k.None",
- workload.fullname)