Debian Codegraph @

yaml-filter/tests/test-yamlp.sh

raw symbols SCIP
1 #!/bin/bash
2
3 # SPDX-License-Identifier: MIT
4 # Copyright (c) 2020 Red Hat Inc., Durham, North Carolina.
5
6 yamlp_test()
7 {
8 echo "$1:"
9 echo -n " ($2) "
10 out=$("${BINARY_DIR:-../build}/yamlp" -F -f "$1" "$2") || return 1
11 echo -n "-> $out"
12 if [ "$out" != "$3" ]; then
13 echo ": FAILED, expected result: $3"
14 return 2
15 else
16 echo ": OK"
17 fi
18 }
19
20 yamlp_test "${SOURCE_DIR:-..}/res/openshift-logging.yaml" ".spec.pipelines[:].inputSource" "[logs.app, logs.infra, logs.audit]"
21 res=$((res+$?))
22
23 yamlp_test "${SOURCE_DIR:-..}/res/openshift-upgradeable.yaml" ".status.conditions[:]['status','type']" \
24 '[{status: "False", type: Degraded}, {status: "False", type: Progressing}, {status: "True", type: Available}, {status: "True", type: Upgradeable}]'
25 res=$((res+$?))
26
27 exit $res