## Why I'm doing:
nose.tools maps assert_regexp_matches to unittest `AssertRegexpMatches`.
`AssertRegexpMatches` got renamed to `AssertRegex` and is deprecated since python 3.2. The alias got removed in 3.12 ([changelog](49e83e31bd/Doc/whatsnew/3.12.rst (unittest-1))).
When running with `python >= 3.12` this will result in `AttributeError: module 'nose.tools' has no attribute 'assert_regexp_matches'`.
## What I'm doing:
Replacing occurences of assert_regexp_matches with assert_regex.
Signed-off-by: m.bogusz <m.bogusz@celonis.com>
What I'm doing:
This pull request adds support for granting and revoking roles to user groups in the authorization system. It introduces new methods and data structures to manage the mapping between groups and roles, ensures persistence and replay of these operations, and updates the privilege loading logic to include group-based roles. The changes also update relevant SQL analyzers and statement visitors to handle group-related role grants and revokes.
Group-to-Role Grant/Revoke Functionality:
Added a new groupToRoleList map in AuthorizationMgr to track which roles are assigned to each group, along with methods to grant and revoke roles for groups (grantRoleToGroup, revokeRoleFromGroup, and their replay counterparts). These actions are now handled in the main grantRole and revokeRole methods. [1] [2] [3] [4] [5]
Introduced the UpdateGroupToRoleLog class to persist group-to-role assignments and removals, and added new operation types (OP_GRANT_ROLE_TO_GROUP, OP_REVOKE_ROLE_FROM_GROUP) for edit log handling. [1] [2]
Updated the edit log and deserialization logic to support the new group-to-role operations, ensuring they are correctly replayed during recovery. [1] [2] [3]
Privilege Resolution and Query Enhancements:
Modified privilege collection loading to include roles assigned via group membership, so users gain the union of their direct and group-based roles. [1] [2]
Added methods to query roles assigned to a group, both by role ID and by role name, for use in privilege checks and metadata queries. [1] [2]
SQL Analyzer and Visitor Updates:
Updated the SQL analyzer and statement visitor logic to support group-based role grants and revokes, ensuring correct validation and privilege checks for group operations. [1] [2] [3] [4]
Persistence and Initialization:
Ensured that the groupToRoleList map is persisted and restored during authorization manager state load, maintaining group-role relationships across restarts.
These changes collectively enable group-based role management, improving flexibility and scalability of privilege assignment in the system.
What I'm doing:
This pull request adds support for IF NOT EXISTS and IF EXISTS clauses to the CREATE GROUP PROVIDER and DROP GROUP PROVIDER SQL statements, ensuring these operations are idempotent and error-tolerant. It also introduces comprehensive unit tests to verify the correct behavior of these clauses, and updates the parser and semantic analyzer accordingly.
Enhancements to Group Provider DDL Statements:
Added support for IF NOT EXISTS to CREATE GROUP PROVIDER and IF EXISTS to DROP GROUP PROVIDER, allowing these statements to succeed silently if the provider already exists or does not exist, respectively. The implementation includes proper error handling and DDL exception messages for cases where these clauses are not specified. [1] [2]
Updated the SQL parser (AstBuilder) to recognize and propagate the IF NOT EXISTS and IF EXISTS flags in CreateGroupProviderStmt and DropGroupProviderStmt objects.
Enhanced the semantic analyzer to respect the new flags, throwing exceptions only when appropriate (i.e., when the flags are not set and the provider's existence does not match the operation). [1] [2]
Testing Improvements:
Added a new test class GroupProviderStatementTest with comprehensive unit tests covering all scenarios for the new IF NOT EXISTS and IF EXISTS functionality, including creation, dropping, legacy constructors, and sequential operations.
Error Handling:
Wrapped the execution of dropGroupProviderStatement in the DDL statement executor with error reporting to ensure runtime exceptions are properly managed.
## Why I’m doing
- Tests often enable temporary configs, create transient objects, or invoke external side-effects. When a test fails mid-way, ad-hoc cleanup embedded in the test body may be skipped, leaving residue that causes flakiness and cross-test interference.
- This change provides a first-class, always-run teardown mechanism that executes after each case, regardless of pass/fail, improving test reliability and isolation, and simplifying test authoring.
## What I’m doing
- Introduce a CLEANUP block to SQL-tester that defines statements to run in tearDown for each case.
- Semantics:
- CLEANUP runs unconditionally in tearDown after each case (pass/fail/timeout).
- Results in CLEANUP are not validated; failures are logged but do not prevent later cleanup steps.
- Existing built-in cleanup (e.g., dropping parsed DATABASE/RESOURCE) still runs; CLEANUP is additive.
- In record mode, the CLEANUP block is preserved in-place in the generated R file.
- Syntax and example:
```sql
-- name: my_case
...
CLEANUP {
-- SQL must end with ';'
DROP TABLE IF EXISTS t1;
DROP DATABASE IF EXISTS db_${uuid0};
-- shell and function are allowed
shell: echo "cleanup ${uuid0}"
function: restore_env("arg1")
} END CLEANUP
```
**Code changes**
- test/README.md
- Document the CLEANUP grammar, usage, semantics, and example.
- test/lib/__init__.py
- Add CLEANUP/END CLEANUP flags.
- test/lib/choose_cases.py
- Parse CLEANUP blocks, collect commands, validate format, include in case model, support variable/uuid replacement, and record block in-place during -r mode.
- test/test_sql_cases.py
- Execute collected CLEANUP commands in tearDown unconditionally; keep record-mode output aligned; ensure built-in database/resource cleanup still runs.
Signed-off-by: PengFei Li <lpengfei2016@gmail.com>