mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
daemon/graphdriver: deprecate GetDriver(), and remove its use
The exported function was only used in tests, and identical in use when using New with a name provided. Deprecate it, and remove the uses of it in our (integration-)tests. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -158,7 +158,7 @@ func Register(name string, initFunc InitFunc) error {
|
||||
|
||||
// GetDriver initializes and returns the registered driver.
|
||||
//
|
||||
// It is exported for use in (integration-)tests, but should be considered internal.
|
||||
// Deprecated: this function was exported for (integration-)tests, but no longer used, and will be removed in the next release.
|
||||
func GetDriver(name string, config Options) (Driver, error) {
|
||||
return getDriver(name, config)
|
||||
}
|
||||
|
||||
@@ -30,11 +30,16 @@ type Driver struct {
|
||||
}
|
||||
|
||||
func newDriver(t testing.TB, name string, options []string) *Driver {
|
||||
if name == "" {
|
||||
// Prevent graphdriver.New() from auto-detecting / picking a storage driver.
|
||||
t.Fatal("newDriver requires a name for the storage driver to use")
|
||||
}
|
||||
|
||||
root, err := os.MkdirTemp("", "docker-graphtest-")
|
||||
assert.NilError(t, err)
|
||||
|
||||
assert.NilError(t, os.MkdirAll(root, 0o755))
|
||||
d, err := graphdriver.GetDriver(name, graphdriver.Options{DriverOptions: options, Root: root})
|
||||
d, err := graphdriver.New(name, graphdriver.Options{DriverOptions: options, Root: root})
|
||||
if err != nil {
|
||||
t.Logf("graphdriver: %v\n", err)
|
||||
if graphdriver.IsDriverNotSupported(err) {
|
||||
|
||||
@@ -92,7 +92,7 @@ func TestXattrUnsupportedByBackingFS(t *testing.T) {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
subdir := filepath.Join(rootdir, tt.name)
|
||||
assert.NilError(t, os.Mkdir(subdir, 0o755))
|
||||
d, err := graphdriver.GetDriver("vfs", graphdriver.Options{
|
||||
d, err := graphdriver.New("vfs", graphdriver.Options{
|
||||
DriverOptions: tt.opts,
|
||||
Root: subdir,
|
||||
})
|
||||
|
||||
@@ -26,7 +26,7 @@ func init() {
|
||||
}
|
||||
|
||||
func newVFSGraphDriver(td string) (graphdriver.Driver, error) {
|
||||
return graphdriver.GetDriver("vfs", graphdriver.Options{
|
||||
return graphdriver.New("vfs", graphdriver.Options{
|
||||
Root: td,
|
||||
IDMap: idtools.IdentityMapping{
|
||||
UIDMaps: []idtools.IDMap{{
|
||||
|
||||
Reference in New Issue
Block a user