Skip to content
This repository has been archived by the owner on Mar 24, 2020. It is now read-only.

Commit

Permalink
tests: Add some volume test for large number of files in a single dir…
Browse files Browse the repository at this point in the history
…ectory

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
  • Loading branch information
rn committed Mar 23, 2018
1 parent 7f5a3d7 commit 1b67a6b
Show file tree
Hide file tree
Showing 21 changed files with 427 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#! /bin/sh

set -e
# don't set -x as it creates a lot of noise

DIR=$1

# find calls lstat()
find "$DIR" -type f > dev/null
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# SUMMARY: Stat 5000 files in a single directory created on the host
# LABELS:
# REPEAT:

$libBase = Join-Path -Path $env:RT_PROJECT_ROOT -ChildPath _lib
$lib = Join-Path -Path $libBase -ChildPath lib.ps1
. $lib

$ret = 0

$testPath = Join-Path -Path $env:TEST_TMP_ROOT -ChildPath "single-dir-stat"

$p = [string]$pwd.Path
docker run --platform linux --rm `
-v $testPath`:/test `
-v $p`:/script `
alpine:3.7 sh /script/run.sh /test
if ($lastexitcode -ne 0) {
$ret = 1
}

exit $ret
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#! /bin/sh

# set -e
# don't set -x as it creates a lot of noise

DIR=$1

for i in $(seq 5000); do
stat "$DIR/file-$i" 2> /dev/null
done
exit 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SUMMARY: Stat 5000 non-existing files in a single directory on a shared volume
# LABELS:
# REPEAT:

$libBase = Join-Path -Path $env:RT_PROJECT_ROOT -ChildPath _lib
$lib = Join-Path -Path $libBase -ChildPath lib.ps1
. $lib

$ret = 0

Remove-Item -Force -Recurse -ErrorAction Ignore -Path $env:TEST_TMP
New-Item -ItemType Directory -Force -Path $env:TEST_TMP

$p = [string]$pwd.Path
docker run --platform linux --rm `
-v $env:TEST_TMP`:/test `
-v $p`:/script `
alpine:3.7 sh /script/run.sh /test
if ($lastexitcode -ne 0) {
$ret = 1
}

Remove-Item -Force -Recurse -ErrorAction Ignore -Path $env:TEST_TMP
exit $ret
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#! /bin/sh

set -e
# don't set -x as it creates a lot of noise

DIR=$1

for i in $(seq 5000); do
touch "$DIR/file-$i"
done
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SUMMARY: Create 5000 files in a single directory on a shared volume
# LABELS:
# REPEAT:

$libBase = Join-Path -Path $env:RT_PROJECT_ROOT -ChildPath _lib
$lib = Join-Path -Path $libBase -ChildPath lib.ps1
. $lib

$ret = 0

Remove-Item -Force -Recurse -ErrorAction Ignore -Path $env:TEST_TMP
New-Item -ItemType Directory -Force -Path $env:TEST_TMP

$p = [string]$pwd.Path
docker run --platform linux --rm `
-v $env:TEST_TMP`:/test `
-v $p`:/script `
alpine:3.7 sh /script/run.sh /test
if ($lastexitcode -ne 0) {
$ret = 1
}

Remove-Item -Force -Recurse -ErrorAction Ignore -Path $env:TEST_TMP
exit $ret
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#! /bin/sh

set -e
# don't set -x as it creates a lot of noise

DIR=$1

for i in $(seq 5000); do
touch "$DIR/file-$i"
done

# find calls lstat()
find "$DIR" -type f > dev/null
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SUMMARY: Create 5000 files in a single directory on a shared volume and then stat them
# LABELS:
# REPEAT:

$libBase = Join-Path -Path $env:RT_PROJECT_ROOT -ChildPath _lib
$lib = Join-Path -Path $libBase -ChildPath lib.ps1
. $lib

$ret = 0

Remove-Item -Force -Recurse -ErrorAction Ignore -Path $env:TEST_TMP
New-Item -ItemType Directory -Force -Path $env:TEST_TMP

$p = [string]$pwd.Path
docker run --platform linux --rm `
-v $env:TEST_TMP`:/test `
-v $p`:/script `
alpine:3.7 sh /script/run.sh /test
if ($lastexitcode -ne 0) {
$ret = 1
}

Remove-Item -Force -Recurse -ErrorAction Ignore -Path $env:TEST_TMP
exit $ret
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#! /bin/sh

set -e
# don't set -x as it creates a lot of noise

DIR=$1

# find calls lstat()
find "$DIR" -type f -print0 | xargs -0 touch > dev/null
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# SUMMARY: Stat and then touch 5000 files in a single directory created on the host
# LABELS:
# REPEAT:

$libBase = Join-Path -Path $env:RT_PROJECT_ROOT -ChildPath _lib
$lib = Join-Path -Path $libBase -ChildPath lib.ps1
. $lib

$ret = 0

$testPath = Join-Path -Path $env:TEST_TMP_ROOT -ChildPath "single-dir-touch"

$p = [string]$pwd.Path
docker run --platform linux --rm `
-v $testPath`:/test `
-v $p`:/script `
alpine:3.7 sh /script/run.sh /test
if ($lastexitcode -ne 0) {
$ret = 1
}

exit $ret
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#! /bin/sh

set -e

DIR=$1

# find calls lstat()
find "$DIR" -type f -print0 | xargs -0 touch > dev/null
find "$DIR" -type f > dev/null
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# SUMMARY: Stat, touch and then stat again 5000 files on a shared volume
# LABELS:
# REPEAT:

$libBase = Join-Path -Path $env:RT_PROJECT_ROOT -ChildPath _lib
$lib = Join-Path -Path $libBase -ChildPath lib.ps1
. $lib

$ret = 0

$testPath = Join-Path -Path $env:TEST_TMP_ROOT -ChildPath "single-dir-touch-stat"

$p = [string]$pwd.Path
docker run --platform linux --rm `
-v $testPath`:/test `
-v $p`:/script `
alpine:3.7 sh /script/run.sh /test
if ($lastexitcode -ne 0) {
$ret = 1
}

exit $ret
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#! /bin/sh

set -e

DIR=$1
SIZE=$2

for i in $(seq 5000); do
dd if=/dev/zero of="$DIR/file-$i" bs="$SIZE" count=1
done
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SUMMARY: Write 5000 small files in a single directory
# LABELS:
# REPEAT:

$libBase = Join-Path -Path $env:RT_PROJECT_ROOT -ChildPath _lib
$lib = Join-Path -Path $libBase -ChildPath lib.ps1
. $lib

$ret = 0

Remove-Item -Force -Recurse -ErrorAction Ignore -Path $env:TEST_TMP
New-Item -ItemType Directory -Force -Path $env:TEST_TMP

$p = [string]$pwd.Path
docker run --platform linux --rm `
-v $env:TEST_TMP`:/test `
-v $p`:/script `
alpine:3.7 sh /script/run.sh /test 512
if ($lastexitcode -ne 0) {
$ret = 1
}

Remove-Item -Force -Recurse -ErrorAction Ignore -Path $env:TEST_TMP
exit $ret
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#! /bin/sh

set -e

DIR=$1
SIZE=$2

for i in $(seq 5000); do
dd if=/dev/zero of="$DIR/file-$i" bs="$SIZE" count=1
done

for i in $(seq 5000); do
dd if=/dev/zero of="$DIR/file-$i" bs="$SIZE" count=1
done
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SUMMARY: Write twice over the 5000 small files in a single directory
# LABELS:
# REPEAT:

$libBase = Join-Path -Path $env:RT_PROJECT_ROOT -ChildPath _lib
$lib = Join-Path -Path $libBase -ChildPath lib.ps1
. $lib

$ret = 0

Remove-Item -Force -Recurse -ErrorAction Ignore -Path $env:TEST_TMP
New-Item -ItemType Directory -Force -Path $env:TEST_TMP

$p = [string]$pwd.Path
docker run --platform linux --rm `
-v $env:TEST_TMP`:/test `
-v $p`:/script `
alpine:3.7 sh /script/run.sh /test 512
if ($lastexitcode -ne 0) {
$ret = 1
}

Remove-Item -Force -Recurse -ErrorAction Ignore -Path $env:TEST_TMP
exit $ret
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#! /bin/sh

set -e
# don't set -x as it creates a lot of noise

DIR=$1

# find calls lstat()
find "$DIR" -type f -print0 | xargs -0 cat > dev/null
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# SUMMARY: Stat and then read 5000 files in a single directory created on the host
# LABELS:
# REPEAT:

$libBase = Join-Path -Path $env:RT_PROJECT_ROOT -ChildPath _lib
$lib = Join-Path -Path $libBase -ChildPath lib.ps1
. $lib

$ret = 0

$testPath = Join-Path -Path $env:TEST_TMP_ROOT -ChildPath "single-dir-read"

$p = [string]$pwd.Path
docker run --platform linux --rm `
-v $testPath`:/test `
-v $p`:/script `
alpine:3.7 sh /script/run.sh /test
if ($lastexitcode -ne 0) {
$ret = 1
}

exit $ret
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#! /bin/sh

set -e

DIR=$1

# find calls lstat()
find "$DIR" -type f -print0 | xargs -0 cat > dev/null
find "$DIR" -type f -print0 | xargs -0 cat > dev/null
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# SUMMARY: Stat, read, stat, read 5000 files in a single directory created on the host
# LABELS:
# REPEAT:

$libBase = Join-Path -Path $env:RT_PROJECT_ROOT -ChildPath _lib
$lib = Join-Path -Path $libBase -ChildPath lib.ps1
. $lib

$ret = 0

$testPath = Join-Path -Path $env:TEST_TMP_ROOT -ChildPath "single-dir-read-read"

$p = [string]$pwd.Path
docker run --platform linux --rm `
-v $testPath`:/test `
-v $p`:/script `
alpine:3.7 sh /script/run.sh /test
if ($lastexitcode -ne 0) {
$ret = 1
}

exit $ret
Loading

0 comments on commit 1b67a6b

Please sign in to comment.