2018-03-19 17:16:26 -04:00
|
|
|
package drivers // import "github.com/docker/docker/volume/drivers"
|
2015-09-18 19:58:05 -04:00
|
|
|
|
|
|
|
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) {
|
2018-03-19 17:18:52 -04:00
|
|
|
s := NewStore(nil)
|
|
|
|
_, err := s.GetDriver("missing")
|
2015-09-18 19:58:05 -04:00
|
|
|
if err == nil {
|
|
|
|
t.Fatal("Expected error, was nil")
|
|
|
|
}
|
2018-03-19 17:18:52 -04:00
|
|
|
s.Register(volumetestutils.NewFakeDriver("fake"), "fake")
|
2016-09-07 20:01:10 -04:00
|
|
|
|
2018-03-19 17:18:52 -04:00
|
|
|
d, err := s.GetDriver("fake")
|
2015-09-18 19:58:05 -04:00
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
if d.Name() != "fake" {
|
|
|
|
t.Fatalf("Expected fake driver, got %s\n", d.Name())
|
|
|
|
}
|
|
|
|
}
|