2015-09-18 19:58:05 -04:00
|
|
|
package volumedrivers
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2016-09-12 03:34:19 -04:00
|
|
|
volumetestutils "github.com/docker/docker/volume/testutils"
|
2015-09-18 19:58:05 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestGetDriver(t *testing.T) {
|
|
|
|
_, err := GetDriver("missing")
|
|
|
|
if err == nil {
|
|
|
|
t.Fatal("Expected error, was nil")
|
|
|
|
}
|
2015-09-23 16:29:14 -04:00
|
|
|
Register(volumetestutils.NewFakeDriver("fake"), "fake")
|
2016-09-07 20:01:10 -04:00
|
|
|
|
2015-09-18 19:58:05 -04:00
|
|
|
d, err := GetDriver("fake")
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
if d.Name() != "fake" {
|
|
|
|
t.Fatalf("Expected fake driver, got %s\n", d.Name())
|
|
|
|
}
|
|
|
|
}
|