github.com/kaisenlinux/docker.io@v0.0.0-20230510090727-ea55db55fac7/engine/daemon/graphdriver/fuse-overlayfs/fuseoverlayfs_test.go (about)

     1  //go:build linux
     2  // +build linux
     3  
     4  package fuseoverlayfs // import "github.com/docker/docker/daemon/graphdriver/fuse-overlayfs"
     5  
     6  import (
     7  	"testing"
     8  
     9  	"github.com/docker/docker/daemon/graphdriver"
    10  	"github.com/docker/docker/daemon/graphdriver/graphtest"
    11  	"github.com/docker/docker/pkg/archive"
    12  	"github.com/docker/docker/pkg/reexec"
    13  )
    14  
    15  func init() {
    16  	// Do not sure chroot to speed run time and allow archive
    17  	// errors or hangs to be debugged directly from the test process.
    18  	untar = archive.UntarUncompressed
    19  	graphdriver.ApplyUncompressedLayer = archive.ApplyUncompressedLayer
    20  
    21  	reexec.Init()
    22  }
    23  
    24  // This avoids creating a new driver for each test if all tests are run
    25  // Make sure to put new tests between TestFUSEOverlayFSSetup and TestFUSEOverlayFSTeardown
    26  func TestFUSEOverlayFSSetup(t *testing.T) {
    27  	graphtest.GetDriver(t, driverName)
    28  }
    29  
    30  func TestFUSEOverlayFSCreateEmpty(t *testing.T) {
    31  	graphtest.DriverTestCreateEmpty(t, driverName)
    32  }
    33  
    34  func TestFUSEOverlayFSCreateBase(t *testing.T) {
    35  	graphtest.DriverTestCreateBase(t, driverName)
    36  }
    37  
    38  func TestFUSEOverlayFSCreateSnap(t *testing.T) {
    39  	graphtest.DriverTestCreateSnap(t, driverName)
    40  }
    41  
    42  func TestFUSEOverlayFS128LayerRead(t *testing.T) {
    43  	graphtest.DriverTestDeepLayerRead(t, 128, driverName)
    44  }
    45  
    46  func TestFUSEOverlayFSTeardown(t *testing.T) {
    47  	graphtest.PutDriver(t)
    48  }
    49  
    50  // Benchmarks should always setup new driver
    51  
    52  func BenchmarkExists(b *testing.B) {
    53  	graphtest.DriverBenchExists(b, driverName)
    54  }
    55  
    56  func BenchmarkGetEmpty(b *testing.B) {
    57  	graphtest.DriverBenchGetEmpty(b, driverName)
    58  }
    59  
    60  func BenchmarkDiffBase(b *testing.B) {
    61  	graphtest.DriverBenchDiffBase(b, driverName)
    62  }
    63  
    64  func BenchmarkDiffSmallUpper(b *testing.B) {
    65  	graphtest.DriverBenchDiffN(b, 10, 10, driverName)
    66  }
    67  
    68  func BenchmarkDiff10KFileUpper(b *testing.B) {
    69  	graphtest.DriverBenchDiffN(b, 10, 10000, driverName)
    70  }
    71  
    72  func BenchmarkDiff10KFilesBottom(b *testing.B) {
    73  	graphtest.DriverBenchDiffN(b, 10000, 10, driverName)
    74  }
    75  
    76  func BenchmarkDiffApply100(b *testing.B) {
    77  	graphtest.DriverBenchDiffApplyN(b, 100, driverName)
    78  }
    79  
    80  func BenchmarkDiff20Layers(b *testing.B) {
    81  	graphtest.DriverBenchDeepLayerDiff(b, 20, driverName)
    82  }
    83  
    84  func BenchmarkRead20Layers(b *testing.B) {
    85  	graphtest.DriverBenchDeepLayerRead(b, 20, driverName)
    86  }