github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/volume/drivers/extpoint_test.go (about)

     1  package drivers // import "github.com/demonoid81/moby/volume/drivers"
     2  
     3  import (
     4  	"testing"
     5  
     6  	volumetestutils "github.com/demonoid81/moby/volume/testutils"
     7  )
     8  
     9  func TestGetDriver(t *testing.T) {
    10  	s := NewStore(nil)
    11  	_, err := s.GetDriver("missing")
    12  	if err == nil {
    13  		t.Fatal("Expected error, was nil")
    14  	}
    15  	s.Register(volumetestutils.NewFakeDriver("fake"), "fake")
    16  
    17  	d, err := s.GetDriver("fake")
    18  	if err != nil {
    19  		t.Fatal(err)
    20  	}
    21  	if d.Name() != "fake" {
    22  		t.Fatalf("Expected fake driver, got %s\n", d.Name())
    23  	}
    24  }