Dev/andres/master req#148
Merged
Merged
Conversation
…onality - Implemented unit tests for OpenShift client, provider, publication, and service functionalities. - Added serialization tests for user services and providers to ensure data integrity during serialization and deserialization. - Created tests for VM lifecycle operations, including creation, deletion, and state checks. - Enhanced test coverage for service availability and error handling scenarios. - Introduced fixed user service tests to validate assignment and operational methods. - Ensured all tests are structured to handle various edge cases and provide meaningful assertions.
…nto dev/janier/master
- Updated serialization tests for OpenshiftProvider to ensure correct method behavior after serialization. - Enhanced publication serialization tests, adding checks for autoserializable fields and marshaling. - Reorganized service tests to group by functionality, including configuration, utility methods, availability, VM operations, and exception handling. - Added detailed tests for VM creation, deletion, and cancellation operations in the deployment context. - Introduced fixed user service tests to validate lifecycle and operation behaviors. - Removed outdated user service fixed tests and consolidated relevant functionality into new structured tests. - Added serialization tests for fixed user service to ensure data integrity during serialization and deserialization.
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 refactors the OpenShift client code to standardize and simplify how HTTP requests are made to the OpenShift/KubeVirt APIs. It replaces direct usage of the
requestslibrary with a centralizeddo_requestmethod, improving error handling and code maintainability. Additionally, it updates the VM name sanitization logic to be more robust and RFC 1123-compliant, and removes some unused or redundant methods.The most important changes are:
HTTP Request Handling Refactor:
Replaced all direct
requests.get,requests.post,requests.patch, andrequests.deletecalls inopenshift/client.pywith calls to a unifiedself.do_requestmethod, greatly reducing duplicate code and centralizing error handling for API interactions. This affects all VM, DataVolume, and PVC operations. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]Improved error handling: API errors are now caught and logged with exception details, and custom exceptions like
OpenshiftNotFoundErrorare handled where appropriate. [1] [2] [3] [4] [5] [6]Code Cleanup and Simplification:
token) and redundant or unused methods such asclone_vm_instanceandvalidate_vm_idfromopenshift/client.py, streamlining the codebase. [1] [2]VM Name Sanitization:
sanitized_namemethod inprovider.pyto more robustly enforce RFC 1123 compliance: converts to lowercase, replaces invalid characters, collapses multiple dashes, trims leading/trailing non-alphanumeric characters, and limits the length to 63 characters.