-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_dashboard_metadata.py
More file actions
67 lines (51 loc) · 2.32 KB
/
test_dashboard_metadata.py
File metadata and controls
67 lines (51 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env python3
"""Test dashboard metadata catalogs summary."""
import os
import sys
from pathlib import Path
# Add current directory to path
sys.path.insert(0, str(Path(__file__).parent))
from faigate.dashboard import _metadata_catalogs_summary
def main():
"""Test metadata catalogs summary."""
print("Testing dashboard metadata catalogs summary")
print("=" * 60)
# Check if metadata directory is set
metadata_dir = os.environ.get("FAIGATE_PROVIDER_METADATA_DIR", "")
if not metadata_dir:
print("WARNING: FAIGATE_PROVIDER_METADATA_DIR not set")
print("Using default location or built-in fallback")
else:
print(f"Using metadata directory: {metadata_dir}")
# Get summary
summary = _metadata_catalogs_summary()
print("\nOfferings summary:")
print(f" Total: {summary['offerings']['total']}")
print(f" Fresh: {summary['offerings']['freshness']['fresh']}")
print(f" Aging: {summary['offerings']['freshness']['aging']}")
print(f" Stale: {summary['offerings']['freshness']['stale']}")
print(f" Unknown: {summary['offerings']['freshness']['unknown']}")
print("\nPackages summary:")
print(f" Total: {summary['packages']['total']}")
print(f" Expiring soon (≤7 days): {summary['packages']['expiring_soon']}")
print(f" Types: {summary['packages']['types']}")
# Check that counts match what we expect
expected_offerings = 6 # Based on our catalog
expected_packages = 4 # Based on our catalog
if summary["offerings"]["total"] == expected_offerings:
print(f"\n✓ Offerings count matches expected: {expected_offerings}")
else:
print(f"\n✗ Offerings count mismatch: expected {expected_offerings}, got {summary['offerings']['total']}")
if summary["packages"]["total"] == expected_packages:
print(f"✓ Packages count matches expected: {expected_packages}")
else:
print(f"✗ Packages count mismatch: expected {expected_packages}, got {summary['packages']['total']}")
# Check for expiring packages
if summary["packages"]["expiring_soon"] > 0:
print(f"\n⚠️ {summary['packages']['expiring_soon']} package(s) expiring soon")
else:
print("\n✓ No packages expiring soon")
print("\n" + "=" * 60)
print("Test completed")
if __name__ == "__main__":
main()