github.com/jingleWang/moby@v1.13.1/volume/drivers/extpoint_test.go (about)

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