Skip to content

Commit 8a3f52c

Browse files
committed
Adding cbcollect inbetween the columnar volume test
Change-Id: I056fb934217c972c4bcc0700d9528e06fbcdb0e5 Reviewed-on: https://review.couchbase.org/c/TAF/+/226551 Reviewed-by: Thuan Nguyen <soccon@gmail.com> Tested-by: Ritesh Agarwal <ritesh.agarwal@couchbase.com>
1 parent fea3f94 commit 8a3f52c

4 files changed

Lines changed: 23 additions & 7 deletions

File tree

couchbase_utils/capella_utils/dedicated.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,9 +631,8 @@ def trigger_log_collection(pod, tenant, cluster_id, log_id=""):
631631
tenant.user,
632632
tenant.pwd,
633633
pod.TOKEN)
634-
log_id = {"ticketId": log_id}
635634
resp = capella_api.trigger_log_collection(cluster_id,
636-
log_id=log_id)
635+
ticketId=log_id)
637636
if resp.status_code != 201:
638637
CapellaUtils.log.critical("Logs collection failed:{}".
639638
format(resp.status_code))

pytests/aGoodDoctor/goldfish/CbasUtil.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,8 @@ def wait_for_link_connect(self, cluster, link_name, timeout=3600):
216216
def discharge_CBAS(self):
217217
self.stop_run = True
218218

219-
def wait_for_ingestion(self, cluster, databases, timeout=86400):
219+
def wait_for_ingestion(self, cluster, databases, timeout=86400, ingestion_result=list()):
220220
client = cluster.SDKClients[0].cluster
221-
_results = list()
222221
def check_in_th(collection, items):
223222
status = False
224223
stop_time = time.time() + timeout
@@ -271,7 +270,7 @@ def check_in_th(collection, items):
271270
traceback.print_exc()
272271
time.sleep(random.randint(60,120))
273272
if status is False:
274-
_results.append(status)
273+
ingestion_result.append(status)
275274
ths = list()
276275
for database in databases:
277276
for collection in database.cbas_collections:
@@ -282,7 +281,7 @@ def check_in_th(collection, items):
282281
ths.append(th)
283282
for th in ths:
284283
th.join()
285-
return False not in _results
284+
return False not in ingestion_result
286285

287286

288287
class CBASQueryLoad:

pytests/aGoodDoctor/goldfish/GoldfishVolume.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,20 +303,23 @@ def test_rebalance(self):
303303
while loop > 0:
304304
loop -= 1
305305
self.ingestion_ths = list()
306+
ingestion_result = list()
306307

307308
# Create new collections
308309
for dataSource in self.data_sources["remoteCouchbase"] + self.data_sources["mongo"]:
309310
for tenant in self.tenants:
310311
for columnar in tenant.columnar_instances:
311312
self.drCBAS.disconnect_link(columnar, dataSource.link_name)
312313
self.sleep(60, "wait after previous link disconnect")
314+
self.cbcollect_logs(tenant, cluster.cluster_id, log_id="1")
313315
dataSource.link_name = "{}_".format(dataSource.type) + ''.join([random.choice(string.ascii_letters + string.digits) for _ in range(5)])
314316
dataSource.links.append(dataSource.link_name)
315317
dataSource.loadDefn.get("cbas")[1] = dataSource.loadDefn.get("cbas")[1] + self.default_workload.get("cbas")[1]
316318
self.drCBAS.create_links(columnar, [dataSource])
317319
th = threading.Thread(
318320
target=self.drCBAS.wait_for_ingestion,
319-
args=(columnar, [dataSource], self.index_timeout))
321+
args=(columnar, [dataSource], self.index_timeout,
322+
ingestion_result))
320323
th.start()
321324
self.ingestion_ths.append(th)
322325
if scaling:
@@ -357,6 +360,10 @@ def test_rebalance(self):
357360
self.sleep(1800, "Lets the ingestion/query running for 30 mins post scaling")
358361
for th in self.ingestion_ths:
359362
th.join()
363+
if False in ingestion_result:
364+
for tenant in self.tenants:
365+
for columnar in tenant.columnar_instances:
366+
self.cbcollect_logs(tenant, cluster.cluster_id, log_id="2")
360367

361368
for ql in self.cbasQL:
362369
ql.stop_query_load()

pytests/aGoodDoctor/hostedOPD.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from com.couchbase.test.taskmanager import TaskManager
99
from com.couchbase.test.sdk import Server, SDKClientPool
10+
from table_view import TableView
1011
from opd import OPD
1112
from membase.api.rest_client import RestConnection
1213
import random
@@ -301,3 +302,13 @@ def wait_for_rebalances(self, rebalance_tasks):
301302
for task in rebalance_tasks:
302303
self.task_manager.get_task_result(task)
303304
self.assertTrue(task.result, "Cluster Upgrade Failed...")
305+
306+
def cbcollect_logs(self, tenant, cluster_id, log_id=""):
307+
CapellaUtils.trigger_log_collection(self.pod, tenant, cluster_id,
308+
log_id=log_id)
309+
table = TableView(self.log.info)
310+
table.add_row(["URL"])
311+
task = CapellaUtils.check_logs_collect_status(self.pod, tenant, cluster_id)
312+
for _, logInfo in sorted(task["perNode"].items()):
313+
table.add_row([logInfo["url"]])
314+
table.display("Cluster: {}".format(cluster_id))

0 commit comments

Comments
 (0)