Skip to content

[FEATURE] Add tests covering CRD validation and JSON serialisation #2284

@Tom-Newton

Description

@Tom-Newton

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

What is the outcome that you are trying to reach?

Avoid future bugs similar to what #2255 fixed.

Describe the solution you would like

  • Tests that ensure omitting spec or metadata in the SparkApplication fail CRD validation.
  • Tests that ensure optional fields still pass CRD validation after deserialization and re-serialisation by the validating webhook.

https://github.com/kubeflow/spark-operator/blob/0c49569afb2382738aabfe6ddbf5fddc577a6681/internal/webhook/sparkapplication_defaulter_test.go achieved this but was a kind of strange way to implement it.

Describe alternatives you have considered

No tests - pretty sure we don't want that.

Additional context

This is coming from discussion during PR review #2255 (comment) and I don't want it to get lost.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions