From 4d116f8caee01d47e344571c0fe4b805ae44e8d8 Mon Sep 17 00:00:00 2001
From: Jamie Anderson <jamieand@amazon.com>
Date: Fri, 19 Mar 2021 20:59:20 +0000
Subject: [PATCH] Skip btrfs graphdriver tests if not root

Signed-off-by: Jamie Anderson <jamieand@amazon.com>
---
 daemon/graphdriver/btrfs/btrfs_test.go | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/daemon/graphdriver/btrfs/btrfs_test.go b/daemon/graphdriver/btrfs/btrfs_test.go
index b70e93b..c75960b 100644
--- a/daemon/graphdriver/btrfs/btrfs_test.go
+++ b/daemon/graphdriver/btrfs/btrfs_test.go
@@ -6,6 +6,7 @@ import (
 	"os"
 	"path"
 	"testing"
+	"github.com/docker/docker/testutil"
 
 	"github.com/docker/docker/daemon/graphdriver/graphtest"
 )
@@ -13,22 +14,27 @@ import (
 // This avoids creating a new driver for each test if all tests are run
 // Make sure to put new tests between TestBtrfsSetup and TestBtrfsTeardown
 func TestBtrfsSetup(t *testing.T) {
+	testutil.RequiresRoot(t)
 	graphtest.GetDriver(t, "btrfs")
 }
 
 func TestBtrfsCreateEmpty(t *testing.T) {
+	testutil.RequiresRoot(t)
 	graphtest.DriverTestCreateEmpty(t, "btrfs")
 }
 
 func TestBtrfsCreateBase(t *testing.T) {
+	testutil.RequiresRoot(t)
 	graphtest.DriverTestCreateBase(t, "btrfs")
 }
 
 func TestBtrfsCreateSnap(t *testing.T) {
+	testutil.RequiresRoot(t)
 	graphtest.DriverTestCreateSnap(t, "btrfs")
 }
 
 func TestBtrfsSubvolDelete(t *testing.T) {
+	testutil.RequiresRoot(t)
 	d := graphtest.GetDriver(t, "btrfs")
 	if err := d.CreateReadWrite("test", "", nil); err != nil {
 		t.Fatal(err)
-- 
2.31.0.rc2

