-
Notifications
You must be signed in to change notification settings - Fork 1.8k
commands/.../scorecard: modularize tests and implement weights #994
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
commands/.../scorecard: modularize tests and implement weights #994
Conversation
retryInterval int | ||
} | ||
|
||
type Score struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Godoc
3f2bb45
to
c786e4f
Compare
7e3ea09
to
2af721a
Compare
a26f1e1
to
33984a8
Compare
This PR has been refactored with the new design suggestions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks great, but I'd like to see unification of return types and method receivers as per my comment.
Overall SGTM. Just some nits and perhaps we can add more godocs for all the new structs in |
Whoops, hit the wrong button |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after nit
Unrelated to the scope of this PR but just wanted to make a note on So it's likely that no CSVs will ever fully pass those tests. Perhaps we should make note of that in the Suggestions for these tests to not force users to assign descriptors to all fields. |
Co-Authored-By: AlexNPavel <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I did notice that we're using global variables in a few places (e.g. deploymentName
, proxyPodGlobal
), and I'm wondering if it's possible to eliminate more of them. I don't think that's necessary in this PR, but something to think about for a future PR.
} | ||
if err != nil && err != wait.ErrWaitTimeout { | ||
return err | ||
// checkSpec checks that the spec block exists |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this godoc is correct.
func checkStatusUpdate(runtimeClient client.Client, obj *unstructured.Unstructured) error { | ||
test := scorecardTest{testType: basicOperator, name: "Operator actions are reflected in status", maximumPoints: 1} | ||
err := runtimeClient.Get(context.TODO(), types.NamespacedName{Namespace: obj.GetNamespace(), Name: obj.GetName()}, obj) | ||
// checkStatus checks that the status block exists |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this godoc is correct
} | ||
} | ||
|
||
type WritingIntoCRsHasEffectTest struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Godoc for these types please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM except for godocs and potential layout changes
BasicTestConfig | ||
} | ||
|
||
func NewWritingIntoCRsHasEffectTest(conf BasicTestConfig) *WritingIntoCRsHasEffectTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
godoc for these functions please
} | ||
} | ||
|
||
type WritingIntoCRsHasEffectTest struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have we considered making files for each type with its own run function next to it?
It is a minor layout thing, but will make it easier to find the actual test later one IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be a useful change and make it easier to find things. I think that should be done in a follow up PR though.
Added godocs for all new exported functions, structs, and interface. /cc @shawn-hurley |
Description of the change: This PR defines new structs for: the variables that scorecard tests need access to, scores, tests, and test suites. It defines each test and test suite using these new structs and now weights the tests based on how important they should be in the final score. It also splits
checkSpecAndStat
(as that was acutally 2 separate tests plus a readiness checker) and moves the readiness checking functionality into its own function.Motivation for the change: Closes #960