Files
troubleshoot/scripts/compare_rules.yaml

90 lines
3.6 KiB
YAML

# Comparison rules for regression testing
# Defines how different collector outputs should be compared
# Global configuration (applies to both preflight and supportbundle)
global:
# Files that should be compared exactly (byte-for-byte)
exact_match:
- "static-data.txt/static-data"
# Note: version.yaml is NOT here - versionNumber varies between builds
# Default behavior for unknown files
non_empty_default: true
# Preflight-specific rules
preflight:
# Files that should be compared exactly
exact_match:
- "static-data.txt/static-data"
- "files/example.yaml" # From data collector in v1beta2
- "files/example.json" # From data collector in v1beta2
- "config/replicas.txt" # From data collector in v1beta2
# Note: version.yaml is NOT here - it uses non-empty check (versionNumber varies)
# Files that need structural/field-specific comparison
# Format: "pattern": "comparator_function_name"
structural_compare:
# NOTE: Most collectors are now non-empty checks only
# We're testing that collectors RUN and PRODUCE OUTPUT, not that
# specific environmental values (versions, connection status, image availability) match
# Keep structural comparison only for truly deterministic collectors:
# (Currently none - all moved to non-empty or exact match)
# Everything else uses non-empty check by default
# This tests that collectors RUN and PRODUCE OUTPUT, not environmental state
# This includes:
# - postgres/*.json, mysql/*.json, etc. (connection status varies)
# - dns/debug.json (IPs, pod names vary)
# - registry/*.json (image availability varies)
# - http/*.json (endpoint status varies)
# - cluster-info/*.json (k8s version varies)
# - analysis.json (analyzer results vary with cluster state)
# - cluster-resources/**/*.json (UIDs, timestamps, status vary)
# - node-metrics/**/*.json (all metric values vary)
# - goldpinger/**/*.json (latencies vary)
# - certificates/**/*.json (validity time-based)
# - sysctl/* (some values vary)
# - And everything else...
# Support bundle-specific rules
supportbundle:
# Files that should be compared exactly
exact_match:
- "static-data.txt/static-data"
# Note: version.yaml is NOT here - it uses non-empty check (versionNumber varies)
# Files that need structural comparison
structural_compare:
# NOTE: Like preflight, we only test that collectors produce output
# Environmental state (DB connections, registry access, etc.) will vary
# (Currently none - all moved to non-empty or exact match)
# Everything else uses non-empty check (see list above in preflight section)
# Notes on comparison strategies:
#
# EXACT MATCH:
# - Use for static data that should never change between runs
# - Byte-for-byte comparison
# - Any difference is a regression
#
# STRUCTURAL COMPARISON:
# - Use for semi-deterministic output with consistent structure but variable values
# - Compare specific fields only (e.g., status codes, booleans)
# - Ignore timing-dependent or environment-specific values
#
# NON-EMPTY CHECK (default):
# - Use for highly variable output where exact comparison is impractical
# - Verifies file exists and is not empty
# - For JSON files, also validates JSON is parseable
# - Appropriate for:
# * Kubernetes resources (UIDs, resourceVersions, timestamps)
# * Metrics (all values constantly change)
# * Logs (timestamps, dynamic content)
# * Generated pod/resource names
# * Runtime state (pod status, replica counts)
#
# This strategy catches major regressions (collectors breaking, files missing)
# while avoiding false positives from expected variability.