github.com/Prakhar-Agarwal-byte/moby@v0.0.0-20231027092010-a14e3e8ab87e/volume/drivers/extpoint_test.go (about)

     1  package drivers // import "github.com/Prakhar-Agarwal-byte/moby/volume/drivers"
     2  
     3  import (
     4  	"testing"
     5  
     6  	volumetestutils "github.com/Prakhar-Agarwal-byte/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  }