This repository has been archived by the owner on Mar 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from rn/motest
Add mostly volume sharing tests
- Loading branch information
Showing
51 changed files
with
1,188 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
FROM alpine:3.6 | ||
FROM alpine:3.7 | ||
RUN touch /simple |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
FROM alpine:3.6 | ||
FROM alpine:3.7 | ||
RUN touch /tag |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
FROM alpine:3.6 | ||
FROM alpine:3.7 | ||
RUN touch /iid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
FROM alpine:3.6 | ||
FROM alpine:3.7 | ||
RUN exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
FROM alpine:3.6 | ||
FROM alpine:3.7 | ||
ARG ARGUMENT | ||
RUN echo ${ARGUMENT} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
FROM alpine:3.6 | ||
FROM alpine:3.7 | ||
WORKDIR /foo | ||
RUN touch workdir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
FROM alpine:3.6 AS stage0 | ||
FROM alpine:3.7 AS stage0 | ||
RUN touch /multi0 | ||
|
||
FROM alpine:3.6 AS stage1 | ||
FROM alpine:3.7 AS stage1 | ||
RUN touch /multi1 | ||
|
||
FROM alpine:3.6 | ||
FROM alpine:3.7 | ||
COPY --from=stage0 /multi0 / | ||
COPY --from=stage1 /multi1 / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
# SUMMARY: Simple test that we can create (touch) a file on the host | ||
# SUMMARY: Create (touch) a file on volume mount and check on the host | ||
# LABELS: | ||
# REPEAT: | ||
|
||
Set-PSDebug -Trace 2 | ||
|
||
$fileName = "foobar" | ||
|
||
# Make sure the | ||
Remove-Item -Path $fileName -Force | ||
if (Test-Path $fileName) { | ||
Remove-Item -Path $fileName -Force | ||
} | ||
|
||
$p = [string]$pwd.Path | ||
docker run --platform linux --rm -v $p`:/test alpine:3.6 touch /test/$fileName | ||
docker run --platform linux --rm -v $p`:/test alpine:3.7 sh -c "touch /test/$fileName" | ||
if ($lastexitcode -ne 0) { | ||
exit 1 | ||
} | ||
|
||
if (Test-Path $fileName) { | ||
if (Test-Path $fileName -PathType leaf) { | ||
Remove-Item -Path $fileName -Force | ||
exit 0 | ||
} | ||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# SUMMARY: Create a file on mounted volume and check contents on the host | ||
# LABELS: | ||
# REPEAT: | ||
|
||
Set-PSDebug -Trace 2 | ||
|
||
$fileName = "foobar" | ||
|
||
if (Test-Path $fileName) { | ||
Remove-Item -Path $fileName -Force | ||
} | ||
|
||
$p = [string]$pwd.Path | ||
docker run --platform linux --rm -v $p`:/test alpine:3.7 sh -c "echo -n $fileName > /test/$fileName" | ||
if ($lastexitcode -ne 0) { | ||
exit 1 | ||
} | ||
|
||
if (Test-Path $fileName -PathType leaf) { | ||
$content = Get-Content $fileName -Raw | ||
Remove-Item -Path $fileName -Force | ||
if ($content -ne $fileName) { | ||
$content | ||
exit 1 | ||
} | ||
exit 0 | ||
} | ||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# SUMMARY: Create a directory on a mounted volume and check on the host | ||
# LABELS: | ||
# REPEAT: | ||
|
||
Set-PSDebug -Trace 2 | ||
|
||
$fileName = "foobar" | ||
|
||
if (Test-Path $fileName) { | ||
Remove-Item -Path $fileName -Force | ||
} | ||
|
||
$p = [string]$pwd.Path | ||
docker run --platform linux --rm -v $p`:/test alpine:3.7 sh -c "mkdir /test/$fileName" | ||
if ($lastexitcode -ne 0) { | ||
exit 1 | ||
} | ||
|
||
if (Test-Path $fileName -PathType container) { | ||
Remove-Item -Path $fileName -Force | ||
exit 0 | ||
} | ||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# SUMMARY: Create a sub-directory on a mounted volume and check on the host | ||
# LABELS: | ||
# REPEAT: | ||
|
||
Set-PSDebug -Trace 2 | ||
|
||
$baseName = "foobar" | ||
$fileName = "baz" | ||
|
||
if (Test-Path $fileName) { | ||
Remove-Item -Path $fileName -Force -Recurse | ||
} | ||
|
||
New-Item -ItemType directory $baseName | ||
|
||
$p = [string]$pwd.Path | ||
docker run --platform linux --rm -v $p`:/test alpine:3.7 sh -c "mkdir /test/$baseName/$fileName" | ||
if ($lastexitcode -ne 0) { | ||
exit 1 | ||
} | ||
|
||
if (Test-Path $baseName\$fileName -PathType container) { | ||
Remove-Item -Path $baseName -Force -Recurse | ||
exit 0 | ||
} | ||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# SUMMARY: Create directories on a mounted volume and check on the host | ||
# LABELS: | ||
# REPEAT: | ||
|
||
Set-PSDebug -Trace 2 | ||
|
||
$fileName = "foo/bar" | ||
$fileNameWin = "foo\bar" | ||
|
||
if (Test-Path $fileNameWin) { | ||
Remove-Item -Path $fileNameWin -Force | ||
} | ||
|
||
$p = [string]$pwd.Path | ||
docker run --platform linux --rm -v $p`:/test alpine:3.7 sh -c "mkdir -p /test/$fileName" | ||
if ($lastexitcode -ne 0) { | ||
exit 1 | ||
} | ||
|
||
if (Test-Path $fileNameWin -PathType container) { | ||
Remove-Item -Path $fileNameWin -Force | ||
exit 0 | ||
} | ||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# SUMMARY: Remove a subdir create on the host in a container | ||
# LABELS: | ||
# REPEAT: | ||
|
||
Set-PSDebug -Trace 2 | ||
|
||
$dirName = "foobar" | ||
|
||
if (Test-Path $dirName) { | ||
Remove-Item -Path $dirName -Force -Recurse | ||
} | ||
|
||
New-Item -ItemType directory $dirName | ||
|
||
$p = [string]$pwd.Path | ||
docker run --platform linux --rm -v $p`:/test alpine:3.7 sh -c "rmdir /test/$dirName" | ||
if ($lastexitcode -ne 0) { | ||
exit 1 | ||
} | ||
|
||
if (Test-Path $dirName) { | ||
Remove-Item -Path $baseName -Force -Recurse | ||
exit 1 | ||
} | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM alpine:3.7 | ||
COPY rmdir_test.sh / | ||
RUN chmod ugo+x rmdir_test.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
set -x | ||
|
||
DIR=$1 | ||
|
||
cd "$DIR" || exit 1 | ||
rm -rf foo | ||
mkdir foo | ||
touch foo/bar | ||
(rmdir foo 2> output || true) | ||
cat output | ||
rm -rf foo | ||
grep "Directory not empty" output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# SUMMARY: Try to remove a non-empty sub-directory on a mounted volume | ||
# LABELS: | ||
# REPEAT: | ||
|
||
Set-PSDebug -Trace 2 | ||
|
||
$imageName = "rmdir-nonempty" | ||
|
||
docker build --platform linux -t $imageName . | ||
if ($lastexitcode -ne 0) { | ||
exit 1 | ||
} | ||
|
||
$p = [string]$pwd.Path | ||
docker run --rm -v $p`:/test $imageName /rmdir_test.sh /test | ||
if ($lastexitcode -ne 0) { | ||
exit 1 | ||
} | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM alpine:3.7 | ||
COPY symlink_test.sh / | ||
RUN chmod ugo+x symlink_test.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
set -x | ||
|
||
FILE=$1 | ||
LINK=$2 | ||
CONTENT="foo" | ||
|
||
echo "$CONTENT" > $FILE | ||
ln -s "$FILE" "$LINK" | ||
|
||
if [[ $(readlink "$LINK") != "$FILE" ]]; then | ||
echo "Symlink $LINK is not pointing to $FILE" | ||
exit 1 | ||
fi | ||
|
||
if [[ $(cat "$LINK") != "$CONTENT" ]]; then | ||
echo "Contents don't match" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# SUMMARY: Create a symlink on a volume mount and check in container | ||
# LABELS: | ||
# REPEAT: | ||
|
||
Set-PSDebug -Trace 2 | ||
|
||
$imageName = "symlink-container" | ||
$fileName = "foobar" | ||
$linkName = "barfoo" | ||
|
||
if (Test-Path $fileName) { | ||
Remove-Item -Path $fileName -Force | ||
} | ||
if (Test-Path $linkName) { | ||
Remove-Item -Path $linkName -Force | ||
} | ||
|
||
docker build --platform linux -t $imageName . | ||
if ($lastexitcode -ne 0) { | ||
exit 1 | ||
} | ||
|
||
$p = [string]$pwd.Path | ||
docker run --rm -v $p`:/test $imageName /symlink_test.sh /test/$fileName /test/$linkName | ||
if ($lastexitcode -ne 0) { | ||
if (Test-Path $fileName) { | ||
Remove-Item -Path $fileName -Force | ||
} | ||
if (Test-Path $linkName) { | ||
Remove-Item -Path $linkName -Force | ||
} | ||
exit 1 | ||
} | ||
|
||
Remove-Item -Path $fileName -Force | ||
Remove-Item -Path $linkName -Force | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM alpine:3.7 | ||
COPY hardlink_test.sh / | ||
RUN chmod ugo+x hardlink_test.sh |
31 changes: 31 additions & 0 deletions
31
tests/cases/060_volume/055_hardlink_volume/hardlink_test.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
set -x | ||
|
||
FILE=$1 | ||
LINK=$2 | ||
CONTENT="foo" | ||
|
||
echo "$CONTENT" > $FILE | ||
ln "$FILE" "$LINK" | ||
|
||
if [[ $(stat -c %h "$FILE") != $(stat -c %h "$LINK") ]]; then | ||
echo "Number of hardlinks don't match" | ||
exit 1 | ||
fi | ||
|
||
if [[ $(stat -c %i "$FILE") != $(stat -c %i "$LINK") ]]; then | ||
echo "Inode numbers don't match" | ||
exit 1 | ||
fi | ||
|
||
if [[ $(stat -c %h "$FILE") <= 1 ]]; then | ||
echo "$FILE should Number of hardlinks greater than 1" | ||
exit 1 | ||
fi | ||
|
||
if [[ $(cat "$LINK") != "$CONTENT" ]]; then | ||
echo "Contents don't match" | ||
exit 1 | ||
fi |
Oops, something went wrong.