File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ bundle agent main
2+ {
3+ reports:
4+ "Hello, world!";
5+ }
Original file line number Diff line number Diff line change 1+
2+ "Hello, CFEngine"
3+ ifvarclass => "cfengine";
4+ ^--------^
5+ Deprecation: Use 'if' instead of 'ifvarclass' at tests/lint/002_ifvarclass.x.cf:5:7
6+ FAIL: tests/lint/002_ifvarclass.x.cf (1 errors)
7+ Failure, 1 errors in total.
Original file line number Diff line number Diff line change 1+ bundle agent main
2+ {
3+ reports:
4+ "Hello, CFEngine"
5+ ifvarclass => "cfengine";
6+ }
Original file line number Diff line number Diff line change 1+ # /usr/bin/env bash
2+
3+ set -e
4+ # set -x
5+
6+ echo " These tests expect cfengine CLI to be installed globally or in venv"
7+
8+ echo " Looking for CFEngine CLI:"
9+ which cfengine
10+
11+ echo " Check that test files are in expected location:"
12+ ls -al tests/lint/* .cf
13+
14+ mkdir -p tmp
15+
16+ echo " Run lint tests:"
17+ for file in tests/lint/* .cf; do
18+ if echo " $file " | grep -q ' \.x\.cf$' ; then
19+ # File ends with .x.cf, we expect it to:
20+ # - Fail (non-zero exit code)
21+ # - Output the correct error message
22+
23+ expected=" $( echo $file | sed ' s/\.x\.cf$/.output.txt/' ) "
24+ if [ ! -f " $expected " ]; then
25+ echo " FAIL: Missing expected output file: $expected "
26+ exit 1
27+ fi
28+ output=" tmp/$( basename $file .x.cf) .lint-output.txt"
29+ if cfengine lint " $file " > " $output " 2>&1 ; then
30+ echo " FAIL: $file - expected lint failure but got success"
31+ exit 1
32+ fi
33+ diff -u " $expected " " $output "
34+ echo " OK (expected failure): $file "
35+ else
36+ # Expect success
37+ if ! cfengine lint " $file " ; then
38+ echo " FAIL: $file - expected lint success but got failure"
39+ exit 1
40+ fi
41+ echo " OK: $file "
42+ fi
43+ done
44+
45+ echo " All lint tests successful!"
You can’t perform that action at this time.
0 commit comments