Skip to content
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

Verifier for tasks and plans #1224

Merged
merged 2 commits into from
Dec 30, 2019
Merged

Verifier for tasks and plans #1224

merged 2 commits into from
Dec 30, 2019

Conversation

kensipe
Copy link
Member

@kensipe kensipe commented Dec 24, 2019

Signed-off-by: Ken Sipe kensipe@gmail.com

What this PR does / why we need it:

Realized with lots of work on operators and skeleton generators that we could use verification on plan tasks and defined tasks since they are loosely coupled by name.

This PR provides a new "PlanVerifier" which provides warnings for tasks that are defined but are not used in a plan and an error for tasks in a plan that are not defined.

Fixes #

Signed-off-by: Ken Sipe <kensipe@gmail.com>
@kensipe
Copy link
Member Author

kensipe commented Dec 24, 2019

needs some tests but otherwise good to go

Copy link
Contributor

@alenkacz alenkacz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a bit better structure in the code (see my comment) + the tests as you said, otherwise it should be ready to go

@@ -12,6 +12,7 @@ import (
var verifiers = []verifier.PackageVerifier{
DuplicateVerifier{},
InvalidCharVerifier{";,"},
PlanVerifier{},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels very similar to ReferenceVerifier, shouldn't these two be one thing? Or at least be structured in the same way? This one lives directly in this file while the other is in templates package. Also this is also checking references, so if we keep them separate we should probably think about better names - like TasksVerifier and TemplateVerifier?

Copy link
Member Author

@kensipe kensipe Dec 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah... the Param and Reference verifiers are in separate packages to completely encapsulate templating (which is something we don't control). any changes (however unlikely) are encapsulated from this package of verifying.

Plan verifying is wholly managed by our code. It has completely different concerns. All other project verifiers are here so I didn't originally see any reason to move it.

re: "this feels very similar to ReferenceVerifier". That seems confusing to me... the only thing that makes sense to me is naming... I'll look at that. However "ReferenceVerifier" is "template.ReferenceVerifier" which is the verifier to check template references. The "PlanVerifier" is written to verify the operator plans. however it really is a Task Reference Verifier.

While I'm inclined to leave the verifier here as noted above... perhaps for consistency moving it to "task.ReferenceVerifier" would make sense. It isn't necessary for encapsulation IMO but it doesn't hurt... and provides readability.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved to task.ReferenceVerifier

Signed-off-by: Ken Sipe <kensipe@gmail.com>
Copy link
Contributor

@alenkacz alenkacz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! :) thanks

@kensipe kensipe merged commit 343696a into master Dec 30, 2019
@kensipe kensipe deleted the ken/task-verify branch December 30, 2019 18:19
ANeumann82 pushed a commit that referenced this pull request Feb 13, 2020
Signed-off-by: Ken Sipe <kensipe@gmail.com>
Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants