mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
4db753c017
fmt package formats an error by calling its Error() method. This results in recursion. Fix this. Also remove dead code. Signed-off-by: Anusha Ragunathan <anusha@docker.com>
34 lines
936 B
Go
34 lines
936 B
Go
package store
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/docker/docker/api/types"
|
|
"github.com/docker/docker/plugin/v2"
|
|
)
|
|
|
|
func TestFilterByCapNeg(t *testing.T) {
|
|
p := v2.NewPlugin("test", "1234567890", "/run/docker", "latest")
|
|
|
|
iType := types.PluginInterfaceType{"volumedriver", "docker", "1.0"}
|
|
i := types.PluginManifestInterface{"plugins.sock", []types.PluginInterfaceType{iType}}
|
|
p.PluginObj.Manifest.Interface = i
|
|
|
|
_, err := p.FilterByCap("foobar")
|
|
if err == nil {
|
|
t.Fatalf("expected inadequate error, got %v", err)
|
|
}
|
|
}
|
|
|
|
func TestFilterByCapPos(t *testing.T) {
|
|
p := v2.NewPlugin("test", "1234567890", "/run/docker", "latest")
|
|
|
|
iType := types.PluginInterfaceType{"volumedriver", "docker", "1.0"}
|
|
i := types.PluginManifestInterface{"plugins.sock", []types.PluginInterfaceType{iType}}
|
|
p.PluginObj.Manifest.Interface = i
|
|
|
|
_, err := p.FilterByCap("volumedriver")
|
|
if err != nil {
|
|
t.Fatalf("expected no error, got %v", err)
|
|
}
|
|
}
|