-
Notifications
You must be signed in to change notification settings - Fork 16
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
feat: add converge to field
step which improves upon converge to selector
#168
feat: add converge to field
step which improves upon converge to selector
#168
Conversation
Signed-off-by: Dillen Padhiar <[email protected]>
Signed-off-by: Dillen Padhiar <[email protected]>
Signed-off-by: Dillen Padhiar <[email protected]>
Signed-off-by: Dillen Padhiar <[email protected]>
Signed-off-by: Dillen Padhiar <[email protected]>
converge to selector
commandconverge to field
step which improves upon converge to selector
@dpadhiar thank you for the contribution! |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #168 +/- ##
==========================================
- Coverage 44.86% 43.88% -0.99%
==========================================
Files 19 19
Lines 2309 2388 +79
==========================================
+ Hits 1036 1048 +12
- Misses 1155 1217 +62
- Partials 118 123 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: Dillen Padhiar <[email protected]>
Signed-off-by: Dillen Padhiar <[email protected]>
Currently the
converge to selector
syntax for a step in a feature file does not accommodate for two cases that came up in our testing:key=value
selector)This pull requests adds support for both of these cases by incorporating a new step:
ResourceShouldConvergeToField
For managing arrays in a path, I was able to work with a colleague @afugazzotto who has previously added a similar function to the Numaplane open source project.
Here is the function that the solution in this pull request is based on which is used in Numaplane to get the full path to a field in a Kubernetes resource.
The function takes
data
as the resource andpath
as thekey
value of our selector which is a path to our field we want to check. It recurses after moving down each field of the path and to accommodate for arrays, we check if the current field contains the[
character which tells us that it is an array. After doing so, we can isolate the index value and recurse on the array[index] value. There are new unit test cases created for the newResourceShouldConvergeToField
function test to show this new functionality.After getting the value from
ExtractField
, we need to check what type it is to accurately check it against a string or integer.Once we know the type of the returned value, we will convert our value from the selector to an integer if needed or continue as a string.