Skip to content

Commit b6b2bf8

Browse files
committed
handle node-specific files and multiple report arguments
1 parent ac9a4c9 commit b6b2bf8

3 files changed

Lines changed: 91 additions & 77 deletions

File tree

.github/workflows/regression-test.yaml

Lines changed: 64 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ jobs:
5050
with:
5151
go-version-file: go.mod
5252
cache: true
53+
cache-dependency-path: go.sum
5354

5455
- name: Build binaries
5556
run: |
@@ -67,65 +68,71 @@ jobs:
6768
run: |
6869
pip install pyyaml deepdiff
6970
70-
# 2. EXECUTE SPECS
71-
- name: Run preflight v1beta3 (complex)
71+
# 2. EXECUTE SPECS (in parallel)
72+
- name: Run all specs in parallel
7273
continue-on-error: true
7374
run: |
74-
echo "Running preflight v1beta3 spec with values file..."
75-
./bin/preflight \
76-
examples/preflight/complex-v1beta3.yaml \
77-
--values examples/preflight/values-complex-full.yaml \
78-
--interactive=false \
79-
--format=json \
80-
--output=test/output/preflight-results-v1beta3.json || true
81-
82-
# Find and rename the most recent bundle
83-
BUNDLE=$(ls -t preflightbundle-*.tar.gz 2>/dev/null | head -1)
84-
if [ -n "$BUNDLE" ]; then
85-
echo "Found bundle: $BUNDLE"
86-
mv "$BUNDLE" test/output/preflight-v1beta3-bundle.tar.gz
87-
echo "✓ v1beta3 bundle saved"
88-
else
89-
echo "⚠ No v1beta3 bundle found"
90-
exit 1
91-
fi
92-
93-
- name: Run preflight v1beta2 (all-analyzers)
94-
continue-on-error: true
95-
run: |
96-
echo "Running preflight v1beta2 spec..."
97-
./bin/preflight \
98-
examples/preflight/all-analyzers-v1beta2.yaml \
99-
--interactive=false \
100-
--format=json \
101-
--output=test/output/preflight-results-v1beta2.json || true
102-
103-
# Find and rename the most recent bundle
104-
BUNDLE=$(ls -t preflightbundle-*.tar.gz 2>/dev/null | head -1)
105-
if [ -n "$BUNDLE" ]; then
106-
echo "Found bundle: $BUNDLE"
107-
mv "$BUNDLE" test/output/preflight-v1beta2-bundle.tar.gz
108-
echo "✓ v1beta2 bundle saved"
109-
else
110-
echo "⚠ No v1beta2 bundle found"
111-
exit 1
112-
fi
113-
114-
- name: Run support bundle (all-kubernetes-collectors)
115-
continue-on-error: true
116-
run: |
117-
echo "Running support bundle spec..."
118-
./bin/support-bundle \
119-
examples/collect/host/all-kubernetes-collectors.yaml \
120-
--interactive=false \
121-
--output=test/output/supportbundle.tar.gz || true
122-
123-
if [ -f test/output/supportbundle.tar.gz ]; then
124-
echo "✓ Support bundle saved"
125-
else
126-
echo "⚠ No support bundle found"
127-
exit 1
128-
fi
75+
echo "Running all 3 specs in parallel..."
76+
77+
# Run v1beta3 in background
78+
(
79+
echo "Starting preflight v1beta3..."
80+
./bin/preflight \
81+
examples/preflight/complex-v1beta3.yaml \
82+
--values examples/preflight/values-complex-full.yaml \
83+
--interactive=false \
84+
--format=json \
85+
--output=test/output/preflight-results-v1beta3.json 2>&1 | tee test/output/v1beta3.log || true
86+
87+
BUNDLE=$(ls -t preflightbundle-*.tar.gz 2>/dev/null | head -1)
88+
if [ -n "$BUNDLE" ]; then
89+
mv "$BUNDLE" test/output/preflight-v1beta3-bundle.tar.gz
90+
echo "✓ v1beta3 bundle saved"
91+
fi
92+
) &
93+
PID_V1BETA3=$!
94+
95+
# Run v1beta2 in background
96+
(
97+
echo "Starting preflight v1beta2..."
98+
./bin/preflight \
99+
examples/preflight/all-analyzers-v1beta2.yaml \
100+
--interactive=false \
101+
--format=json \
102+
--output=test/output/preflight-results-v1beta2.json 2>&1 | tee test/output/v1beta2.log || true
103+
104+
BUNDLE=$(ls -t preflightbundle-*.tar.gz 2>/dev/null | head -1)
105+
if [ -n "$BUNDLE" ]; then
106+
mv "$BUNDLE" test/output/preflight-v1beta2-bundle.tar.gz
107+
echo "✓ v1beta2 bundle saved"
108+
fi
109+
) &
110+
PID_V1BETA2=$!
111+
112+
# Run support bundle in background
113+
(
114+
echo "Starting support bundle..."
115+
./bin/support-bundle \
116+
examples/collect/host/all-kubernetes-collectors.yaml \
117+
--interactive=false \
118+
--output=test/output/supportbundle.tar.gz 2>&1 | tee test/output/supportbundle.log || true
119+
120+
if [ -f test/output/supportbundle.tar.gz ]; then
121+
echo "✓ Support bundle saved"
122+
fi
123+
) &
124+
PID_SUPPORTBUNDLE=$!
125+
126+
# Wait for all to complete
127+
echo "Waiting for all specs to complete..."
128+
wait $PID_V1BETA3
129+
wait $PID_V1BETA2
130+
wait $PID_SUPPORTBUNDLE
131+
132+
echo "All specs completed!"
133+
134+
# Verify bundles exist
135+
ls -lh test/output/*.tar.gz || echo "Warning: Some bundles may be missing"
129136
130137
# 3. COMPARE BUNDLES
131138
- name: Compare preflight v1beta3 bundle

scripts/compare_bundles.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ def compare(self, baseline_bundle: str, current_bundle: str) -> bool:
117117
# Filter out optional files that may not exist (previous logs, etc.)
118118
optional_patterns = [
119119
"*-previous.log", # Previous container logs (only exist after restart)
120+
"node-metrics/*.json", # Node IDs vary between clusters
121+
"sysctl/*", # Node IDs vary between clusters
122+
"collectd/rrd/*", # Node IDs vary between clusters
123+
"copy-from-host-example/*", # Node IDs vary between clusters
124+
"run-daemonset-example/*.log", # Node IDs vary between clusters
120125
]
121126

122127
for file in sorted(missing_in_current):

scripts/generate_summary.py

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,33 @@
1414
from typing import List, Dict
1515

1616

17-
def load_reports(report_pattern: str) -> List[Dict]:
18-
"""Load all report JSON files matching pattern."""
17+
def load_reports(report_files: List[str]) -> List[Dict]:
18+
"""Load all report JSON files."""
1919
reports = []
2020

21-
# Handle glob pattern
22-
if '*' in report_pattern:
23-
report_dir = Path(report_pattern).parent
24-
pattern = Path(report_pattern).name
25-
26-
for report_file in sorted(report_dir.glob(pattern)):
21+
for report_file in report_files:
22+
# Handle glob pattern if not already expanded
23+
if '*' in report_file:
24+
report_dir = Path(report_file).parent
25+
pattern = Path(report_file).name
26+
27+
for path in sorted(report_dir.glob(pattern)):
28+
try:
29+
with open(path) as f:
30+
report = json.load(f)
31+
report['_filename'] = path.name
32+
reports.append(report)
33+
except (json.JSONDecodeError, FileNotFoundError) as e:
34+
print(f"Warning: Could not load {path}: {e}", file=sys.stderr)
35+
else:
36+
# Single file
2737
try:
2838
with open(report_file) as f:
2939
report = json.load(f)
30-
report['_filename'] = report_file.name
40+
report['_filename'] = Path(report_file).name
3141
reports.append(report)
3242
except (json.JSONDecodeError, FileNotFoundError) as e:
3343
print(f"Warning: Could not load {report_file}: {e}", file=sys.stderr)
34-
else:
35-
# Single file
36-
try:
37-
with open(report_pattern) as f:
38-
report = json.load(f)
39-
report['_filename'] = Path(report_pattern).name
40-
reports.append(report)
41-
except (json.JSONDecodeError, FileNotFoundError) as e:
42-
print(f"Warning: Could not load {report_pattern}: {e}", file=sys.stderr)
4344

4445
return reports
4546

@@ -233,8 +234,9 @@ def main():
233234
)
234235
parser.add_argument(
235236
"--reports",
237+
nargs='+',
236238
required=True,
237-
help="Report file(s) pattern (e.g., 'test/output/diff-report-*.json')"
239+
help="Report file(s) or pattern (e.g., 'test/output/diff-report-*.json' or multiple files)"
238240
)
239241
parser.add_argument(
240242
"--output-file",
@@ -248,7 +250,7 @@ def main():
248250

249251
args = parser.parse_args()
250252

251-
# Load reports
253+
# Load reports (args.reports is now a list)
252254
reports = load_reports(args.reports)
253255

254256
if not reports:

0 commit comments

Comments
 (0)