Browse code

Basic IT for plugin-v2 network driver

Since the plugin APIs have not changed for local-scoped network drivers
between plugin-v1 and v2, a simple test to validate the bootstrapping
and network creation APIs would suffice.

Any network driver specific API validations are handled independent of
plugin v1 or v2 format.

Using a sample v2 network plugin :
https://github.com/mavenugo/test-docker-netplugin/

Signed-off-by: Madhu Venugopal <madhu@docker.com>

Madhu Venugopal authored on 2016/11/01 07:36:51
Showing 1 changed files
... ...
@@ -768,6 +768,30 @@ func (s *DockerNetworkSuite) TestDockerNetworkDriverOptions(c *check.C) {
768 768
 
769 769
 }
770 770
 
771
+func (s *DockerNetworkSuite) TestDockerPluginV2NetworkDriver(c *check.C) {
772
+	testRequires(c, DaemonIsLinux, ExperimentalDaemon, Network)
773
+
774
+	var (
775
+		npName        = "mavenugo/test-docker-netplugin"
776
+		npTag         = "latest"
777
+		npNameWithTag = npName + ":" + npTag
778
+	)
779
+	_, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", npNameWithTag)
780
+	c.Assert(err, checker.IsNil)
781
+
782
+	out, _, err := dockerCmdWithError("plugin", "ls")
783
+	c.Assert(err, checker.IsNil)
784
+	c.Assert(out, checker.Contains, npName)
785
+	c.Assert(out, checker.Contains, npTag)
786
+	c.Assert(out, checker.Contains, "true")
787
+
788
+	dockerCmd(c, "network", "create", "-d", npNameWithTag, "v2net")
789
+	assertNwIsAvailable(c, "v2net")
790
+	dockerCmd(c, "network", "rm", "v2net")
791
+	assertNwNotAvailable(c, "v2net")
792
+
793
+}
794
+
771 795
 func (s *DockerDaemonSuite) TestDockerNetworkNoDiscoveryDefaultBridgeNetwork(c *check.C) {
772 796
 	testRequires(c, ExecSupport)
773 797
 	// On default bridge network built-in service discovery should not happen