func newTestMountNamespace(t *testing.T) (*fs.MountNamespace, string, error) {
	p, err := ioutil.TempDir("", "root")
	if err != nil {
		return nil, "", err
	}

	fd, err := open(nil, p)
	if err != nil {
		os.RemoveAll(p)
		return nil, "", err
	}
	ctx := contexttest.Context(t)
	root, err := newInode(ctx, newMountSource(ctx, p, fs.RootOwner, &Filesystem{}, fs.MountSourceFlags{}, false), fd, false, false)
	if err != nil {
		os.RemoveAll(p)
		return nil, "", err
	}
	mm, err := fs.NewMountNamespace(ctx, root)
	if err != nil {
		os.RemoveAll(p)
		return nil, "", err
	}
	return mm, p, nil
}
// newTestMountNamespace creates a MountNamespace with a ramfs root.
// It returns the host folder created, which should be removed when done.
newTestMountNamespace creates a MountNamespace with a ramfs root.
It returns the host folder created, which should be removed when done.
// newTestMountNamespace creates a MountNamespace with a ramfs root . // It returns the host folder created which should be removed when done .
func newTestMountNamespace(t *testing.T) (*fs.MountNamespace, string, error) {
	p, err := ioutil.TempDir("", "root")
	if err != nil {
		return nil, "", err
	}
	fd, err := open(nil, p)
	if err != nil {
		os.RemoveAll(p)
		return nil, "", err
	}
	ctx := contexttest.Context(t)
	root, err := newInode(ctx, newMountSource(ctx, p, fs.RootOwner, &Filesystem{}, fs.MountSourceFlags{}, false), fd, false, false)
	if err != nil {
		os.RemoveAll(p)
		return nil, "", err
	}
	mm, err := fs.NewMountNamespace(ctx, root)
	if err != nil {
		os.RemoveAll(p)
		return nil, "", err
	}
	return mm, p, nil
}
func newTestMountNamespace ( t * testing . T ) ( * fs . MountNamespace , string , error ) { p , err := ioutil . TempDir ( " " , " " ) if err != nil { return nil , " " , err } fd , err := open ( nil , p ) if err != nil { os . RemoveAll ( p ) return nil , " " , err } ctx := contexttest . Context ( t ) root , err := newInode ( ctx , newMountSource ( ctx , p , fs . RootOwner , & Filesystem { } , fs . MountSourceFlags { } , false ) , fd , false , false ) if err != nil { os . RemoveAll ( p ) return nil , " " , err } mm , err := fs . NewMountNamespace ( ctx , root ) if err != nil { os . RemoveAll ( p ) return nil , " " , err } return mm , p , nil }
newTestMountNamespace creates a MountNamespace with a ramfs root.
newTestMountNamespace creates a MountNamespace with a ramfs root .