summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2008-11-06 17:30:22 -0500
committerMichael DeHaan <mdehaan@redhat.com>2008-11-06 17:30:22 -0500
commit8a8743019f45470e0d2452490ca49d9b3ac33e5d (patch)
tree4bc10789b3a6a8b6704d73aa5d4ba263661d842a /tests
parentee1171bf4abedc811d40073c86ec202c99b0973e (diff)
downloadcobbler-8a8743019f45470e0d2452490ca49d9b3ac33e5d.tar.gz
cobbler-8a8743019f45470e0d2452490ca49d9b3ac33e5d.tar.xz
cobbler-8a8743019f45470e0d2452490ca49d9b3ac33e5d.zip
A couple of things, the removal of the server.update() code wasn't good for performance, so we are (for now) putting it back. More importantly this set of codechanges goes through the unit tests we already had and makes sure they use top level API calls. While this may look trivial, it's not -- the top level calls ensure data is saved and read from disk as in the full application, so they are more exhaustive. As of this commit, all tests as committed pass.
Diffstat (limited to 'tests')
-rw-r--r--tests/performance.py40
1 files changed, 18 insertions, 22 deletions
diff --git a/tests/performance.py b/tests/performance.py
index 92fd686a..bb0c3685 100644
--- a/tests/performance.py
+++ b/tests/performance.py
@@ -16,7 +16,7 @@ api = capi.BootAPI()
# part one ... create our test systems for benchmarking purposes if
# they do not seem to exist.
-if not api.profiles().find("foo"):
+if not api.find_profile("foo"):
print "CREATE A PROFILE NAMED 'foo' to be able to run this test"
sys.exit(0)
@@ -31,7 +31,7 @@ print "Deleting autotest entries from a previous run"
time1 = time.time()
for x in xrange(0,N):
try:
- sys = api.systems().remove("autotest-%s" % x,with_delete=True)
+ sys = api.remove_system("autotest-%s" % x,with_delete=True)
except:
pass
time2 = time.time()
@@ -40,36 +40,32 @@ print "ELAPSED: %s seconds" % (time2 - time1)
print "Creating test systems from scratch"
time1 = time.time()
for x in xrange(0,N):
+ print "."
sys = api.new_system()
sys.set_name("autotest-%s" % x)
- sys.set_mac_address(random_mac())
+ sys.set_mac_address(random_mac(), "eth0")
sys.set_profile("foo") # assumes there is already a foo
# print "... adding: %s" % sys.name
- api.systems().add(sys,save=True,with_sync=False,with_triggers=False)
+ api.add_system(sys)
time2 = time.time()
print "ELAPSED %s seconds" % (time2 - time1)
-for mode2 in [ "fast", "normal", "full" ]:
- for mode in [ "on", "off" ]:
+#for mode2 in [ "fast", "normal", "full" ]:
+for mode in [ "on", "off" ]:
- print "Running netboot edit benchmarks (turn %s, %s)" % (mode, mode2)
- time1 = time.time()
- for x in xrange(0,N):
- sys = api.systems().find("autotest-%s" % x)
- if mode == "off":
- sys.set_netboot_enabled(0)
- else:
- sys.set_netboot_enabled(1)
+ print "Running netboot edit benchmarks (turn %s, %s)" % (mode, mode2)
+ time1 = time.time()
+ for x in xrange(0,N):
+ sys = api.systems().find("autotest-%s" % x)
+ if mode == "off":
+ sys.set_netboot_enabled(0)
+ else:
+ sys.set_netboot_enabled(1)
# print "... editing: %s" % sys.name
- if mode2 == "fast":
- api.systems().add(sys, save=True, with_sync=False, with_triggers=False, quick_pxe_update=True)
- if mode2 == "normal":
- api.systems().add(sys, save=True, with_sync=False, with_triggers=False)
- if mode2 == "full":
- api.systems().add(sys, save=True, with_sync=True, with_triggers=True)
+ api.add_system(sys)
- time2 = time.time()
- print "ELAPSED: %s seconds" % (time2 - time1)
+ time2 = time.time()
+ print "ELAPSED: %s seconds" % (time2 - time1)