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

     1  //go:build linux
     2  // +build linux
     3  
     4  package overlay // import "github.com/docker/docker/daemon/graphdriver/overlay"
     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  )
    13  
    14  func init() {
    15  	// Do not sure chroot to speed run time and allow archive
    16  	// errors or hangs to be debugged directly from the test process.
    17  	graphdriver.ApplyUncompressedLayer = archive.ApplyUncompressedLayer
    18  }
    19  
    20  // This avoids creating a new driver for each test if all tests are run
    21  // Make sure to put new tests between TestOverlaySetup and TestOverlayTeardown
    22  func TestOverlaySetup(t *testing.T) {
    23  	graphtest.GetDriver(t, "overlay")
    24  }
    25  
    26  func TestOverlayCreateEmpty(t *testing.T) {
    27  	graphtest.DriverTestCreateEmpty(t, "overlay")
    28  }
    29  
    30  func TestOverlayCreateBase(t *testing.T) {
    31  	graphtest.DriverTestCreateBase(t, "overlay")
    32  }
    33  
    34  func TestOverlayCreateSnap(t *testing.T) {
    35  	graphtest.DriverTestCreateSnap(t, "overlay")
    36  }
    37  
    38  func TestOverlay50LayerRead(t *testing.T) {
    39  	graphtest.DriverTestDeepLayerRead(t, 50, "overlay")
    40  }
    41  
    42  // Fails due to bug in calculating changes after apply
    43  // likely related to https://github.com/docker/docker/issues/21555
    44  func TestOverlayDiffApply10Files(t *testing.T) {
    45  	t.Skipf("Fails to compute changes after apply intermittently")
    46  	graphtest.DriverTestDiffApply(t, 10, "overlay")
    47  }
    48  
    49  func TestOverlayChanges(t *testing.T) {
    50  	t.Skipf("Fails to compute changes intermittently")
    51  	graphtest.DriverTestChanges(t, "overlay")
    52  }
    53  
    54  func TestOverlayTeardown(t *testing.T) {
    55  	graphtest.PutDriver(t)
    56  }
    57  
    58  // Benchmarks should always setup new driver
    59  
    60  func BenchmarkExists(b *testing.B) {
    61  	graphtest.DriverBenchExists(b, "overlay")
    62  }
    63  
    64  func BenchmarkGetEmpty(b *testing.B) {
    65  	graphtest.DriverBenchGetEmpty(b, "overlay")
    66  }
    67  
    68  func BenchmarkDiffBase(b *testing.B) {
    69  	graphtest.DriverBenchDiffBase(b, "overlay")
    70  }
    71  
    72  func BenchmarkDiffSmallUpper(b *testing.B) {
    73  	graphtest.DriverBenchDiffN(b, 10, 10, "overlay")
    74  }
    75  
    76  func BenchmarkDiff10KFileUpper(b *testing.B) {
    77  	graphtest.DriverBenchDiffN(b, 10, 10000, "overlay")
    78  }
    79  
    80  func BenchmarkDiff10KFilesBottom(b *testing.B) {
    81  	graphtest.DriverBenchDiffN(b, 10000, 10, "overlay")
    82  }
    83  
    84  func BenchmarkDiffApply100(b *testing.B) {
    85  	graphtest.DriverBenchDiffApplyN(b, 100, "overlay")
    86  }
    87  
    88  func BenchmarkDiff20Layers(b *testing.B) {
    89  	graphtest.DriverBenchDeepLayerDiff(b, 20, "overlay")
    90  }
    91  
    92  func BenchmarkRead20Layers(b *testing.B) {
    93  	graphtest.DriverBenchDeepLayerRead(b, 20, "overlay")
    94  }