Avoid nil Allocator in controlapi#2240
Merged
aaronlehmann merged 2 commits intomoby:masterfrom Jun 12, 2017
Merged
Conversation
added 2 commits
June 12, 2017 12:05
At the point at which the controlapi server is created the allocator has not yet been created, and hence is nil. Since CNM is currently the only actual choice do as with `PredefinedNetworks` and hardcode the use of the CNM backend, this will be reworked once there is a second choice. Fixes moby#2230. Add a call to NetworkCreate in TestManager and a test to controlapi specifically to trigger this code path. The latter tests controlapi in isolation, while the former would catch e.g. a race or initialisation order issue in a manager. Also, in controlapi tests, change a `testnet2` into a 3 in `TestRemoveNetwork` to avoid (harmless) duplication. Signed-off-by: Ian Campbell <ian.campbell@docker.com>
I think this is currently benign because ipamapi.PluginEndpointType and driverapi.NetworkPluginEndpointType are the only actual values of pluginType used by callers today. Signed-off-by: Ian Campbell <ian.campbell@docker.com>
Codecov Report
@@ Coverage Diff @@
## master #2240 +/- ##
=========================================
Coverage ? 60.31%
=========================================
Files ? 124
Lines ? 20185
Branches ? 0
=========================================
Hits ? 12175
Misses ? 6654
Partials ? 1356 |
Collaborator
|
LGTM |
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.
At the point at which the controlapi server is created the allocator has not yet been created, and hence is nil.
Since CNM is currently the only actual choice do as with
PredefinedNetworksand hardcode the use of the CNM backend, this will be reworked once there is a second choice.Fixes #2230. Add a call to NetworkCreate in TestManager and a test to controlapi specifically to trigger this code path. The latter tests controlapi in isolation, while the former would catch e.g. a race or initialisation order issue in a manager.
Also, in controlapi tests, change a
testnet2into a 3 inTestRemoveNetworkto avoid (harmless) duplication.Signed-off-by: Ian Campbell ian.campbell@docker.com
Also, only call
IsBuiltInNetworkDriverfor Network plugin type.Replaces #2231.