`docker plugin remove` didnt actually remove plugin from disk. Fix that.
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
| ... | ... |
@@ -4,6 +4,10 @@ import ( |
| 4 | 4 |
"github.com/docker/docker/pkg/integration/checker" |
| 5 | 5 |
"github.com/go-check/check" |
| 6 | 6 |
|
| 7 |
+ "io/ioutil" |
|
| 8 |
+ "os" |
|
| 9 |
+ "os/exec" |
|
| 10 |
+ "path/filepath" |
|
| 7 | 11 |
"strings" |
| 8 | 12 |
) |
| 9 | 13 |
|
| ... | ... |
@@ -26,7 +30,16 @@ func (s *DockerSuite) TestPluginBasicOps(c *check.C) {
|
| 26 | 26 |
|
| 27 | 27 |
out, _, err = dockerCmdWithError("plugin", "inspect", pNameWithTag)
|
| 28 | 28 |
c.Assert(err, checker.IsNil) |
| 29 |
- c.Assert(out, checker.Contains, "A test plugin for Docker") |
|
| 29 |
+ tmpFile, err := ioutil.TempFile("", "inspect.json")
|
|
| 30 |
+ c.Assert(err, checker.IsNil) |
|
| 31 |
+ defer tmpFile.Close() |
|
| 32 |
+ |
|
| 33 |
+ if _, err := tmpFile.Write([]byte(out)); err != nil {
|
|
| 34 |
+ c.Fatal(err) |
|
| 35 |
+ } |
|
| 36 |
+ // FIXME: When `docker plugin inspect` takes a format as input, jq can be replaced. |
|
| 37 |
+ id, err := exec.Command("jq", ".Id", "--raw-output", tmpFile.Name()).CombinedOutput()
|
|
| 38 |
+ c.Assert(err, checker.IsNil) |
|
| 30 | 39 |
|
| 31 | 40 |
out, _, err = dockerCmdWithError("plugin", "remove", pNameWithTag)
|
| 32 | 41 |
c.Assert(out, checker.Contains, "is active") |
| ... | ... |
@@ -37,6 +50,11 @@ func (s *DockerSuite) TestPluginBasicOps(c *check.C) {
|
| 37 | 37 |
out, _, err = dockerCmdWithError("plugin", "remove", pNameWithTag)
|
| 38 | 38 |
c.Assert(err, checker.IsNil) |
| 39 | 39 |
c.Assert(out, checker.Contains, pNameWithTag) |
| 40 |
+ |
|
| 41 |
+ _, err = os.Stat(filepath.Join(dockerBasePath, "plugins", string(id))) |
|
| 42 |
+ if !os.IsNotExist(err) {
|
|
| 43 |
+ c.Fatal(err) |
|
| 44 |
+ } |
|
| 40 | 45 |
} |
| 41 | 46 |
|
| 42 | 47 |
func (s *DockerSuite) TestPluginInstallDisable(c *check.C) {
|
| ... | ... |
@@ -372,7 +372,7 @@ func (pm *Manager) remove(p *plugin) error {
|
| 372 | 372 |
delete(pm.plugins, p.PluginObj.ID) |
| 373 | 373 |
delete(pm.nameToID, p.Name()) |
| 374 | 374 |
pm.save() |
| 375 |
- return nil |
|
| 375 |
+ return os.RemoveAll(filepath.Join(pm.libRoot, p.PluginObj.ID)) |
|
| 376 | 376 |
} |
| 377 | 377 |
|
| 378 | 378 |
func (pm *Manager) set(p *plugin, args []string) error {
|