Skip to content

Commit

Permalink
CBQE-0 add logs for autocompaction tests
Browse files Browse the repository at this point in the history
Change-Id: I770c493595452b4228770cf132f00be14c00766d
Reviewed-on: http://review.couchbase.org/26466
Reviewed-by: Iryna Mironava <irynamironava@yandex.ru>
Tested-by: Iryna Mironava <irynamironava@yandex.ru>
  • Loading branch information
IrynaMironava committed May 22, 2013
1 parent f316bb7 commit ebf1520
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions pytests/autocompaction.py
Expand Up @@ -4,7 +4,7 @@
import time
import json

from threading import Thread
from threading import Thread, Event

from testconstants import MIN_COMPACTION_THRESHOLD
from testconstants import MAX_COMPACTION_THRESHOLD
Expand All @@ -28,6 +28,7 @@ def setUp(self):
super(AutoCompactionTests, self).setUp()
self.autocompaction_value = self.input.param("autocompaction_value", 0)
BucketOperationHelper.delete_all_buckets_or_assert(self.servers, self)
self.is_crashed = Event()

@staticmethod
def insert_key(serverInfo, bucket_name, count, size):
Expand All @@ -44,10 +45,17 @@ def load(self, server, compaction_value, bucket_name, gen):
end_time = time.time() + self.wait_timeout * 50
# generate load until fragmentation reached
while monitor_fragm.state != "FINISHED":
if self.is_crashed.is_set():
self.cluster.shutdown()
return
if end_time < time.time():
self.fail("Fragmentation level is not reached in %s sec" % self.wait_timeout * 50)
# update docs to create fragmentation
self._load_all_buckets(server, gen, "update", 0)
try:
self._load_all_buckets(server, gen, "update", 0)
except Exception, ex:
self.is_crashed.set()
self.log.error("Load cannot be performed: %s" % str(ex))
monitor_fragm.result()

def test_database_fragmentation(self):
Expand Down Expand Up @@ -108,10 +116,12 @@ def test_database_fragmentation(self):
elif compact_run:
self.log.info("auto compaction run successfully")
except Exception, ex:
insert_thread._Thread__stop()
if str(ex).find("enospc") != -1:
self.is_crashed.set()
self.log.error("Disk is out of space, unable to load more data")
insert_thread._Thread__stop()
else:
insert_thread._Thread__stop()
raise ex
else:
insert_thread.join()
Expand Down

0 comments on commit ebf1520

Please sign in to comment.