Add unit tests across the project#363
Merged
ArangoGutierrez merged 1 commit intoNVIDIA:mainfrom May 21, 2025
Merged
Conversation
Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces comprehensive unit tests across multiple packages to ensure functionality and reliability of YAML/JSON marshaling, provider interfaces, dependency resolution, dry-run validations, and container runtime templates. The changes focus on improving test coverage and validating different configurations and edge cases.
Testing for YAML/JSON marshaling and unmarshaling:
pkg/jyaml/jyaml_test.goto validateMarshalJSON,MarshalJSONIndent,MarshalYAML,Unmarshal,UnmarshalStrict, andUnmarshalFromFilefunctions, including scenarios with invalid data and strict mode validation.Mocking and testing provider interfaces:
MockProviderinpkg/provider/provider_test.goto test theProviderinterface, including methods likeCreate,Delete,DryRun,Status, andUpdateResourcesTags. Added test cases for both successful and error scenarios.Dependency resolution testing:
pkg/provisioner/dependency_test.goforNewDependenciesand its methods (withKubernetes,withContainerRuntime, etc.), as well as theResolvemethod to validate dependency resolution logic.Dry-run validation:
pkg/provisioner/dryrun_test.goto validate configurations for Kubernetes versions and container runtimes, including both valid and invalid scenarios.Container runtime template testing:
pkg/provisioner/templates/container-toolkit_test.go: Added tests forNewContainerToolkitand itsExecutemethod to validate default and custom configurations.pkg/provisioner/templates/containerd_test.go: Added tests forNewContainerdand itsExecutemethod, ensuring correct version handling and configuration commands.pkg/provisioner/templates/crio_test.go: Added tests forNewCriOand itsExecutemethod to validate CRI-O installation and service start commands.pkg/provisioner/templates/docker_test.go: Added tests forNewDockerand itsExecutemethod to validate Docker versioning and service enablement.