Skip to content

Commit

Permalink
New throttling tc
Browse files Browse the repository at this point in the history
Change-Id: Idea6b9e3852818b9a1f683a7f1e6c07e3eaba629
Reviewed-on: https://review.couchbase.org/c/testrunner/+/180607
Reviewed-by: Girish Benakappa <girish.benakappa@couchbase.com>
Tested-by: Pierre Regazzoni <pierre.regazzoni@couchbase.com>
  • Loading branch information
pierrecouch committed Sep 29, 2022
1 parent 6d401fb commit 868581c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
3 changes: 2 additions & 1 deletion conf/tuq/py-gsi-throttling.conf
@@ -1,3 +1,4 @@
tuqquery.tuq_throttling.QueryThrottlingTests:
test_gsi_create
test_gsi_below_throttle
test_gsi_below_throttle
test_gsi_limit
19 changes: 18 additions & 1 deletion pytests/tuqquery/tuq_throttling.py
Expand Up @@ -10,6 +10,7 @@ def setUp(self):
self.kv_wu, self.kv_ru = 1024, 4096
self.index_wu, self.index_ru = 1024, 256
self.scope_limit, self.collection_limit = 100, 100
self.gsi_limit = 200
self.kvThrottleLimit = self.get_throttle_limits(service='kvThrottleLimit')
self.log.info(f'kvThrottleLimit is {self.kvThrottleLimit}')

Expand Down Expand Up @@ -143,4 +144,20 @@ def test_collection_limit(self):
self.assertTrue(f'_:Maximum number of collections ({self.collection_limit}) for this bucket has been reached' in error['msg'])
finally:
for i in range(self.collection_limit):
self.run_cbq_query(f'DROP COLLECTION {self.bucket}.`_default`.collection{i} IF EXISTS')
self.run_cbq_query(f'DROP COLLECTION {self.bucket}.`_default`.collection{i} IF EXISTS')

def test_gsi_limit(self):
indexes = self.run_cbq_query('SELECT raw count(*) FROM system:indexes WHERE `using` = "gsi"')
count = indexes['results'][0]
for i in range(self.gsi_limit - count):
self.run_cbq_query(f'CREATE INDEX idx{i} IF NOT EXISTS ON {self.bucket}(a)')
try:
self.run_cbq_query(f'CREATE INDEX idx{self.gsi_limit+1} IF NOT EXISTS ON {self.bucket}(a)')
self.fail(f'We should not be able to create index beyond limit of {self.gsi_limit}')
except CBQError as ex:
error = self.process_CBQE(ex)
self.assertEqual(error['code'], 4350)
self.assertEqual(error['msg'], f'GSI CreateIndex() - cause: Limit for number of indexes that can be created per bucket has been reached. Limit : {self.gsi_limit}')
finally:
for i in range(self.gsi_limit):
self.run_cbq_query(f'DROP INDEX idx{i} IF EXISTS ON {self.bucket}')

0 comments on commit 868581c

Please sign in to comment.