Author: justi9
Date: 2010-06-21 17:51:13 -0400 (Mon, 21 Jun 2010)
New Revision: 4046
Modified:
mgmt/newdata/cumin/bin/cumin-smoke-test
Log:
Make cumin-smoke-test an entry point for multiple, individually selectable smoke tests;
add a submit smoke test
Modified: mgmt/newdata/cumin/bin/cumin-smoke-test
===================================================================
--- mgmt/newdata/cumin/bin/cumin-smoke-test 2010-06-21 19:15:25 UTC (rev 4045)
+++ mgmt/newdata/cumin/bin/cumin-smoke-test 2010-06-21 21:51:13 UTC (rev 4046)
@@ -44,28 +44,70 @@
conn = cumin.database.get_connection()
cursor = conn.cursor()
- # cls = cumin.model.org_apache_qpid_broker.Broker XXX fails
- cls = cumin.model.com_redhat_grid.Submission
- obj = cls.get_object(cursor)
+ def invoke_test(test):
+ print "[%s]" % name[6:]
- print "Calling method on", obj
+ try:
+ test(cumin, cursor)
+ except:
+ print "FAILES!"
- summs = cumin.model.get_submission_job_summaries(obj)
+ try:
+ chosen = sys.argv[1]
+ except IndexError:
+ chosen = None
- pprint(summs)
+ attrs = globals()
- #completed = Event()
-
- #def completion(x, y):
- # print x, y
- # completed.set()
+ if chosen:
+ name = "_test_%s" % chosen
- #cumin.session.call_method(completion, obj, "GetJobSummaries", ())
+ assert name in attrs
- #completed.wait()
+ invoke_test(attrs[name])
+ else:
+ for name in [x for x in attrs if x.startswith("_test")]:
+ invoke_test(attrs[name])
finally:
cumin.stop()
+def _test_submit(cumin, cursor):
+ cls = cumin.model.com_redhat_grid.Scheduler
+ obj = cls.get_object(cursor)
+
+ print "Submitting to", obj,
+
+ ad = {"Cmd": "/bin/sleep",
+ "Args": "5m",
+ "JobUniverse": 5,
+ "Requirements": "TRUE",
+ "Iwd": "/tmp",
+ "Owner": "gridmonkey@%s" % obj.Machine,
+ "!!descriptors": {"Requirements":
"com.redhat.grid.Expression"}}
+
+ completed = Event()
+
+ def completion(x, y):
+ print "-> [%s, %s]" % (x, y)
+
+ completed.set()
+
+ cumin.session.call_method(completion, obj, "SubmitJob", (ad,))
+
+ completed.wait(30)
+
+def _test_job_summaries(cumin, cursor):
+ cls = cumin.model.com_redhat_grid.Submission
+ obj = cls.get_object(cursor)
+
+ print "Getting job summaries for", obj,
+
+ summs = cumin.model.get_submission_job_summaries(obj)
+
+ print "-> [%i job summaries]" % len(summs)
+
+ #pprint(summs)
+
if __name__ == "__main__":
try:
main()
Show replies by date