summaryrefslogtreecommitdiffstats
path: root/loadtest/TestController.py
diff options
context:
space:
mode:
authorDR695H <dr695h@att.com>2019-04-18 10:56:38 -0400
committerGary Wu <gary.i.wu@huawei.com>2019-04-23 10:34:04 -0700
commitd050b58d3fde6a049104d8287f8d8cfbe3013d5d (patch)
tree7563bfffabfc4f713996b1f12e52b5f2317fc6e2 /loadtest/TestController.py
parent5709f89501b9ecf93fcb1667de017e1736c8919f (diff)
move robotframeworkonap to subdirectory
i also moved the build to maven based, although that isnt needed to work right now. Change-Id: Ib18d70e3ea4858cc4b9d51fdc2046b59202640ab Issue-ID: TEST-141 Signed-off-by: DR695H <dr695h@att.com> Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
Diffstat (limited to 'loadtest/TestController.py')
-rw-r--r--loadtest/TestController.py80
1 files changed, 0 insertions, 80 deletions
diff --git a/loadtest/TestController.py b/loadtest/TestController.py
deleted file mode 100644
index 3ba0083..0000000
--- a/loadtest/TestController.py
+++ /dev/null
@@ -1,80 +0,0 @@
-'''
-Created on Apr 7, 2017
-
-@author: jf9860
-'''
-import time
-import os
-from loadtest.RunEte import RunEte
-from loadtest.TestConfig import TestConfig
-import logging
-
-class TestController(object):
- '''
- classdocs
- '''
-
- threads = {}
- threadid = 0
- soaksubfolder = 'soak_' + str(os.getpid())
- test_number = 0
-
- def __init__(self, options):
- '''
- Constructor
- '''
- self.config = TestConfig(duration=options.duration, cyclelength=options.cyclelength, json=options.profile)
- logging.info(self.config.to_string())
-
- def execute(self):
- starttime = time.time()
- endtime = starttime + self.config.duration
- profileindex = 0
- currenttime = time.time()
- logging.info("{}:{}:{}".format(starttime, endtime, currenttime))
- while currenttime < endtime:
- if (profileindex >= len(self.config.profile)):
- profileindex = 0
- profile = self.config.profile[profileindex]
- sleeptime = profile[0]
- currenttime = time.time()
- if ((currenttime + sleeptime) < endtime):
- time.sleep(sleeptime)
- self.schedule(profile)
- profileindex = profileindex + 1
- currenttime = time.time()
- else:
- currenttime = endtime
-
- for threadname in self.threads:
- logging.info("TestController waiting on " + threadname)
- t = self.threads[threadname]
- t.join()
- logging.info("Soak test completed")
-
- def schedule(self, profile):
- self.remove_completed_threads()
- tests = profile[1]
- for test in tests:
- self.schedule_one(test)
-
- def schedule_one(self, test):
- self.test_number = self.test_number + 1
- self.threadid = self.threadid + 1
- threadname = "RunEte_" + str(self.threadid)
- ''' test for max threads '''
- t = RunEte(test, self.soaksubfolder, str(self.test_number))
- t.setName(threadname)
- t.start()
- self.threads[threadname] = t
-
-
- def remove_completed_threads(self):
- toremove = []
- for threadname in self.threads:
- t = self.threads[threadname]
- if (t.isAlive() == False):
- toremove.append(threadname)
- for threadname in toremove:
- logging.info("Removing " + threadname)
- del(self.threads[threadname]) \ No newline at end of file