mirror of https://github.com/docker/docs.git
				
				
				
			Add basic integration tests for plugins.
Signed-off-by: Anusha Ragunathan <anusha@docker.com> (cherry picked from commit a2d48c9e4e2abadcba582de47891837b0a80b24c)
This commit is contained in:
		
							parent
							
								
									c82f23095a
								
							
						
					
					
						commit
						3e44703cae
					
				| 
						 | 
				
			
			@ -31,7 +31,7 @@ func newInstallCommand(dockerCli *client.DockerCli) *cobra.Command {
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	flags := cmd.Flags()
 | 
			
		||||
	flags.BoolVar(&options.grantPerms, "grant-permissions", true, "grant all permissions necessary to run the plugin")
 | 
			
		||||
	flags.BoolVar(&options.grantPerms, "grant-all-permissions", true, "grant all permissions necessary to run the plugin")
 | 
			
		||||
 | 
			
		||||
	return cmd
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,36 @@
 | 
			
		|||
package main
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"github.com/docker/docker/pkg/integration/checker"
 | 
			
		||||
	"github.com/go-check/check"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func (s *DockerSuite) TestPluginBasicOps(c *check.C) {
 | 
			
		||||
	testRequires(c, DaemonIsLinux, ExperimentalDaemon)
 | 
			
		||||
	name := "tiborvass/no-remove"
 | 
			
		||||
	tag := "latest"
 | 
			
		||||
	nameWithTag := name + ":" + tag
 | 
			
		||||
 | 
			
		||||
	_, _, err := dockerCmdWithError("plugin", "install", name)
 | 
			
		||||
	c.Assert(err, checker.IsNil)
 | 
			
		||||
 | 
			
		||||
	out, _, err := dockerCmdWithError("plugin", "ls")
 | 
			
		||||
	c.Assert(err, checker.IsNil)
 | 
			
		||||
	c.Assert(out, checker.Contains, name)
 | 
			
		||||
	c.Assert(out, checker.Contains, tag)
 | 
			
		||||
	c.Assert(out, checker.Contains, "true")
 | 
			
		||||
 | 
			
		||||
	out, _, err = dockerCmdWithError("plugin", "inspect", nameWithTag)
 | 
			
		||||
	c.Assert(err, checker.IsNil)
 | 
			
		||||
	c.Assert(out, checker.Contains, "A test plugin for Docker")
 | 
			
		||||
 | 
			
		||||
	out, _, err = dockerCmdWithError("plugin", "remove", nameWithTag)
 | 
			
		||||
	c.Assert(out, checker.Contains, "is active")
 | 
			
		||||
 | 
			
		||||
	_, _, err = dockerCmdWithError("plugin", "disable", nameWithTag)
 | 
			
		||||
	c.Assert(err, checker.IsNil)
 | 
			
		||||
 | 
			
		||||
	out, _, err = dockerCmdWithError("plugin", "remove", nameWithTag)
 | 
			
		||||
	c.Assert(err, checker.IsNil)
 | 
			
		||||
	c.Assert(out, checker.Contains, nameWithTag)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -30,6 +30,10 @@ var (
 | 
			
		|||
		func() bool { return daemonPlatform == "linux" },
 | 
			
		||||
		"Test requires a Linux daemon",
 | 
			
		||||
	}
 | 
			
		||||
	ExperimentalDaemon = testRequirement{
 | 
			
		||||
		func() bool { return utils.ExperimentalBuild() },
 | 
			
		||||
		"Test requires an experimental daemon",
 | 
			
		||||
	}
 | 
			
		||||
	NotExperimentalDaemon = testRequirement{
 | 
			
		||||
		func() bool { return !utils.ExperimentalBuild() },
 | 
			
		||||
		"Test requires a non experimental daemon",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue