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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is essentially checking that the current node matches the first node. Do we know that the first node will always be upgraded first or should we make this check a separate loop where we verify all of the nodes' desiredConfigs match (or I guess we could still use this loop with a bit different logic)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A. No, we don't know that the first node will be first.
B. This code supposes to check that :
* desiredConfig is equal to currentConfig for each node
and
So, If desiredConfig != currentConfig for one of the nodes, we'll fail because of the first condition in the if statement.
And the second condition in the if statement verifies that all the nodes has the same desiredConfig.
I used the below logic to verify that all nodes has the same desiredConfig.
Assuming that we have an array of N (0 - N-1) numbers and we need to check if all values of the array are equal.
So, if for each i between 1 to N-1 Arr[i] == Arr[0] that means that all array members are equal (because whenever x = y and y = z, then also x = z )
Let me know if you still think I should change/update something in this statement
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, right. This does check that they're all equal. Oops. :-)