Skip to content

Avoid nil Allocator in controlapi#2240

Merged
aaronlehmann merged 2 commits intomoby:masterfrom
ijc:refactor-IsBuiltInNetworkDriver
Jun 12, 2017
Merged

Avoid nil Allocator in controlapi#2240
aaronlehmann merged 2 commits intomoby:masterfrom
ijc:refactor-IsBuiltInNetworkDriver

Conversation

@ijc
Copy link
Copy Markdown
Contributor

@ijc ijc commented Jun 12, 2017

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 #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

Also, only call IsBuiltInNetworkDriver for Network plugin type.

Replaces #2231.

Ian Campbell 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
Copy link
Copy Markdown

codecov bot commented Jun 12, 2017

Codecov Report

❗ No coverage uploaded for pull request base (master@cd32a7f). Click here to learn what that means.
The diff coverage is 53.33%.

@@            Coverage Diff            @@
##             master    #2240   +/-   ##
=========================================
  Coverage          ?   60.31%           
=========================================
  Files             ?      124           
  Lines             ?    20185           
  Branches          ?        0           
=========================================
  Hits              ?    12175           
  Misses            ?     6654           
  Partials          ?     1356

@aaronlehmann
Copy link
Copy Markdown
Collaborator

LGTM

@aaronlehmann aaronlehmann merged commit ea13d2b into moby:master Jun 12, 2017
@ijc ijc deleted the refactor-IsBuiltInNetworkDriver branch June 12, 2017 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants