Skip to content

Commit cdf83af

Browse files
committed
commands/.../scorecard: fix unit test
1 parent ee40142 commit cdf83af

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

commands/operator-sdk/cmd/scorecard/test_definitions.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ func NewOLMTestSuite(conf OLMTestConfig) *TestSuite {
267267
"Test suite checks if an operator's CSV follows best practices",
268268
)
269269

270+
ts.AddTest(NewCRDsHaveValidationTest(conf), 24)
270271
ts.AddTest(NewCRDsHaveResourcesTest(conf), 19)
271272
ts.AddTest(NewAnnotationsContainExamplesTest(conf), 19)
272273
ts.AddTest(NewSpecDescriptorsTest(conf), 19)

commands/operator-sdk/cmd/scorecard/test_definitions_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,17 @@ import "testing"
1919
// TestSuiteWeightsCheck makes sure that the combined weights of all
2020
// the tests in a suite adds up to 100
2121
func TestSuiteWeightsCheck(t *testing.T) {
22+
basicTests := NewBasicTestSuite(BasicTestConfig{})
2223
basicWeight := 0
23-
for _, weight := range BasicTests.weights {
24+
for _, weight := range basicTests.Weights {
2425
basicWeight += weight
2526
}
2627
if basicWeight != 100 {
2728
t.Errorf("Weights of Basic Tests add to %d", basicWeight)
2829
}
30+
olmTests := NewOLMTestSuite(OLMTestConfig{})
2931
OLMWeight := 0
30-
for _, weight := range OLMTests.weights {
32+
for _, weight := range olmTests.Weights {
3133
OLMWeight += weight
3234
}
3335
if OLMWeight != 100 {

hack/tests/scorecard-subcommand.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ commandoutput="$(operator-sdk scorecard \
1818
--proxy-image "$DEST_IMAGE" \
1919
--proxy-pull-policy Never \
2020
2>&1)"
21-
echo $commandoutput | grep "Total Score: 69%"
21+
echo $commandoutput | grep "Total Score: 81%"
2222

2323
# test config file
2424
commandoutput2="$(operator-sdk scorecard \
2525
--proxy-image "$DEST_IMAGE" \
2626
--config "$CONFIG_PATH")"
27-
echo $commandoutput2 | grep "Total Score: 69%"
27+
echo $commandoutput2 | grep "Total Score: 81%"
2828
popd

0 commit comments

Comments
 (0)