mirror of
https://github.com/kolesa-team/pve-purestorage-plugin.git
synced 2026-08-12 21:53:06 -06:00
f9f8eed94b
feat: add Active Cluster support and improve plugin stability ## Major Features ### Active Cluster Support (Experimental) (#42) - Add support for multiple PureStorage arrays in Active Cluster configuration - Automatic volume connection on all arrays for high availability - Configure via comma-separated addresses and tokens ### Pod Quota Limit Support (#69) - Add proper handling of pod quota_limit parameter - Use quota_limit when set, fall back to array capacity when unlimited - Fix capacity reporting for pods with quotas ### Session Token Caching - Implement session token caching in /etc/pve/priv/purestorage/ - Automatic token refresh at 80% of TTL to prevent expiration - In-memory and file-based caching with jitter to prevent thundering herd ### Debug Logging - Add configurable debug logging with 4 levels (0-3) - Support both config parameter and PURESTORAGE_DEBUG environment variable ## Bug Fixes - Fix volume deletion when connected to multiple hosts - Query all connections before destroy - Disconnect from all hosts on all arrays - Prevents "Cannot destroy volume because it is currently connected" error ## CI/CD Improvements - Add workflow_dispatch trigger to checks workflow - Add option to check all files or only changed files - Add comprehensive markdown linting with markdownlint-cli2 ## Testing - Add token caching tests (tests/token_cache_test.pl) - Test token validation, expiration, and race conditions - Test cleanup of expired cache files ## Refactoring (#72) - Refactor volume removal logic to handle multiple host connections - Improve device cleanup sequence (LVM, partitions, multipath) - Extract connection querying logic before volume destruction - Refactor CI/CD workflows for better maintainability and flexibility - Improve error handling and logging throughout the plugin - Enhance Active Cluster support with proper multi-array operations ## Code Formatting - Format all Perl files with perltidy using .perltidyrc configuration - Ensure consistent code style across the codebase - Fix formatting issues in PureStoragePlugin.pm and test files ## Documentation - Update README with new functionality
68 lines
1.7 KiB
Bash
Executable File
68 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
cd "$SCRIPT_DIR/.."
|
|
|
|
echo "==================================="
|
|
echo "PureStorage Plugin Test Suite"
|
|
echo "==================================="
|
|
echo ""
|
|
|
|
# Colors for output
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m' # No Color
|
|
|
|
# Check if Test::More is available
|
|
if ! perl -MTest::More -e 'print "OK\n"' 2>/dev/null | grep -q OK; then
|
|
echo -e "${RED}Error: Test::More module not found${NC}"
|
|
echo "Please install it with: cpan Test::More"
|
|
exit 1
|
|
fi
|
|
|
|
# Check if JSON is available
|
|
if ! perl -MJSON -e 'print "OK\n"' 2>/dev/null | grep -q OK; then
|
|
echo -e "${YELLOW}Warning: JSON module not found${NC}"
|
|
echo "Some tests may fail. Install with: cpan JSON"
|
|
fi
|
|
|
|
echo -e "${GREEN}Running Unit Tests${NC}"
|
|
echo "-----------------------------------"
|
|
|
|
failed_tests=0
|
|
total_tests=0
|
|
|
|
# Run all test files in tests/unit/
|
|
for test_file in tests/unit/*.t; do
|
|
if [ -f "$test_file" ]; then
|
|
total_tests=$((total_tests + 1))
|
|
echo ""
|
|
echo -e "${YELLOW}Running: $(basename $test_file)${NC}"
|
|
|
|
if perl -I. "$test_file"; then
|
|
echo -e "${GREEN}✓ PASS${NC}"
|
|
else
|
|
echo -e "${RED}✗ FAIL${NC}"
|
|
failed_tests=$((failed_tests + 1))
|
|
fi
|
|
fi
|
|
done
|
|
|
|
echo ""
|
|
echo "==================================="
|
|
echo "Test Summary"
|
|
echo "==================================="
|
|
echo "Total tests: $total_tests"
|
|
echo -e "${GREEN}Passed: $((total_tests - failed_tests))${NC}"
|
|
|
|
if [ $failed_tests -gt 0 ]; then
|
|
echo -e "${RED}Failed: $failed_tests${NC}"
|
|
exit 1
|
|
else
|
|
echo -e "${GREEN}All tests passed!${NC}"
|
|
exit 0
|
|
fi
|