test: audit: add cassandra user test case

Audit tests use the `filter_out_noise` function to remove noise from
audit logs generated by user authentication. As a result, none of the
existing tests covered audit logs for the default `cassandra` user.
This change adds a test case for that user.

Refs: scylladb/scylladb#25069
This commit is contained in:
Andrzej Jackowski
2025-07-21 14:09:06 +02:00
parent aef6474537
commit 21aedeeafb

View File

@@ -958,6 +958,16 @@ class TestCQLAudit(AuditTester):
with self.assert_entries_were_added(session, expected_audit_entries, filter_out_cassandra_auth=True):
self.prepare(user="test", password="test", create_keyspace=False)
def test_cassandra_login(self):
"""
Test user login to default (cassandra) user
"""
session = self.prepare(user="cassandra", password="cassandra", create_keyspace=False)
expected_audit_entries = [AuditEntry(category="AUTH", statement="LOGIN", user="cassandra", table="", ks="", cl="", error=False)]
with self.assert_entries_were_added(session, expected_audit_entries, filter_out_cassandra_auth=False):
self.prepare(user="cassandra", password="cassandra", create_keyspace=False)
def test_categories(self):
"""
Test filtering audit categories