Skip to content

Commit 2c5604f

Browse files
author
jmccormick2001
committed
add test for label and selector flags for scorecard
1 parent 7313800 commit 2c5604f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

hack/tests/subcommand-scorecard.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,26 @@ then
2828
exit 1
2929
fi
3030

31+
# test to see if list flag work
32+
commandoutput="$(operator-sdk scorecard --version v1alpha2 --list --selector=necessity=required --config "$CONFIG_PATH_V1ALPHA2" 2>&1)"
33+
labelCount=`echo $commandoutput | grep -o "Label" | wc -l`
34+
expectedLabelCount=8
35+
if [ $labelCount -ne $expectedLabelCount ]
36+
then
37+
echo "expected label count $expectedLabelCount, got $labelCount"
38+
exit 1
39+
fi
40+
41+
# test to see if selector flags work
42+
commandoutput="$(operator-sdk scorecard --version v1alpha2 --selector=necessity=required --config "$CONFIG_PATH_V1ALPHA2" 2>&1)"
43+
labelCount=`echo $commandoutput | grep -o "Label" | wc -l`
44+
expectedLabelCount=8
45+
if [ $labelCount -ne $expectedLabelCount ]
46+
then
47+
echo "expected label count $expectedLabelCount, got $labelCount"
48+
exit 1
49+
fi
50+
3151
# test to see if version in config file allows v1alpha1 to be specified
3252
commandoutput="$(operator-sdk scorecard --config "$CONFIG_PATH_V1ALPHA1" 2>&1)"
3353
echo $commandoutput | grep "Total Score: 67%"

0 commit comments

Comments
 (0)