2015-04-27 14:53:12 +00:00
|
|
|
// +build linux
|
|
|
|
|
2014-12-03 13:06:19 +00:00
|
|
|
package overlay
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
2015-12-16 15:35:35 +00:00
|
|
|
|
2016-04-15 22:53:37 +00:00
|
|
|
"github.com/docker/docker/daemon/graphdriver"
|
2015-12-16 15:35:35 +00:00
|
|
|
"github.com/docker/docker/daemon/graphdriver/graphtest"
|
2016-04-15 22:53:37 +00:00
|
|
|
"github.com/docker/docker/pkg/archive"
|
2014-12-03 13:06:19 +00:00
|
|
|
)
|
|
|
|
|
2016-04-15 22:53:37 +00:00
|
|
|
func init() {
|
|
|
|
// Do not sure chroot to speed run time and allow archive
|
|
|
|
// errors or hangs to be debugged directly from the test process.
|
|
|
|
graphdriver.ApplyUncompressedLayer = archive.ApplyUncompressedLayer
|
|
|
|
}
|
|
|
|
|
2014-12-03 13:06:19 +00:00
|
|
|
// This avoids creating a new driver for each test if all tests are run
|
|
|
|
// Make sure to put new tests between TestOverlaySetup and TestOverlayTeardown
|
|
|
|
func TestOverlaySetup(t *testing.T) {
|
|
|
|
graphtest.GetDriver(t, "overlay")
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestOverlayCreateEmpty(t *testing.T) {
|
|
|
|
graphtest.DriverTestCreateEmpty(t, "overlay")
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestOverlayCreateBase(t *testing.T) {
|
|
|
|
graphtest.DriverTestCreateBase(t, "overlay")
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestOverlayCreateSnap(t *testing.T) {
|
|
|
|
graphtest.DriverTestCreateSnap(t, "overlay")
|
|
|
|
}
|
|
|
|
|
2016-04-15 22:53:37 +00:00
|
|
|
func TestOverlay50LayerRead(t *testing.T) {
|
|
|
|
graphtest.DriverTestDeepLayerRead(t, 50, "overlay")
|
|
|
|
}
|
|
|
|
|
2016-06-14 05:34:57 +00:00
|
|
|
// Fails due to bug in calculating changes after apply
|
|
|
|
// likely related to https://github.com/docker/docker/issues/21555
|
2016-04-15 22:53:37 +00:00
|
|
|
func TestOverlayDiffApply10Files(t *testing.T) {
|
2016-06-14 05:34:57 +00:00
|
|
|
t.Skipf("Fails to compute changes after apply intermittently")
|
2016-04-15 22:53:37 +00:00
|
|
|
graphtest.DriverTestDiffApply(t, 10, "overlay")
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestOverlayChanges(t *testing.T) {
|
2016-06-14 05:34:57 +00:00
|
|
|
t.Skipf("Fails to compute changes intermittently")
|
2016-04-15 22:53:37 +00:00
|
|
|
graphtest.DriverTestChanges(t, "overlay")
|
|
|
|
}
|
|
|
|
|
2014-12-03 13:06:19 +00:00
|
|
|
func TestOverlayTeardown(t *testing.T) {
|
|
|
|
graphtest.PutDriver(t)
|
|
|
|
}
|
2016-04-15 22:53:37 +00:00
|
|
|
|
|
|
|
// Benchmarks should always setup new driver
|
|
|
|
|
|
|
|
func BenchmarkExists(b *testing.B) {
|
|
|
|
graphtest.DriverBenchExists(b, "overlay")
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkGetEmpty(b *testing.B) {
|
|
|
|
graphtest.DriverBenchGetEmpty(b, "overlay")
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkDiffBase(b *testing.B) {
|
|
|
|
graphtest.DriverBenchDiffBase(b, "overlay")
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkDiffSmallUpper(b *testing.B) {
|
|
|
|
graphtest.DriverBenchDiffN(b, 10, 10, "overlay")
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkDiff10KFileUpper(b *testing.B) {
|
|
|
|
graphtest.DriverBenchDiffN(b, 10, 10000, "overlay")
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkDiff10KFilesBottom(b *testing.B) {
|
|
|
|
graphtest.DriverBenchDiffN(b, 10000, 10, "overlay")
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkDiffApply100(b *testing.B) {
|
|
|
|
graphtest.DriverBenchDiffApplyN(b, 100, "overlay")
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkDiff20Layers(b *testing.B) {
|
|
|
|
graphtest.DriverBenchDeepLayerDiff(b, 20, "overlay")
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkRead20Layers(b *testing.B) {
|
|
|
|
graphtest.DriverBenchDeepLayerRead(b, 20, "overlay")
|
|
|
|
}
|