Skip to content

Commit 295cad3

Browse files
committed
Merge branch 'trinity' into cypher
MB-63214: Re-enable cbas SAML test cases Change-Id: I190d4f4a9e5295f3d66303d071f536c017846649
2 parents 9a3cbbd + e7d1a6b commit 295cad3

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

cluster_tests/testsets/saml_tests.py

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
class SamlTests(testlib.BaseTestSet):
6969
# MB-63612: Remove unnecessary Service.KV. It was added only to get rid of
7070
# the OnPremAutoFailoverSettingsTest failure.
71-
services_to_run = [Service.KV, Service.QUERY, Service.BACKUP]
71+
services_to_run = [Service.KV, Service.QUERY, Service.BACKUP, Service.CBAS]
7272

7373
@staticmethod
7474
def requirements():
@@ -613,6 +613,23 @@ def groups_and_roles_attributes_test(self):
613613
bkts.append(x['buckets']['name'])
614614
assert bkts == [f'{bucket}']
615615

616+
# MB-62604, MB-63214: cbas doesn't use cbauth. It uses a combination
617+
# of /pools/default/checkPermissions, /_cbauth/checkPermission. cbas
618+
# parses cb-on-behalf-extras headers and populates context (similar
619+
# to cbauth) before calling ns_server /_cbauth/checkPermission.
620+
621+
# Create analytics collection in test._default._default. This will
622+
# fail - we don't have cluster.analytics!manage. Analytics and full
623+
# admin roles have the permission (see admin_test).
624+
r = session.post(self.cluster.connected_nodes[0].url +
625+
'/_p/cbas/query/service',
626+
data={'statement':
627+
'alter collection '
628+
f'`{bucket}`.`_default`.`_default` '
629+
'enable analytics;'},
630+
headers=ui_headers)
631+
assert_http_code(403, r)
632+
616633
def groups_and_roles_admin_test(self):
617634
with saml_configured(self.cluster.connected_nodes[0],
618635
groupsAttribute='groups',
@@ -664,6 +681,24 @@ def groups_and_roles_admin_test(self):
664681
headers=ui_headers)
665682
assert_http_code(200, r)
666683

684+
# Create analytics collection in test._default._default.
685+
r = session.post(self.cluster.connected_nodes[0].url +
686+
'/_p/cbas/query/service',
687+
data={'statement':
688+
'alter collection '
689+
f'`{bucket}`.`_default`.`_default` '
690+
'enable analytics;'},
691+
headers=ui_headers)
692+
assert_http_code(200, r)
693+
694+
# Query analytics collections. They should exist.
695+
r = session.post(self.cluster.connected_nodes[0].url +
696+
'/_p/cbas/query/service',
697+
data={'statement':
698+
f'select * from `{bucket}`'},
699+
headers=ui_headers)
700+
assert_http_code(200, r)
701+
667702
# Successfull authentication, but user doesn't have access to UI
668703
def access_denied_test(self):
669704
with saml_configured(self.cluster.connected_nodes[0],

0 commit comments

Comments
 (0)