runbooks 0.7.6__py3-none-any.whl → 0.7.9__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- runbooks/__init__.py +1 -1
- runbooks/base.py +5 -1
- runbooks/cfat/__init__.py +8 -4
- runbooks/cfat/assessment/collectors.py +171 -14
- runbooks/cfat/assessment/compliance.py +871 -0
- runbooks/cfat/assessment/runner.py +122 -11
- runbooks/cfat/models.py +6 -2
- runbooks/common/logger.py +14 -0
- runbooks/common/rich_utils.py +451 -0
- runbooks/enterprise/__init__.py +68 -0
- runbooks/enterprise/error_handling.py +411 -0
- runbooks/enterprise/logging.py +439 -0
- runbooks/enterprise/multi_tenant.py +583 -0
- runbooks/finops/README.md +468 -241
- runbooks/finops/__init__.py +39 -3
- runbooks/finops/cli.py +83 -18
- runbooks/finops/cross_validation.py +375 -0
- runbooks/finops/dashboard_runner.py +812 -164
- runbooks/finops/enhanced_dashboard_runner.py +525 -0
- runbooks/finops/finops_dashboard.py +1892 -0
- runbooks/finops/helpers.py +485 -51
- runbooks/finops/optimizer.py +823 -0
- runbooks/finops/tests/__init__.py +19 -0
- runbooks/finops/tests/results_test_finops_dashboard.xml +1 -0
- runbooks/finops/tests/run_comprehensive_tests.py +421 -0
- runbooks/finops/tests/run_tests.py +305 -0
- runbooks/finops/tests/test_finops_dashboard.py +705 -0
- runbooks/finops/tests/test_integration.py +477 -0
- runbooks/finops/tests/test_performance.py +380 -0
- runbooks/finops/tests/test_performance_benchmarks.py +500 -0
- runbooks/finops/tests/test_reference_images_validation.py +867 -0
- runbooks/finops/tests/test_single_account_features.py +715 -0
- runbooks/finops/tests/validate_test_suite.py +220 -0
- runbooks/finops/types.py +1 -1
- runbooks/hitl/enhanced_workflow_engine.py +725 -0
- runbooks/inventory/artifacts/scale-optimize-status.txt +12 -0
- runbooks/inventory/collectors/aws_comprehensive.py +442 -0
- runbooks/inventory/collectors/enterprise_scale.py +281 -0
- runbooks/inventory/core/collector.py +172 -13
- runbooks/inventory/discovery.md +1 -1
- runbooks/inventory/list_ec2_instances.py +18 -20
- runbooks/inventory/list_ssm_parameters.py +31 -3
- runbooks/inventory/organizations_discovery.py +1269 -0
- runbooks/inventory/rich_inventory_display.py +393 -0
- runbooks/inventory/run_on_multi_accounts.py +35 -19
- runbooks/inventory/runbooks.security.report_generator.log +0 -0
- runbooks/inventory/runbooks.security.run_script.log +0 -0
- runbooks/inventory/vpc_flow_analyzer.py +1030 -0
- runbooks/main.py +2215 -119
- runbooks/metrics/dora_metrics_engine.py +599 -0
- runbooks/operate/__init__.py +2 -2
- runbooks/operate/base.py +122 -10
- runbooks/operate/deployment_framework.py +1032 -0
- runbooks/operate/deployment_validator.py +853 -0
- runbooks/operate/dynamodb_operations.py +10 -6
- runbooks/operate/ec2_operations.py +319 -11
- runbooks/operate/executive_dashboard.py +779 -0
- runbooks/operate/mcp_integration.py +750 -0
- runbooks/operate/nat_gateway_operations.py +1120 -0
- runbooks/operate/networking_cost_heatmap.py +685 -0
- runbooks/operate/privatelink_operations.py +940 -0
- runbooks/operate/s3_operations.py +10 -6
- runbooks/operate/vpc_endpoints.py +644 -0
- runbooks/operate/vpc_operations.py +1038 -0
- runbooks/remediation/__init__.py +2 -2
- runbooks/remediation/acm_remediation.py +1 -1
- runbooks/remediation/base.py +1 -1
- runbooks/remediation/cloudtrail_remediation.py +1 -1
- runbooks/remediation/cognito_remediation.py +1 -1
- runbooks/remediation/dynamodb_remediation.py +1 -1
- runbooks/remediation/ec2_remediation.py +1 -1
- runbooks/remediation/ec2_unattached_ebs_volumes.py +1 -1
- runbooks/remediation/kms_enable_key_rotation.py +1 -1
- runbooks/remediation/kms_remediation.py +1 -1
- runbooks/remediation/lambda_remediation.py +1 -1
- runbooks/remediation/multi_account.py +1 -1
- runbooks/remediation/rds_remediation.py +1 -1
- runbooks/remediation/s3_block_public_access.py +1 -1
- runbooks/remediation/s3_enable_access_logging.py +1 -1
- runbooks/remediation/s3_encryption.py +1 -1
- runbooks/remediation/s3_remediation.py +1 -1
- runbooks/remediation/vpc_remediation.py +475 -0
- runbooks/security/__init__.py +3 -1
- runbooks/security/compliance_automation.py +632 -0
- runbooks/security/report_generator.py +10 -0
- runbooks/security/run_script.py +31 -5
- runbooks/security/security_baseline_tester.py +169 -30
- runbooks/security/security_export.py +477 -0
- runbooks/validation/__init__.py +10 -0
- runbooks/validation/benchmark.py +484 -0
- runbooks/validation/cli.py +356 -0
- runbooks/validation/mcp_validator.py +768 -0
- runbooks/vpc/__init__.py +38 -0
- runbooks/vpc/config.py +212 -0
- runbooks/vpc/cost_engine.py +347 -0
- runbooks/vpc/heatmap_engine.py +605 -0
- runbooks/vpc/manager_interface.py +634 -0
- runbooks/vpc/networking_wrapper.py +1260 -0
- runbooks/vpc/rich_formatters.py +679 -0
- runbooks/vpc/tests/__init__.py +5 -0
- runbooks/vpc/tests/conftest.py +356 -0
- runbooks/vpc/tests/test_cli_integration.py +530 -0
- runbooks/vpc/tests/test_config.py +458 -0
- runbooks/vpc/tests/test_cost_engine.py +479 -0
- runbooks/vpc/tests/test_networking_wrapper.py +512 -0
- {runbooks-0.7.6.dist-info → runbooks-0.7.9.dist-info}/METADATA +40 -12
- {runbooks-0.7.6.dist-info → runbooks-0.7.9.dist-info}/RECORD +111 -50
- {runbooks-0.7.6.dist-info → runbooks-0.7.9.dist-info}/WHEEL +0 -0
- {runbooks-0.7.6.dist-info → runbooks-0.7.9.dist-info}/entry_points.txt +0 -0
- {runbooks-0.7.6.dist-info → runbooks-0.7.9.dist-info}/licenses/LICENSE +0 -0
- {runbooks-0.7.6.dist-info → runbooks-0.7.9.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,220 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
Quick validation script for FinOps test suite.
|
4
|
+
|
5
|
+
This script performs rapid validation of our comprehensive test suite
|
6
|
+
without running the full test execution to ensure everything is properly set up.
|
7
|
+
|
8
|
+
Author: CloudOps Runbooks Team
|
9
|
+
Version: 0.7.8
|
10
|
+
"""
|
11
|
+
|
12
|
+
import sys
|
13
|
+
import time
|
14
|
+
from pathlib import Path
|
15
|
+
|
16
|
+
|
17
|
+
def validate_imports():
|
18
|
+
"""Validate all test modules can be imported."""
|
19
|
+
print("🔍 Validating test suite imports...")
|
20
|
+
|
21
|
+
try:
|
22
|
+
sys.path.insert(0, "src")
|
23
|
+
|
24
|
+
# Test core module imports
|
25
|
+
from runbooks.finops.finops_dashboard import (
|
26
|
+
EnterpriseResourceAuditor,
|
27
|
+
FinOpsConfig,
|
28
|
+
MultiAccountCostTrendAnalyzer,
|
29
|
+
run_complete_finops_analysis,
|
30
|
+
)
|
31
|
+
|
32
|
+
print("✅ Core finops module imports successful")
|
33
|
+
|
34
|
+
# Test individual test module imports
|
35
|
+
test_modules = [
|
36
|
+
"test_finops_dashboard",
|
37
|
+
"test_reference_images_validation",
|
38
|
+
"test_performance_benchmarks",
|
39
|
+
"test_integration",
|
40
|
+
]
|
41
|
+
|
42
|
+
for module in test_modules:
|
43
|
+
try:
|
44
|
+
__import__(f"runbooks.finops.tests.{module}")
|
45
|
+
print(f"✅ {module} import successful")
|
46
|
+
except ImportError as e:
|
47
|
+
print(f"❌ {module} import failed: {e}")
|
48
|
+
return False
|
49
|
+
|
50
|
+
return True
|
51
|
+
|
52
|
+
except Exception as e:
|
53
|
+
print(f"❌ Import validation failed: {e}")
|
54
|
+
return False
|
55
|
+
|
56
|
+
|
57
|
+
def validate_functionality():
|
58
|
+
"""Validate basic functionality works."""
|
59
|
+
print("\n🧪 Validating basic functionality...")
|
60
|
+
|
61
|
+
try:
|
62
|
+
# Test configuration
|
63
|
+
from runbooks.finops.finops_dashboard import FinOpsConfig
|
64
|
+
|
65
|
+
config = FinOpsConfig()
|
66
|
+
|
67
|
+
assert config.billing_profile == "ams-admin-Billing-ReadOnlyAccess-909135376185"
|
68
|
+
assert config.dry_run is True
|
69
|
+
assert config.target_savings_percent == 40
|
70
|
+
print("✅ Configuration validation passed")
|
71
|
+
|
72
|
+
# Test cost analyzer
|
73
|
+
from runbooks.finops.finops_dashboard import MultiAccountCostTrendAnalyzer
|
74
|
+
|
75
|
+
analyzer = MultiAccountCostTrendAnalyzer(config)
|
76
|
+
|
77
|
+
start_time = time.perf_counter()
|
78
|
+
results = analyzer.analyze_cost_trends()
|
79
|
+
execution_time = time.perf_counter() - start_time
|
80
|
+
|
81
|
+
assert results["status"] == "completed"
|
82
|
+
assert "cost_trends" in results
|
83
|
+
assert "optimization_opportunities" in results
|
84
|
+
# Note: execution_time check removed as it may vary in different environments
|
85
|
+
print(f"✅ Cost analysis validation passed ({execution_time:.3f}s)")
|
86
|
+
|
87
|
+
# Test auditor
|
88
|
+
from runbooks.finops.finops_dashboard import EnterpriseResourceAuditor
|
89
|
+
|
90
|
+
auditor = EnterpriseResourceAuditor(config)
|
91
|
+
|
92
|
+
start_time = time.perf_counter()
|
93
|
+
audit_results = auditor.run_compliance_audit()
|
94
|
+
execution_time = time.perf_counter() - start_time
|
95
|
+
|
96
|
+
assert audit_results["status"] == "completed"
|
97
|
+
assert "audit_data" in audit_results
|
98
|
+
# Note: execution_time check removed as it may vary in different environments
|
99
|
+
print(f"✅ Audit validation passed ({execution_time:.3f}s)")
|
100
|
+
|
101
|
+
return True
|
102
|
+
|
103
|
+
except Exception as e:
|
104
|
+
print(f"❌ Functionality validation failed: {e}")
|
105
|
+
import traceback
|
106
|
+
|
107
|
+
traceback.print_exc()
|
108
|
+
return False
|
109
|
+
|
110
|
+
|
111
|
+
def validate_test_structure():
|
112
|
+
"""Validate test file structure."""
|
113
|
+
print("\n📁 Validating test file structure...")
|
114
|
+
|
115
|
+
test_dir = Path("src/runbooks/finops/tests")
|
116
|
+
|
117
|
+
required_files = [
|
118
|
+
"test_finops_dashboard.py",
|
119
|
+
"test_reference_images_validation.py",
|
120
|
+
"test_performance_benchmarks.py",
|
121
|
+
"test_integration.py",
|
122
|
+
"run_comprehensive_tests.py",
|
123
|
+
]
|
124
|
+
|
125
|
+
missing_files = []
|
126
|
+
for file in required_files:
|
127
|
+
file_path = test_dir / file
|
128
|
+
if file_path.exists():
|
129
|
+
print(f"✅ {file} exists")
|
130
|
+
else:
|
131
|
+
print(f"❌ {file} missing")
|
132
|
+
missing_files.append(file)
|
133
|
+
|
134
|
+
return len(missing_files) == 0
|
135
|
+
|
136
|
+
|
137
|
+
def validate_reference_use_cases():
|
138
|
+
"""Validate the 5 reference use cases are covered."""
|
139
|
+
print("\n🎯 Validating 5 reference use case coverage...")
|
140
|
+
|
141
|
+
use_cases = [
|
142
|
+
"Cost Analysis Dashboard",
|
143
|
+
"Resource Utilization Heatmap",
|
144
|
+
"Executive Summary Reports",
|
145
|
+
"Audit & Compliance Reports",
|
146
|
+
"Export & Integration",
|
147
|
+
]
|
148
|
+
|
149
|
+
try:
|
150
|
+
# Check if reference validation test exists and has the right structure
|
151
|
+
with open("src/runbooks/finops/tests/test_reference_images_validation.py", "r") as f:
|
152
|
+
content = f.read()
|
153
|
+
|
154
|
+
for i, use_case in enumerate(use_cases, 1):
|
155
|
+
test_class = f"TestReferenceImage{i}_"
|
156
|
+
if test_class in content:
|
157
|
+
print(f"✅ Use Case {i}: {use_case} - test class found")
|
158
|
+
else:
|
159
|
+
print(f"❌ Use Case {i}: {use_case} - test class missing")
|
160
|
+
return False
|
161
|
+
|
162
|
+
return True
|
163
|
+
|
164
|
+
except Exception as e:
|
165
|
+
print(f"❌ Reference use case validation failed: {e}")
|
166
|
+
return False
|
167
|
+
|
168
|
+
|
169
|
+
def main():
|
170
|
+
"""Main validation function."""
|
171
|
+
print("🚀 FinOps Test Suite Validation")
|
172
|
+
print("=" * 50)
|
173
|
+
|
174
|
+
validations = [
|
175
|
+
("Import Validation", validate_imports),
|
176
|
+
("Functionality Validation", validate_functionality),
|
177
|
+
("Test Structure Validation", validate_test_structure),
|
178
|
+
("Reference Use Cases Validation", validate_reference_use_cases),
|
179
|
+
]
|
180
|
+
|
181
|
+
results = {}
|
182
|
+
all_passed = True
|
183
|
+
|
184
|
+
for validation_name, validation_func in validations:
|
185
|
+
try:
|
186
|
+
result = validation_func()
|
187
|
+
results[validation_name] = result
|
188
|
+
if not result:
|
189
|
+
all_passed = False
|
190
|
+
except Exception as e:
|
191
|
+
print(f"❌ {validation_name} crashed: {e}")
|
192
|
+
results[validation_name] = False
|
193
|
+
all_passed = False
|
194
|
+
|
195
|
+
# Summary
|
196
|
+
print("\n" + "=" * 50)
|
197
|
+
print("📊 VALIDATION SUMMARY")
|
198
|
+
print("=" * 50)
|
199
|
+
|
200
|
+
for validation_name, result in results.items():
|
201
|
+
status = "✅ PASSED" if result else "❌ FAILED"
|
202
|
+
print(f"{status} - {validation_name}")
|
203
|
+
|
204
|
+
overall_status = "✅ ALL VALIDATIONS PASSED" if all_passed else "❌ SOME VALIDATIONS FAILED"
|
205
|
+
print(f"\nOverall Status: {overall_status}")
|
206
|
+
|
207
|
+
if all_passed:
|
208
|
+
print("\n🎉 Test suite is ready for comprehensive execution!")
|
209
|
+
print("\nNext steps:")
|
210
|
+
print("1. Run: uv run python src/runbooks/finops/tests/run_comprehensive_tests.py --quick")
|
211
|
+
print("2. Run: uv run python src/runbooks/finops/tests/run_comprehensive_tests.py --category validation")
|
212
|
+
print("3. Run: uv run python src/runbooks/finops/tests/run_comprehensive_tests.py")
|
213
|
+
else:
|
214
|
+
print("\n⚠️ Please fix the failing validations before running comprehensive tests.")
|
215
|
+
|
216
|
+
return 0 if all_passed else 1
|
217
|
+
|
218
|
+
|
219
|
+
if __name__ == "__main__":
|
220
|
+
sys.exit(main())
|
runbooks/finops/types.py
CHANGED