diff --git a/plugin/ipam/cni.go b/plugin/ipam/cni.go index a5d407b8..4c9a45a8 100644 --- a/plugin/ipam/cni.go +++ b/plugin/ipam/cni.go @@ -27,6 +27,9 @@ func (i *Ipam) Allocate(args *skel.CmdArgs) (*types.Result, error) { conf = &ipamConf{} } containerID := args.ContainerID + if containerID == "" { + return nil, fmt.Errorf("Weave CNI Allocate: blank container name") + } var ipnet *net.IPNet if conf.Subnet == "" { diff --git a/test/830_cni_plugin_test.sh b/test/830_cni_plugin_test.sh index 4631d97b..07aa6cf6 100755 --- a/test/830_cni_plugin_test.sh +++ b/test/830_cni_plugin_test.sh @@ -4,34 +4,37 @@ start_suite "Test CNI plugin" -coverage_args() { - # no coverage reporting for now; but when the plugin binary has - # been built for coverage reporting we need to prevent it from - # complaining about the non-coverage args. - [ -n "$COVERAGE" ] && echo "--" -} - cni_connect() { pid=$(container_pid $1 $2) - docker_on $1 run --rm --privileged --net=host --pid=host -i \ - -e CNI_VERSION=1 -e CNI_COMMAND=ADD -e CNI_CONTAINERID=c1 \ - -e CNI_NETNS=/proc/$pid/ns/net -e CNI_IFNAME=eth0 -e CNI_PATH=/opt/cni/bin \ - weaveworks/plugin:latest $(coverage_args) --cni-net </dev/null -cni_connect $HOST1 c2 >/dev/null +cni_connect $HOST1 c1 <"$1" <