This test suite validates REST API endpoints for Apache Ranger services,Admin (rolerest, xuserrest, servicerest), KMS (Key Management Service), and tests HDFS encryption functionalities including key management and file operations within encryption zones.
| Suite | Description |
|---|---|
| hdfs | Test cases for HDFS encryption lifecycle using KMS |
| kms | Test cases for KMS REST API functionality |
| xuserrest | Test cases for Ranger Admin User/Group REST APIs |
| rolerest | Test cases for Ranger Admin Role REST APIs |
| servicerest | Test cases for Ranger Admin Service REST APIs |
functional-tests/ ├── hdfs/ # Tests on HDFS encryption cycle ├── kms/ # Tests on KMS REST API ├── xuserrest/ # Tests on Ranger User/Group/Role REST APIs ├── rolerest/ # Tests on Ranger Role REST APIs ├── servicerest/ # Tests on Ranger Service REST APIs │ ├── pytest.ini # Registers custom pytest markers ├── run-tests.sh # Script to automate setup and test execution ├── requirements.txt # Python dependencies └── readme.md # This documentation
Note: A Python virtual environment folder named
myenvwill be automatically generated upon running the tests for the first time.
cd functional-tests/
chmod +x run-tests.sh
Configure container behavior before running the script using the following environment variables:
Force a clean environment & helps building binaries with local changes:
export CLEAN_CONTAINERS=1 ./run-tests.sh
After initial setup, disable fresh container creation to speed up subsequent runs (default behavior):
export CLEAN_CONTAINERS=0 ./run-tests.sh
Start Docker infrastructure without executing Pytest suites:
export RUN_TESTS=0 ./run-tests.sh
This is useful when tests fail due to slow container startup. Once all containers are healthy, re-enable tests (default behavior):
export RUN_TESTS=1 ./run-tests.sh
The run-tests.sh script manages Docker container setup, dependency installation, and test execution. It supports both interactive and argument-based modes.
Run the script without arguments to be prompted for inputs:
./run-tests.sh
DB Type: Enter one of postgres, mysql, oracle, mssql. Defaults to postgres.
Test Suites: Enter space-separated suite names. Defaults to ALL suites.
example:
Available DB types: postgres, mysql, oracle Enter DB type (press Enter to default to postgres): postgres Available test suites: xuserrest servicerest hdfs kms Enter test suites space-separated (press Enter to run ALL): kms hdfs
Pass arguments directly to skip prompts:
./run-tests.sh [db-type] [test-suites...]
db-type — Must be the first argument. Valid values: postgres, mysql, oracle.
test-suites — Space-separated list: hdfs, kms, xuserrest, servicerest.
Examples:
./run-tests.sh postgres kms hdfs
After execution, HTML reports are automatically generated for each suite. Open the corresponding file in any browser to view detailed results:
| Suite | Report File |
|---|---|
| hdfs | report_hdfs.html |
| kms | report_kms.html |
| xuserrest | report_xuserrest.html |
| rolerest | report_rolerest.html |
| servicerest | report_servicerest.html |